From 05234fbb0854bbecbed1362b70d1e01aa0bb4d9c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 11 Dec 2023 14:57:51 +0100 Subject: [PATCH] 5.10-stable patches added patches: platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch --- ...d_dock_devid-tablet-switch-reporting.patch | 82 +++++++++++++++++++ queue-5.10/series | 2 + ...perf_event.h-with-the-kernel-sources.patch | 54 ++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 queue-5.10/platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch create mode 100644 queue-5.10/tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch diff --git a/queue-5.10/platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch b/queue-5.10/platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch new file mode 100644 index 00000000000..9aba891b0df --- /dev/null +++ b/queue-5.10/platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch @@ -0,0 +1,82 @@ +From fdcc0602d64f22185f61c70747214b630049cc33 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +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 + +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 +Link: https://lore.kernel.org/r/20230120143441.527334-1-hdegoede@redhat.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 ********************************************************************/ diff --git a/queue-5.10/series b/queue-5.10/series index bc198241c11..47b4ee79e85 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -85,3 +85,5 @@ genetlink-add-cap_net_admin-test-for-multicast-bind.patch psample-require-cap_net_admin-when-joining-packets-group.patch drop_monitor-require-cap_sys_admin-when-joining-events-group.patch netfilter-nft_set_pipapo-skip-inactive-elements-during-set-walk.patch +platform-x86-asus-wmi-fix-kbd_dock_devid-tablet-switch-reporting.patch +tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch diff --git a/queue-5.10/tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch b/queue-5.10/tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch new file mode 100644 index 00000000000..1e11d3b11c8 --- /dev/null +++ b/queue-5.10/tools-headers-uapi-sync-linux-perf_event.h-with-the-kernel-sources.patch @@ -0,0 +1,54 @@ +From 65ba872a6971c11ceb342c3330f059289c0e6bdb Mon Sep 17 00:00:00 2001 +From: Namhyung Kim +Date: Thu, 18 Aug 2022 17:36:41 -0700 +Subject: tools headers UAPI: Sync linux/perf_event.h with the kernel sources + +From: Namhyung Kim + +commit 65ba872a6971c11ceb342c3330f059289c0e6bdb upstream. + +To pick the trivial change in: + + 119a784c81270eb8 ("perf/core: Add a new read format to get a number of lost samples") + +Signed-off-by: Namhyung Kim +Acked-by: Jiri Olsa +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20220819003644.508916-2-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/include/uapi/linux/perf_event.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/tools/include/uapi/linux/perf_event.h ++++ b/tools/include/uapi/linux/perf_event.h +@@ -279,6 +279,7 @@ enum { + * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED + * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING + * { u64 id; } && PERF_FORMAT_ID ++ * { u64 lost; } && PERF_FORMAT_LOST + * } && !PERF_FORMAT_GROUP + * + * { u64 nr; +@@ -286,6 +287,7 @@ enum { + * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING + * { u64 value; + * { u64 id; } && PERF_FORMAT_ID ++ * { u64 lost; } && PERF_FORMAT_LOST + * } cntr[nr]; + * } && PERF_FORMAT_GROUP + * }; +@@ -295,8 +297,9 @@ enum perf_event_read_format { + PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, + PERF_FORMAT_ID = 1U << 2, + PERF_FORMAT_GROUP = 1U << 3, ++ PERF_FORMAT_LOST = 1U << 4, + +- PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ ++ PERF_FORMAT_MAX = 1U << 5, /* non-ABI */ + }; + + #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ -- 2.47.3