mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: lenovo/ymc: Only match lower byte in WMI lid switch response
@ 2026-05-31 20:49 Julian Haarmann
  2026-06-08 12:55 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Julian Haarmann @ 2026-05-31 20:49 UTC (permalink / raw)
  To: Mark Pearson, Derek J . Clark, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Julian Haarmann

On newer Lenovo Yoga devices like the "Yoga 9 2-in-1 14IPH11 - Type 83SE",
the hinge switch WMI query returns extra data in the upper bits
(e.g. 0x50001 laptop mode, 0x50002 tablet mode, ect.).

The driver previously checked for exact matches (0x01 laptop, 0x02 tablet,
ect.) causing newer switches to not work.

Mask the WMI query result to only match the lower byte and ignore upper
bits.

Signed-off-by: Julian Haarmann <julian.haarmann@student.kit.edu>
---

Hi everyone,

I just recieved this laptop and am trying to get it to work.
FYI: To get tablet mode to work fully you might need to extract the
Intel ISH firmware from the Windows driver.
This is my first patch, so I hope the way I've solved this is up to
standard.

 drivers/platform/x86/lenovo/ymc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/x86/lenovo/ymc.c b/drivers/platform/x86/lenovo/ymc.c
index 1b73a55f1b89..ffeca452b392 100644
--- a/drivers/platform/x86/lenovo/ymc.c
+++ b/drivers/platform/x86/lenovo/ymc.c
@@ -87,6 +87,9 @@ static void lenovo_ymc_notify(struct wmi_device *wdev, union acpi_object *data)
 	}
 	code = obj->integer.value;
 
+	/* strip upper bits (e.g. 0x50000) on newer devices */
+	code &= 0xFF;
+
 	if (!sparse_keymap_report_event(priv->input_dev, code, 1, true))
 		dev_warn(&wdev->dev, "Unknown key %d pressed\n", code);
 
-- 
2.54.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-08 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-31 20:49 [PATCH] platform/x86: lenovo/ymc: Only match lower byte in WMI lid switch response Julian Haarmann
2026-06-08 12:55 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®