Skip to contentSkip to conversation

HID: Lenovo Yoga Slim 7x Gen 11 keyboard fixes

PATCH Superseded Oleg Keri 1 participant 4 messages Sep 8 – Sep 10

Subsystems (2)
lore
Share & tools
lore

Oleg Keri

author
#0 lore raw

v2 cover HID: Lenovo Yoga Slim 7x Gen 11 keyboard fixes

Two fixes for the ITE keyboard controller (048d:83db) on the Lenovo Yoga Slim 7x Gen 11, a Qualcomm Snapdragon X2 Elite (glymur) laptop.

Patch 1 silences a one second timeout on every probe and every resume:
the controller performs its reset but never raises the interrupt that acknowledges it. Patch 2 suppresses a phantom KEY_RFKILL input device created from a Wireless Radio Controls collection that never reports anything.

Changes in v2:
- Posted as a single series. In v1 these went out as two independent patches, which was a mistake: patch 1 adds I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD to hid-ids.h and patch 2 uses it, so the hid-lenovo patch did not build on its own. Ordered here so each patch builds standalone; verified by compiling drivers/hid/hid-lenovo.o and drivers/hid/i2c-hid/i2c-hid-core.o at each step.
- No functional change.
- v1 patch 1: https://lore.kernel.org/all/[email protected]/
- v1 patch 2: https://lore.kernel.org/all/[email protected]/

Oleg Keri (2):
HID: i2c-hid: add reset quirk for Lenovo Yoga Slim 7x Gen 11 keyboard
HID: lenovo: suppress phantom radio control input on Yoga Slim 7x Gen 11

Signature · 3 lines
2.55.0

base-commit: 5e036ce12de91c6fd674dad33b169c6150be2a7a
author
#1 lore raw

PATCH v2 1/2 HID: i2c-hid: add reset quirk for Lenovo Yoga Slim 7x Gen 11 keyboard

The ITE controller behind the keyboard of the Lenovo Yoga Slim 7x Gen 11 (048d:83db) carries out a reset but never raises the interrupt that acknowledges it. i2c_hid_finish_hwreset() therefore waits out its full one second timeout and logs "device did not ack reset within 1000 ms" on every probe and every resume, before the keyboard comes up regardless.

Set I2C_HID_QUIRK_NO_IRQ_AFTER_RESET for it, as is already done for several other ITE parts, so the reset is followed by a fixed 100 ms sleep instead.

---
 drivers/hid/hid-ids.h              | 1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +1 -0
index b3aca5aa9176..2e9d0fc41ed0 100644
@@ -765,6 +765,7 @@
 #define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720	0x837a
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
 #define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_KEYBOARD	0x8987
+#define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD	0x83db
 #define USB_DEVICE_ID_ITE8595		0x8595
 #define USB_DEVICE_ID_ITE_MEDION_E1239T	0xce50
 
drivers/hid/i2c-hid/i2c-hid-core.c +2 -0
index 0ff07fdab442..ad8d9f329404 100644
@@ -126,6 +126,8 @@ static const struct i2c_hid_quirks {
 		I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
 	{ I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15,
 		I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
+	{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD,
+		I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
 	{ I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118,
 		I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
 	{ USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
Signature · 1 line
2.55.0
author
#2 lore raw

PATCH v2 2/2 HID: lenovo: suppress phantom radio control input on Yoga Slim 7x Gen 11

In reply to Oleg Keri

The ITE keyboard controller (048d:83db) declares a Wireless Radio Controls application collection, which hid-input registers as a second input device advertising KEY_RFKILL. That collection never reports anything: the airplane mode key is wired to the embedded controller and reaches the host as EC event 0x19, where the platform driver emits the key.

Map the collection to nothing so hidinput_has_been_populated() discards it and userspace is left with a single, real KEY_RFKILL source.

---
 drivers/hid/hid-lenovo.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hid/hid-lenovo.c +14 -0
index 3976d7b53b14..617bba662659 100644
@@ -476,6 +476,16 @@ static int lenovo_input_mapping_x1_tab_kbd(struct hid_device *hdev,
 	return 0;
 }
 
+static int lenovo_input_mapping_yoga7x_g11_kbd(struct hid_device *hdev,
+		struct hid_input *hi, struct hid_field *field,
+		struct hid_usage *usage, unsigned long **bit, int *max)
+{
+	if (field->application == HID_GD_WIRELESS_RADIO_CTLS)
+		return -1;
+
+	return 0;
+}
+
 static int lenovo_input_mapping(struct hid_device *hdev,
 		struct hid_input *hi, struct hid_field *field,
 		struct hid_usage *usage, unsigned long **bit, int *max)
@@ -510,6 +520,8 @@ static int lenovo_input_mapping(struct hid_device *hdev,
 	case USB_DEVICE_ID_LENOVO_X1_TAB2:
 	case USB_DEVICE_ID_LENOVO_X1_TAB3:
 		return lenovo_input_mapping_x1_tab_kbd(hdev, hi, field, usage, bit, max);
+	case I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD:
+		return lenovo_input_mapping_yoga7x_g11_kbd(hdev, hi, field, usage, bit, max);
 	default:
 		return 0;
 	}
@@ -1568,6 +1580,8 @@ static const struct hid_device_id lenovo_devices[] = {
 		     USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X13_TAB) },
 	{ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
 		     USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_KEYBOARD) },
+	{ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
+		     USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD) },
 	{ }
 };
 
Signature · 1 line
2.55.0