mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
platform/x86: Support for mode FN key
New Thinkpads have added a 'Mode' Function key that on Windows allows you to choose the active profile (low-power, balanced, performance) Added suppoort for this hotkey (F8), and have it cycle through the options available. Tested on X1 Carbon G12. Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240120232949.317337-1-mpearson-lenovo@squebb.ca Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
2cee4d0c82
commit
0959afbafa
@ -444,7 +444,9 @@ event code Key Notes
|
|||||||
|
|
||||||
0x1008 0x07 FN+F8 IBM: toggle screen expand
|
0x1008 0x07 FN+F8 IBM: toggle screen expand
|
||||||
Lenovo: configure UltraNav,
|
Lenovo: configure UltraNav,
|
||||||
or toggle screen expand
|
or toggle screen expand.
|
||||||
|
On newer platforms (2024+)
|
||||||
|
replaced by 0x131f (see below)
|
||||||
|
|
||||||
0x1009 0x08 FN+F9 -
|
0x1009 0x08 FN+F9 -
|
||||||
|
|
||||||
@ -504,6 +506,9 @@ event code Key Notes
|
|||||||
|
|
||||||
0x1019 0x18 unknown
|
0x1019 0x18 unknown
|
||||||
|
|
||||||
|
0x131f ... FN+F8 Platform Mode change.
|
||||||
|
Implemented in driver.
|
||||||
|
|
||||||
... ... ...
|
... ... ...
|
||||||
|
|
||||||
0x1020 0x1F unknown
|
0x1020 0x1F unknown
|
||||||
|
@ -166,6 +166,7 @@ enum tpacpi_hkey_event_t {
|
|||||||
TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */
|
TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */
|
||||||
TP_HKEY_EV_PRIVACYGUARD_TOGGLE = 0x130f, /* Toggle priv.guard on/off */
|
TP_HKEY_EV_PRIVACYGUARD_TOGGLE = 0x130f, /* Toggle priv.guard on/off */
|
||||||
TP_HKEY_EV_AMT_TOGGLE = 0x131a, /* Toggle AMT on/off */
|
TP_HKEY_EV_AMT_TOGGLE = 0x131a, /* Toggle AMT on/off */
|
||||||
|
TP_HKEY_EV_PROFILE_TOGGLE = 0x131f, /* Toggle platform profile */
|
||||||
|
|
||||||
/* Reasons for waking up from S3/S4 */
|
/* Reasons for waking up from S3/S4 */
|
||||||
TP_HKEY_EV_WKUP_S3_UNDOCK = 0x2304, /* undock requested, S3 */
|
TP_HKEY_EV_WKUP_S3_UNDOCK = 0x2304, /* undock requested, S3 */
|
||||||
@ -3731,6 +3732,7 @@ static bool hotkey_notify_extended_hotkey(const u32 hkey)
|
|||||||
switch (hkey) {
|
switch (hkey) {
|
||||||
case TP_HKEY_EV_PRIVACYGUARD_TOGGLE:
|
case TP_HKEY_EV_PRIVACYGUARD_TOGGLE:
|
||||||
case TP_HKEY_EV_AMT_TOGGLE:
|
case TP_HKEY_EV_AMT_TOGGLE:
|
||||||
|
case TP_HKEY_EV_PROFILE_TOGGLE:
|
||||||
tpacpi_driver_event(hkey);
|
tpacpi_driver_event(hkey);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -11115,7 +11117,23 @@ static void tpacpi_driver_event(const unsigned int hkey_event)
|
|||||||
else
|
else
|
||||||
dytc_control_amt(!dytc_amt_active);
|
dytc_control_amt(!dytc_amt_active);
|
||||||
}
|
}
|
||||||
|
if (hkey_event == TP_HKEY_EV_PROFILE_TOGGLE) {
|
||||||
|
switch (dytc_current_profile) {
|
||||||
|
case PLATFORM_PROFILE_LOW_POWER:
|
||||||
|
dytc_profile_set(NULL, PLATFORM_PROFILE_BALANCED);
|
||||||
|
break;
|
||||||
|
case PLATFORM_PROFILE_BALANCED:
|
||||||
|
dytc_profile_set(NULL, PLATFORM_PROFILE_PERFORMANCE);
|
||||||
|
break;
|
||||||
|
case PLATFORM_PROFILE_PERFORMANCE:
|
||||||
|
dytc_profile_set(NULL, PLATFORM_PROFILE_LOW_POWER);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pr_warn("Profile HKEY unexpected profile %d", dytc_current_profile);
|
||||||
|
}
|
||||||
|
/* Notify user space the profile changed */
|
||||||
|
platform_profile_notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hotkey_driver_event(const unsigned int scancode)
|
static void hotkey_driver_event(const unsigned int scancode)
|
||||||
|
Loading…
Reference in New Issue
Block a user