lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] platform/x86: ideapad-laptop: switch platform profiles using thermal management key
Date
Ideapad laptops have thermal management or performance mode switch key
(Fn + Q). Now it sends KEY_PROG4.

Switch platform profiles instead, like the ThinkPad ACPI driver.

Tested on Yoga7 14ARB7.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
drivers/platform/x86/ideapad-laptop.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 901849810ce2..6310011cc1b3 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1071,7 +1071,6 @@ static const struct key_entry ideapad_keymap[] = {
{ KE_KEY, 16, { KEY_PROG1 } },
{ KE_KEY, 17, { KEY_PROG2 } },
{ KE_KEY, 64, { KEY_PROG3 } },
- { KE_KEY, 65, { KEY_PROG4 } },
{ KE_KEY, 66, { KEY_TOUCHPAD_OFF } },
{ KE_KEY, 67, { KEY_TOUCHPAD_ON } },
{ KE_KEY, 128, { KEY_ESC } },
@@ -1181,8 +1180,27 @@ static void ideapad_check_special_buttons(struct ideapad_private *priv)
switch (bit) {
case 6: /* Z570 */
case 0: /* Z580 */
- /* Thermal Management button */
- ideapad_input_report(priv, 65);
+ /* Thermal Management / Performance Mode button */
+ switch (priv->dytc->current_profile) {
+ case PLATFORM_PROFILE_LOW_POWER:
+ dytc_profile_set(&priv->dytc->pprof,
+ PLATFORM_PROFILE_BALANCED);
+ break;
+ case PLATFORM_PROFILE_BALANCED:
+ dytc_profile_set(&priv->dytc->pprof,
+ PLATFORM_PROFILE_PERFORMANCE);
+ break;
+ case PLATFORM_PROFILE_PERFORMANCE:
+ dytc_profile_set(&priv->dytc->pprof,
+ PLATFORM_PROFILE_LOW_POWER);
+ break;
+ default:
+ dev_warn(&priv->platform_device->dev,
+ "Unexpected platform profile %d",
+ priv->dytc->current_profile);
+ }
+ /* Notify user space the profile changed */
+ platform_profile_notify();
break;
case 1:
/* OneKey Theater button */
base-commit: 39cd87c4eb2b893354f3b850f916353f2658ae6f
--
2.44.0


\
 
 \ /
  Last update: 2024-05-27 16:22    [W:0.025 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site