Skip to contentSkip to conversation

platform/x86: ideapad-laptop: Add Yoga Pro 7 14IAH10 Mode key

PATCH In review Navon John Lukose 4 participants 4 messages Sep 14 – Sep 18

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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. The Fn+Q button already cycles platform_profile through ideapad_check_special_buttons(), so map 0x46 to KEY_PROG4 as a user-assignable key rather than cycling the profile a second way.

---
v2: reword the entry comment and explain why 0x46 is not routed through platform_profile_cycle() (Hans).

https://lore.kernel.org/platform-driver-x86/[email protected]/

Lenovo Yoga Pro 7 14IAH10 (83KF), BIOS QGCN35WW.

Measured with dyndbg on ideapad-laptop.c and a kprobe on platform_profile_cycle():

Mode key (plain F9), 2 presses:
WMI fn-key event: 0x46, twice
no platform_profile change

Fn+Q, 2 presses:
platform_profile_cycle() twice, called from ideapad_acpi_notify() no WMI fn-key event

 drivers/platform/x86/lenovo/ideapad-laptop.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/platform/x86/lenovo/ideapad-laptop.c +2 -0
index 8213524..35c13d9 100644
@@ -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, opens a profile chooser; the Fn+Q button cycles the profile */
+	{ 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 } },
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 1/1
#1 lore raw

Hi,

Quoted 8 lines · Navon John Lukose

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. The Fn+Q button already cycles platform_profile through ideapad_check_special_buttons(), so map 0x46 to KEY_PROG4 as a user-assignable key rather than cycling the profile a second way.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 35 lines

---
v2: reword the entry comment and explain why 0x46 is not routed through platform_profile_cycle() (Hans).

https://lore.kernel.org/platform-driver-x86/[email protected]/

Lenovo Yoga Pro 7 14IAH10 (83KF), BIOS QGCN35WW.

Measured with dyndbg on ideapad-laptop.c and a kprobe on platform_profile_cycle():

Mode key (plain F9), 2 presses:
WMI fn-key event: 0x46, twice
no platform_profile change

Fn+Q, 2 presses:
platform_profile_cycle() twice, called from ideapad_acpi_notify() no WMI fn-key event

 drivers/platform/x86/lenovo/ideapad-laptop.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/platform/x86/lenovo/ideapad-laptop.c +2 -0
index 8213524..35c13d9 100644
@@ -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, opens a profile chooser; the Fn+Q button cycles the profile */
+	{ 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 } },
maintainer
#2 lore raw
In reply to Navon John Lukose
Quoted 8 lines · Navon John Lukose

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. The Fn+Q button already cycles platform_profile through ideapad_check_special_buttons(), so map 0x46 to KEY_PROG4 as a user-assignable key rather than cycling the profile a second way.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: ideapad-laptop: Add Yoga Pro 7 14IAH10 Mode key

      commit: 8aed0be6b8b719d33a020d07294236e3250dd319

--
i.

maintainer
#3 lore raw
In reply to Navon John Lukose
Quoted 36 lines · Navon John Lukose

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. The Fn+Q button already cycles platform_profile through ideapad_check_special_buttons(), so map 0x46 to KEY_PROG4 as a user-assignable key rather than cycling the profile a second way.

---
v2: reword the entry comment and explain why 0x46 is not routed through platform_profile_cycle() (Hans).

https://lore.kernel.org/platform-driver-x86/[email protected]/

Lenovo Yoga Pro 7 14IAH10 (83KF), BIOS QGCN35WW.

Measured with dyndbg on ideapad-laptop.c and a kprobe on platform_profile_cycle():

Mode key (plain F9), 2 presses:
WMI fn-key event: 0x46, twice
no platform_profile change

Fn+Q, 2 presses:
platform_profile_cycle() twice, called from ideapad_acpi_notify() no WMI fn-key event

 drivers/platform/x86/lenovo/ideapad-laptop.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/platform/x86/lenovo/ideapad-laptop.c +0 -0
index 8213524..35c13d9 100644

drivers/platform/x86/lenovo/ideapad-laptop.c static const struct key_entry ideapad_keymap[] = { · line 1366

Quoted 7 lines
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, opens a profile chooser; the Fn+Q button cycles the profile 
 */
+	{ KE_KEY,	0x46 | IDEAPAD_WMI_KEY, { KEY_PROG4 } },

Just a note that on Thinkpad we handle the mode key also as a profile cycler so it's a shame these are different.
I personally would have added 0x46 to the code in ideapad_wmi_notify too so either mode key or FN+Q could be used. The mode key is a much more obvious way of cycling through profiles in my opinion.

In theory you could maybe use KEY_PERFORMANCE there so they're 'different'. ProfileD should handle that (don't think tuneD does yet).

Mark