2024-03-10 11:32:15

by Gergo Koteles

[permalink] [raw]
Subject: [PATCH v2 0/2] 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
--
2.44.0



2024-03-10 11:32:17

by Gergo Koteles

[permalink] [raw]
Subject: [PATCH v2 2/2] platform/x86: ideapad-laptop: map Fn + R key to KEY_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.

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"

Signed-off-by: Gergo Koteles <[email protected]>
---
drivers/platform/x86/ideapad-laptop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 4c130957f80d..901849810ce2 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -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 },
};
--
2.44.0


2024-03-10 11:32:34

by Gergo Koteles

[permalink] [raw]
Subject: [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.

Signed-off-by: Gergo Koteles <[email protected]>
---
include/uapi/linux/input-event-codes.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 022a520e31fc..03edf2ccdf6c 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -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 */
--
2.44.0


2024-03-10 21:34:28

by Dmitry Torokhov

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

On Sun, Mar 10, 2024 at 12:31:41PM +0100, Gergo Koteles wrote:
> 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.
>
> Signed-off-by: Gergo Koteles <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

> ---
> include/uapi/linux/input-event-codes.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
> index 022a520e31fc..03edf2ccdf6c 100644
> --- a/include/uapi/linux/input-event-codes.h
> +++ b/include/uapi/linux/input-event-codes.h
> @@ -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 */
> --
> 2.44.0
>

--
Dmitry

2024-03-11 13:28:52

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] map Fn + R key on newer Lenovo Yogas and Legions

On Sun, 10 Mar 2024, Gergo Koteles wrote:

> 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

Hi,

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

--
i.


2024-03-12 11:03:03

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] map Fn + R key on newer Lenovo Yogas and Legions

On Mon, 11 Mar 2024, Ilpo J?rvinen wrote:
> On Sun, 10 Mar 2024, Gergo Koteles wrote:
>
> > 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
>
> As mentioned in the other thread, please redo this on top of
> pdx86/for-next.

Nevermind, I replaced the original patches with these two.

--
i.