This is a note to let you know that I've just added the patch titled platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting to the 5.10-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-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From fdcc0602d64f22185f61c70747214b630049cc33 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Fri, 20 Jan 2023 15:34:41 +0100 Subject: platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting From: Hans de Goede <hdegoede@xxxxxxxxxx> commit fdcc0602d64f22185f61c70747214b630049cc33 upstream. Commit 1ea0d3b46798 ("platform/x86: asus-wmi: Simplify tablet-mode-switch handling") unified the asus-wmi tablet-switch handling, but it did not take into account that the value returned for the kbd_dock_devid WMI method is inverted where as the other ones are not inverted. This causes asus-wmi to report an inverted tablet-switch state for devices which use the kbd_dock_devid, which causes libinput to ignore touchpad events while the affected T10x model 2-in-1s are docked. Add inverting of the return value in the kbd_dock_devid case to fix this. Fixes: 1ea0d3b46798 ("platform/x86: asus-wmi: Simplify tablet-mode-switch handling") Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230120143441.527334-1-hdegoede@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/platform/x86/asus-wmi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -202,6 +202,7 @@ struct asus_wmi { int tablet_switch_event_code; u32 tablet_switch_dev_id; + bool tablet_switch_inverted; enum fan_type fan_type; int fan_pwm_mode; @@ -354,6 +355,13 @@ static bool asus_wmi_dev_is_present(stru } /* Input **********************************************************************/ +static void asus_wmi_tablet_sw_report(struct asus_wmi *asus, bool value) +{ + input_report_switch(asus->inputdev, SW_TABLET_MODE, + asus->tablet_switch_inverted ? !value : value); + input_sync(asus->inputdev); +} + static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event_code) { struct device *dev = &asus->platform_device->dev; @@ -362,7 +370,7 @@ static void asus_wmi_tablet_sw_init(stru result = asus_wmi_get_devstate_simple(asus, dev_id); if (result >= 0) { input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); - input_report_switch(asus->inputdev, SW_TABLET_MODE, result); + asus_wmi_tablet_sw_report(asus, result); asus->tablet_switch_dev_id = dev_id; asus->tablet_switch_event_code = event_code; } else if (result == -ENODEV) { @@ -395,6 +403,7 @@ static int asus_wmi_input_init(struct as case asus_wmi_no_tablet_switch: break; case asus_wmi_kbd_dock_devid: + asus->tablet_switch_inverted = true; asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE); break; case asus_wmi_lid_flip_devid: @@ -434,10 +443,8 @@ static void asus_wmi_tablet_mode_get_sta return; result = asus_wmi_get_devstate_simple(asus, asus->tablet_switch_dev_id); - if (result >= 0) { - input_report_switch(asus->inputdev, SW_TABLET_MODE, result); - input_sync(asus->inputdev); - } + if (result >= 0) + asus_wmi_tablet_sw_report(asus, result); } /* dGPU ********************************************************************/ Patches currently in stable-queue which might be from hdegoede@xxxxxxxxxx are queue-5.10/platform-x86-asus-wmi-adjust-tablet-lidflip-handling.patch queue-5.10/platform-x86-asus-nb-wmi-add-tablet_mode_sw-lid-flip.patch queue-5.10/asus-wmi-add-dgpu-disable-method.patch queue-5.10/platform-x86-asus-wmi-add-support-for-sw_tablet_mode.patch queue-5.10/platform-x86-asus-wmi-add-support-for-rog-x13-tablet.patch queue-5.10/platform-x86-asus-wmi-move-i8042-filter-install-to-s.patch queue-5.10/platform-x86-asus-nb-wmi-allow-configuring-sw_tablet.patch queue-5.10/platform-x86-asus-wmi-simplify-tablet-mode-switch-ha.patch queue-5.10/platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch queue-5.10/platform-x86-asus-wmi-simplify-tablet-mode-switch-pr.patch