Skip to contentSkip to conversation

map Fn + R key on newer Lenovo Yogas and Legions

PATCH In review Gergo Koteles 3 participants 6 messages Mar 10, 2024 – Mar 12, 2024

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

v2 cover map Fn + R key on newer Lenovo Yogas and Legions

Hi All,

This patch series adds a new KEY_REFRESH_RATE_TOGGLE input event code and maps the Fn + R key to it in the ideapad-laptop driver.

It affects two WMI keycodes. I couldn't try the 0x0a.

Regards,
Gergo

Changes in v2:
- use KEY_REFRESH_RATE_TOGGLE instead of KEY_FN_R

[1]: https://lore.kernel.org/all/[email protected]/

Gergo Koteles (2):
Input: allocate keycode for Display refresh rate toggle platform/x86: ideapad-laptop: map Fn + R key to
KEY_REFRESH_RATE_TOGGLE

 drivers/platform/x86/ideapad-laptop.c  | 4 ++--
 include/uapi/linux/input-event-codes.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
prerequisite-patch-id: 66a1ec71f181c6468a8226430af7ee917f40138a

Signature · 1 line
2.44.0
#1 lore raw

PATCH v2 1/2 Input: allocate keycode for Display refresh rate toggle

Newer Lenovo Yogas and Legions with 60Hz/90Hz displays send a wmi event when Fn + R is pressed. This is intended for use to switch between the two refresh rates.

Allocate a new KEY_REFRESH_RATE_TOGGLE keycode for it.

---
 include/uapi/linux/input-event-codes.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input-event-codes.h +1 -0
index 022a520e31fc..03edf2ccdf6c 100644
@@ -602,6 +602,7 @@
 
 #define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
 #define KEY_ROTATE_LOCK_TOGGLE	0x231	/* Display rotation lock */
+#define KEY_REFRESH_RATE_TOGGLE	0x232	/* Display refresh rate toggle */
 
 #define KEY_BUTTONCONFIG		0x240	/* AL Button Configuration */
 #define KEY_TASKMANAGER		0x241	/* AL Task/Project Manager */
Signature · 1 line
2.44.0
maintainer Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] Input: allocate keycode for Display refresh rate toggle

Quoted 7 lines · Gergo Koteles

Newer Lenovo Yogas and Legions with 60Hz/90Hz displays send a wmi event when Fn + R is pressed. This is intended for use to switch between the two refresh rates.

Allocate a new KEY_REFRESH_RATE_TOGGLE keycode for it.

Quoted 19 lines
---
 include/uapi/linux/input-event-codes.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/input-event-codes.h +1 -0
index 022a520e31fc..03edf2ccdf6c 100644
@@ -602,6 +602,7 @@
 
 #define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
 #define KEY_ROTATE_LOCK_TOGGLE	0x231	/* Display rotation lock */
+#define KEY_REFRESH_RATE_TOGGLE	0x232	/* Display refresh rate toggle */
 
 #define KEY_BUTTONCONFIG		0x240	/* AL Button Configuration */
 #define KEY_TASKMANAGER		0x241	/* AL Task/Project Manager */
Signature · 1 line
2.44.0
Signature · 1 line
Dmitry
#3 lore raw

PATCH v2 2/2 platform/x86: ideapad-laptop: map Fn + R key to KEY_REFRESH_RATE_TOGGLE

In reply to Gergo Koteles

Newer Lenovo Yogas and Legions with 60Hz/90Hz displays send a wmi event when Fn + R is pressed. This is intended for use to switch between the two refresh rates.

The Fn + R key was incorrectly assigned to KEY_DISPLAYTOGGLE because it is used to toggle the display on and off.

Map Fn + R key to the KEY_REFRESH_RATE_TOGGLE event code.

This commit depends on "platform/x86: ideapad-laptop: support Fn+R dual-function key"

---
 drivers/platform/x86/ideapad-laptop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/ideapad-laptop.c +2 -2
index 4c130957f80d..901849810ce2 100644
@@ -1092,7 +1092,7 @@ static const struct key_entry ideapad_keymap[] = {
 	{ KE_KEY,	0x0e | IDEAPAD_WMI_KEY, { KEY_PICKUP_PHONE } },
 	{ KE_KEY,	0x0f | IDEAPAD_WMI_KEY, { KEY_HANGUP_PHONE } },
 	/* Refresh Rate Toggle (Fn+R) */
-	{ KE_KEY,	0x10 | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },
+	{ KE_KEY,	0x10 | IDEAPAD_WMI_KEY, { KEY_REFRESH_RATE_TOGGLE } },
 	/* Dark mode toggle */
 	{ KE_KEY,	0x13 | IDEAPAD_WMI_KEY, { KEY_PROG1 } },
 	/* Sound profile switch */
@@ -1102,7 +1102,7 @@ static const struct key_entry ideapad_keymap[] = {
 	/* Lenovo Support */
 	{ KE_KEY,	0x27 | IDEAPAD_WMI_KEY, { KEY_HELP } },
 	/* Refresh Rate Toggle */
-	{ KE_KEY,	0x0a | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },
+	{ KE_KEY,	0x0a | IDEAPAD_WMI_KEY, { KEY_REFRESH_RATE_TOGGLE } },
 
 	{ KE_END },
 };
Signature · 1 line
2.44.0
maintainer
#4 lore raw
In reply to Gergo Koteles
Quoted 13 lines · Gergo Koteles

Hi All,

This patch series adds a new KEY_REFRESH_RATE_TOGGLE input event code and maps the Fn + R key to it in the ideapad-laptop driver.

It affects two WMI keycodes. I couldn't try the 0x0a.

Regards,
Gergo

Changes in v2:
- use KEY_REFRESH_RATE_TOGGLE instead of KEY_FN_R

Quoted 6 lines

[1]: https://lore.kernel.org/all/[email protected]/

Gergo Koteles (2):
Input: allocate keycode for Display refresh rate toggle platform/x86: ideapad-laptop: map Fn + R key to
KEY_REFRESH_RATE_TOGGLE

Hi,

As mentioned in the other thread, please redo this on top of pdx86/for-next.

Signature · 1 line
 i.
maintainer
#5 lore raw
Quoted 15 lines · Ilpo Järvinen
Quoted 13 lines · Gergo Koteles

This patch series adds a new KEY_REFRESH_RATE_TOGGLE input event code and maps the Fn + R key to it in the ideapad-laptop driver.

It affects two WMI keycodes. I couldn't try the 0x0a.

Regards,
Gergo

Changes in v2:
- use KEY_REFRESH_RATE_TOGGLE instead of KEY_FN_R

[1]: https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 4 lines

Gergo Koteles (2):
Input: allocate keycode for Display refresh rate toggle platform/x86: ideapad-laptop: map Fn + R key to
KEY_REFRESH_RATE_TOGGLE

As mentioned in the other thread, please redo this on top of pdx86/for-next.

Nevermind, I replaced the original patches with these two.

Signature · 1 line
 i.