This is a note to let you know that I've just added the patch titled platform/x86: lenovo-ymc: Only bind on machines with a convertible DMI chassis-type to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: platform-x86-lenovo-ymc-only-bind-on-machines-with-a-convertible-dmi-chassis-type.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 2b6aa6610dc9690f79d305ca938abfb799a4f766 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Sat, 12 Aug 2023 16:48:18 +0200 Subject: platform/x86: lenovo-ymc: Only bind on machines with a convertible DMI chassis-type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Hans de Goede <hdegoede@xxxxxxxxxx> commit 2b6aa6610dc9690f79d305ca938abfb799a4f766 upstream. The lenovo-ymc driver is causing the keyboard + touchpad to stop working on some regular laptop models such as the Lenovo ThinkBook 13s G2 ITL 20V9. The problem is that there are YMC WMI GUID methods in the ACPI tables of these laptops, despite them not being Yogas and lenovo-ymc loading causes libinput to see a SW_TABLET_MODE switch with state 1. This in turn causes libinput to ignore events from the builtin keyboard and touchpad, since it filters those out for a Yoga in tablet mode. Similar issues with false-positive SW_TABLET_MODE=1 reporting have been seen with the intel-hid driver. Copy the intel-hid driver approach to fix this and only bind to the WMI device on machines where the DMI chassis-type indicates the machine is a convertible. Add a 'force' module parameter to allow overriding the chassis-type check so that users can easily test if the YMC interface works on models which report an unexpected chassis-type. Fixes: e82882cdd241 ("platform/x86: Add driver for Yoga Tablet Mode switch") Link: https://bugzilla.redhat.com/show_bug.cgi?id=2229373 Cc: André Apitzsch <git@xxxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Tested-by: Andrew Kallmeyer <kallmeyeras@xxxxxxxxx> Tested-by: Gergő Köteles <soyer@xxxxxx> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230812144818.383230-1-hdegoede@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/platform/x86/lenovo-ymc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/platform/x86/lenovo-ymc.c b/drivers/platform/x86/lenovo-ymc.c index 41676188b373..f360370d5002 100644 --- a/drivers/platform/x86/lenovo-ymc.c +++ b/drivers/platform/x86/lenovo-ymc.c @@ -24,6 +24,10 @@ static bool ec_trigger __read_mostly; module_param(ec_trigger, bool, 0444); MODULE_PARM_DESC(ec_trigger, "Enable EC triggering work-around to force emitting tablet mode events"); +static bool force; +module_param(force, bool, 0444); +MODULE_PARM_DESC(force, "Force loading on boards without a convertible DMI chassis-type"); + static const struct dmi_system_id ec_trigger_quirk_dmi_table[] = { { /* Lenovo Yoga 7 14ARB7 */ @@ -35,6 +39,20 @@ static const struct dmi_system_id ec_trigger_quirk_dmi_table[] = { { } }; +static const struct dmi_system_id allowed_chasis_types_dmi_table[] = { + { + .matches = { + DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */), + }, + }, + { + .matches = { + DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */), + }, + }, + { } +}; + struct lenovo_ymc_private { struct input_dev *input_dev; struct acpi_device *ec_acpi_dev; @@ -111,6 +129,13 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx) struct input_dev *input_dev; int err; + if (!dmi_check_system(allowed_chasis_types_dmi_table)) { + if (force) + dev_info(&wdev->dev, "Force loading Lenovo YMC support\n"); + else + return -ENODEV; + } + ec_trigger |= dmi_check_system(ec_trigger_quirk_dmi_table); priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); -- 2.41.0 Patches currently in stable-queue which might be from hdegoede@xxxxxxxxxx are queue-6.4/acpi-scan-create-platform-device-for-cs35l56.patch queue-6.4/platform-x86-lenovo-ymc-only-bind-on-machines-with-a-convertible-dmi-chassis-type.patch queue-6.4/platform-mellanox-mlx-platform-modify-graceful-shutdown-callback-and-power-down-mask.patch queue-6.4/platform-mellanox-change-register-offset-addresses.patch queue-6.4/platform-mellanox-fix-order-in-exit-flow.patch queue-6.4/acpi-resource-revert-remove-zen-specific-match-and-quirks.patch queue-6.4/platform-x86-msi-ec-fix-the-build.patch queue-6.4/acpi-resource-honor-madt-int_src_ovr-settings-for-irq1-on-amd-zen.patch queue-6.4/acpi-resource-add-irq-override-quirk-for-pcspecialist-elimina-pro-16-m.patch queue-6.4/acpi-resource-always-use-madt-override-irq-settings-for-all-legacy-non-i8042-irqs.patch queue-6.4/platform-mellanox-mlx-platform-fix-signals-polarity-and-latch-mask.patch queue-6.4/platform-x86-serial-multi-instantiate-auto-detect-irq-resource-for-csc3551.patch