Skip to contentSkip to conversation

platform: arm64: thinkpad-t14s-ec: don't send KEY_KBDILLUMTOGGLE on Fn+Space

PATCH In review David Stephenson 4 participants 4 messages Aug 25 – Sep 18

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

PATCH 1/1 platform: arm64: thinkpad-t14s-ec: don't send KEY_KBDILLUMTOGGLE on Fn+Space

On the T14s, the EC already steps the keyboard backlight when you press Fn+Space: off, then low, then high.

We report that change with t14s_kbd_bl_update() (brightness_hw_changed). We then also send KEY_KBDILLUMTOGGLE.

The extra key is the problem. Desktops treat it as "please toggle the light." GNOME calls Keyboard.Toggle() and changes the LED itself. That fights the EC's three steps. The on-screen bar also stays empty, because Toggle() always returns 0%.

thinkpad_acpi on x86 already skips the key when the firmware changed the light. It only uses brightness_hw_changed. Do the same here: keep the LED update, do not send KEY_KBDILLUMTOGGLE.

Tested on a Lenovo ThinkPad T14s Gen 6 (21N1, Snapdragon X Elite) with GNOME. After this change the OSD bar tracks off / 50% / 100%.

---
 drivers/platform/arm64/lenovo-thinkpad-t14s.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/arm64/lenovo-thinkpad-t14s.c +7 -1
index 5590302a5..22d20a907 100644
@@ -488,8 +488,14 @@ static irqreturn_t t14s_ec_irq_handler(int irq, void *data)
 	case T14S_EC_EVT_NONE:
 		break;
 	case T14S_EC_EVT_KEY_FN_SPACE:
+		/*
+		 * Firmware already cycles the keyboard backlight
+		 * (off / low / high). Notify userspace through the LED
+		 * class only. Emitting KEY_KBDILLUMTOGGLE as well makes
+		 * desktop environments toggle the LED a second time.
+		 */
 		t14s_kbd_bl_update(ec);
-		fallthrough;
+		break;
 	case T14S_EC_EVT_KEY_FN_F4:
 	case T14S_EC_EVT_KEY_FN_F7:
 	case T14S_EC_EVT_KEY_FN_4:
Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 11 lines · David Stephenson

On the T14s, the EC already steps the keyboard backlight when you press Fn+Space: off, then low, then high.

We report that change with t14s_kbd_bl_update() (brightness_hw_changed). We then also send KEY_KBDILLUMTOGGLE.

The extra key is the problem. Desktops treat it as "please toggle the light." GNOME calls Keyboard.Toggle() and changes the LED itself. That fights the EC's three steps. The on-screen bar also stays empty, because Toggle() always returns 0%.

Quoted 8 lines

thinkpad_acpi on x86 already skips the key when the firmware changed the light. It only uses brightness_hw_changed. Do the same here: keep the LED update, do not send KEY_KBDILLUMTOGGLE.

Tested on a Lenovo ThinkPad T14s Gen 6 (21N1, Snapdragon X Elite) with GNOME. After this change the OSD bar tracks off / 50% / 100%.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 24 lines
---
 drivers/platform/arm64/lenovo-thinkpad-t14s.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/arm64/lenovo-thinkpad-t14s.c +7 -1
index 5590302a5..22d20a907 100644
@@ -488,8 +488,14 @@ static irqreturn_t t14s_ec_irq_handler(int irq, void *data)
 	case T14S_EC_EVT_NONE:
 		break;
 	case T14S_EC_EVT_KEY_FN_SPACE:
+		/*
+		 * Firmware already cycles the keyboard backlight
+		 * (off / low / high). Notify userspace through the LED
+		 * class only. Emitting KEY_KBDILLUMTOGGLE as well makes
+		 * desktop environments toggle the LED a second time.
+		 */
 		t14s_kbd_bl_update(ec);
-		fallthrough;
+		break;
 	case T14S_EC_EVT_KEY_FN_F4:
 	case T14S_EC_EVT_KEY_FN_F7:
 	case T14S_EC_EVT_KEY_FN_4:
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to David Stephenson

Hi,

Quoted 15 lines · David Stephenson

On the T14s, the EC already steps the keyboard backlight when you press Fn+Space: off, then low, then high.

We report that change with t14s_kbd_bl_update() (brightness_hw_changed). We then also send KEY_KBDILLUMTOGGLE.

The extra key is the problem. Desktops treat it as "please toggle the light." GNOME calls Keyboard.Toggle() and changes the LED itself. That fights the EC's three steps. The on-screen bar also stays empty, because Toggle() always returns 0%.

thinkpad_acpi on x86 already skips the key when the firmware changed the light. It only uses brightness_hw_changed. Do the same here: keep the LED update, do not send KEY_KBDILLUMTOGGLE.

Quoted 5 lines

Tested on a Lenovo ThinkPad T14s Gen 6 (21N1, Snapdragon X Elite) with GNOME. After this change the OSD bar tracks off / 50% / 100%.

---

Greetings,

-- Sebastian

Quoted 27 lines
 drivers/platform/arm64/lenovo-thinkpad-t14s.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/arm64/lenovo-thinkpad-t14s.c +7 -1
index 5590302a5..22d20a907 100644
@@ -488,8 +488,14 @@ static irqreturn_t t14s_ec_irq_handler(int irq, void *data)
 	case T14S_EC_EVT_NONE:
 		break;
 	case T14S_EC_EVT_KEY_FN_SPACE:
+		/*
+		 * Firmware already cycles the keyboard backlight
+		 * (off / low / high). Notify userspace through the LED
+		 * class only. Emitting KEY_KBDILLUMTOGGLE as well makes
+		 * desktop environments toggle the LED a second time.
+		 */
 		t14s_kbd_bl_update(ec);
-		fallthrough;
+		break;
 	case T14S_EC_EVT_KEY_FN_F4:
 	case T14S_EC_EVT_KEY_FN_F7:
 	case T14S_EC_EVT_KEY_FN_4:
Signature · 1 line
2.55.0
maintainer
#3 lore raw
In reply to David Stephenson
Quoted 6 lines · David Stephenson

On the T14s, the EC already steps the keyboard backlight when you press Fn+Space: off, then low, then high.

We report that change with t14s_kbd_bl_update() (brightness_hw_changed). We then also send KEY_KBDILLUMTOGGLE.

Quoted 6 lines

The extra key is the problem. Desktops treat it as "please toggle the light." GNOME calls Keyboard.Toggle() and changes the LED itself. That fights the EC's three steps. The on-screen bar also stays empty, because Toggle() always returns 0%.

[...]

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: arm64: thinkpad-t14s-ec: don't send KEY_KBDILLUMTOGGLE on Fn+Space

      commit: 2782e0c22e155cc0852114dcf9bb98c209b06853

--
i.