platform/x86: ideapad-laptop: Add Yoga Pro 7 14IAH10 Mode key
Subsystems (3)
PATCH 1/1 platform/x86: ideapad-laptop: Add Yoga Pro 7 14IAH10 Mode key
The F9 "Mode" key emits WMI fn-key event 0x46, which the keymap does not cover, so it reaches userspace as KEY_UNKNOWN and cannot be remapped from there. Under Windows it opens a performance profile chooser, so it belongs in the keymap as a user-assignable key. Map it to KEY_PROG4.
---
Lenovo Yoga Pro 7 14IAH10 (83KF), BIOS QGCN35WW. No other key on this machine emits 0x46, and pressing the Mode key leaves platform_profile unchanged.
KEY_PROG4 per Hans's note on the 0x3d key, that a key opening a settings dialog under Windows should get a free KEY_PROG#:
https://lore.kernel.org/platform-driver-x86/[email protected]/
drivers/platform/x86/lenovo/ideapad-laptop.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/lenovo/ideapad-laptop.c +2 -0
@@ -1360,6 +1360,8 @@ static const struct key_entry ideapad_keymap[] = { { KE_KEY, 0x45 | IDEAPAD_WMI_KEY, { KEY_PROG3 } },/* Performance toggle also Fn+Q, handled inside ideapad_wmi_notify() */ { KE_KEY, 0x3d | IDEAPAD_WMI_KEY, { KEY_PROG4 } }, +/* Mode (performance profile chooser) */ + { KE_KEY, 0x46 | IDEAPAD_WMI_KEY, { KEY_PROG4 } },/* shift + prtsc */ { KE_KEY, 0x2d | IDEAPAD_WMI_KEY, { KEY_SELECTIVE_SCREENSHOT } }, { KE_KEY, 0x29 | IDEAPAD_WMI_KEY, { KEY_TOUCHPAD_TOGGLE } },
base-commit: 22098763a10d9c13
Hans de Goede
maintainerHi Navon,
Quoted 6 lines · Navon John Lukose
The F9 "Mode" key emits WMI fn-key event
0x46, which the keymap does not cover, so it reaches userspace asKEY_UNKNOWNand cannot be remapped from there. Under Windows it opens a performance profile chooser, so it belongs in the keymap as a user-assignable key. Map it toKEY_PROG4.Signed-off-by Navon John Lukose <[email protected]>
Quoted 8 lines
---
Lenovo Yoga Pro 7 14IAH10 (83KF), BIOS QGCN35WW. No other key on this machine emits0x46, and pressing the Mode key leavesplatform_profileunchanged.
KEY_PROG4per Hans's note on the0x3dkey, that a key opening a settings dialog under Windows should get a free KEY_PROG#:
https://lore.kernel.org/platform-driver-x86/[email protected]/
As the comment on the KE_KEY entry above the one you add says, this should really be handled specially inside ideapad_wmi_notify(). IIRC we still want the KE_KEY entry to emit a key-press on laptops without DYTC platform-profile support.
For laptops with DYTC support you want to modify this bit in ideapad_wmi_notify():
/* performance button triggered by 0x3d */
if (data->integer.value == 0x3d && priv->dytc) {
platform_profile_cycle();
break;
}to also trigger on the new 0x46 code:
/* performance button triggered by 0x3d or 0x46 */
if ((data->integer.value == 0x3d || data->integer.value == 0x46) && priv->dytc) {
platform_profile_cycle();
break;
}So that this key actually toggles through the different (power-save/balanced/performanc) platform profiles the laptop has.
Unless there already is another key to do that ?
And please also add a comment to the new KE_KEY entry that this is handled inside ideapad_wmi_notify() like the existing KE_KEY entry for 0x3d has.
Hmm, I see you say that under Windows this opens a performance menu rather then outright toggle the profile. So I guess that you maybe also have Fn + Q or something which already directly switches profile ? If you do then KEY_PROG4 seems fine. If you do not I think just cycling the profile would be better, what do you think ?
Regards,
Hans
Quoted 19 lines
drivers/platform/x86/lenovo/ideapad-laptop.c | 2 ++ 1 file changed, 2 insertions(+)drivers/platform/x86/lenovo/ideapad-laptop.c +2
-0@@ -1360,6 +1360,8 @@ static const struct key_entry ideapad_keymap[] = { { KE_KEY, 0x45 | IDEAPAD_WMI_KEY, { KEY_PROG3 } },/* Performance toggle also Fn+Q, handled inside ideapad_wmi_notify() */ { KE_KEY, 0x3d | IDEAPAD_WMI_KEY, { KEY_PROG4 } }, +/* Mode (performance profile chooser) */ + { KE_KEY, 0x46 | IDEAPAD_WMI_KEY, { KEY_PROG4 } },/* shift + prtsc */ { KE_KEY, 0x2d | IDEAPAD_WMI_KEY, { KEY_SELECTIVE_SCREENSHOT } }, { KE_KEY, 0x29 | IDEAPAD_WMI_KEY, { KEY_TOUCHPAD_TOGGLE } },base-commit:
22098763a10d9c13
Quoted 2 lines · Hans de Goede
So I guess that you maybe also have Fn + Q or something which already directly switches profile ? If you do then
KEY_PROG4seems fine.
Fn+Q does, by a different path than the Mode key:
Mode key (F9) WMI fn-key 0x46, platform_profile unchanged
Fn+Q VPC special button, platform_profile_cycle() from
ideapad_acpi_notify(), no WMI event
(Used LLMs to hunt the Fn+Q path down.)
So cycling on 0x46 would duplicate Fn+Q. Keeping KEY_PROG4, and added a comment in v2 saying why.