All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Stefan Brüns" <stefan.bruens@rwth-aachen.de>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <mgross@linux.intel.com>,
	"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 5.10 023/104] platform/x86: hp-wmi: Disable tablet-mode reporting by default
Date: Mon, 15 Feb 2021 16:26:36 +0100	[thread overview]
Message-ID: <20210215152720.230412063@linuxfoundation.org> (raw)
In-Reply-To: <20210215152719.459796636@linuxfoundation.org>

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit 67fbe02a5cebc3c653610f12e3c0424e58450153 ]

Recently userspace has started making more use of SW_TABLET_MODE
(when an input-dev reports this).

Specifically recent GNOME3 versions will:

1.  When SW_TABLET_MODE is reported and is reporting 0:
1.1 Disable accelerometer-based screen auto-rotation
1.2 Disable automatically showing the on-screen keyboard when a
    text-input field is focussed

2.  When SW_TABLET_MODE is reported and is reporting 1:
2.1 Ignore input-events from the builtin keyboard and touchpad
    (this is for 360° hinges style 2-in-1s where the keyboard and
     touchpads are accessible on the back of the tablet when folded
     into tablet-mode)

This means that claiming to support SW_TABLET_MODE when it does not
actually work / reports correct values has bad side-effects.

The check in the hp-wmi code which is used to decide if the input-dev
should claim SW_TABLET_MODE support, only checks if the
HPWMI_HARDWARE_QUERY is supported. It does *not* check if the hardware
actually is capable of reporting SW_TABLET_MODE.

This leads to the hp-wmi input-dev claiming SW_TABLET_MODE support,
while in reality it will always report 0 as SW_TABLET_MODE value.
This has been seen on a "HP ENVY x360 Convertible 15-cp0xxx" and
this likely is the case on a whole lot of other HP models.

This problem causes both auto-rotation and on-screen keyboard
support to not work on affected x360 models.

There is no easy fix for this, but since userspace expects
SW_TABLET_MODE reporting to be reliable when advertised it is
better to not claim/report SW_TABLET_MODE support at all, then
to claim to support it while it does not work.

To avoid the mentioned problems, add a new enable_tablet_mode_sw
module-parameter which defaults to false.

Note I've made this an int using the standard -1=auto, 0=off, 1=on
triplett, with the hope that in the future we can come up with a
better way to detect SW_TABLET_MODE support. ATM the default
auto option just does the same as off.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1918255
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Link: https://lore.kernel.org/r/20210120124941.73409-1-hdegoede@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/platform/x86/hp-wmi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 18bf8aeb5f870..e94e59283ecb9 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -32,6 +32,10 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
 MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
 
+static int enable_tablet_mode_sw = -1;
+module_param(enable_tablet_mode_sw, int, 0444);
+MODULE_PARM_DESC(enable_tablet_mode_sw, "Enable SW_TABLET_MODE reporting (-1=auto, 0=no, 1=yes)");
+
 #define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
 #define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
 
@@ -654,10 +658,12 @@ static int __init hp_wmi_input_setup(void)
 	}
 
 	/* Tablet mode */
-	val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
-	if (!(val < 0)) {
-		__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
-		input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
+	if (enable_tablet_mode_sw > 0) {
+		val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
+		if (val >= 0) {
+			__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
+			input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
+		}
 	}
 
 	err = sparse_keymap_setup(hp_wmi_input_dev, hp_wmi_keymap, NULL);
-- 
2.27.0




  parent reply	other threads:[~2021-02-15 16:21 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 15:26 [PATCH 5.10 000/104] 5.10.17-rc1 review Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 001/104] objtool: Fix seg fault with Clang non-section symbols Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 002/104] Revert "dts: phy: add GPIO number and active state used for phy reset" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 003/104] gpio: mxs: GPIO_MXS should not default to y unconditionally Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 004/104] gpio: ep93xx: fix BUG_ON port F usage Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 005/104] gpio: ep93xx: Fix single irqchip with multi gpiochips Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 006/104] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 007/104] tracing: Check length before giving out the filter buffer Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 008/104] drm/i915: Fix overlay frontbuffer tracking Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 009/104] arm/xen: Dont probe xenbus as part of an early initcall Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 010/104] cgroup: fix psi monitor for root cgroup Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 011/104] Revert "drm/amd/display: Update NV1x SR latency values" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 012/104] drm/i915/tgl+: Make sure TypeC FIA is powered up when initializing it Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 013/104] drm/dp_mst: Dont report ports connected if nothing is attached to them Greg Kroah-Hartman
2021-02-15 15:26   ` [Intel-gfx] " Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 014/104] dmaengine: move channel device_node deletion to driver Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 015/104] tmpfs: disallow CONFIG_TMPFS_INODE64 on s390 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 016/104] tmpfs: disallow CONFIG_TMPFS_INODE64 on alpha Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 017/104] soc: ti: omap-prm: Fix boot time errors for rst_map_012 bits 0 and 1 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 018/104] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 019/104] arm64: dts: qcom: sdm845: Reserve LPASS clocks in gcc Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 020/104] ARM: OMAP2+: Fix suspcious RCU usage splats for omap_enter_idle_coupled Greg Kroah-Hartman
2021-02-19 21:14   ` Pavel Machek
2021-02-19 21:26     ` Paul E. McKenney
2021-02-15 15:26 ` [PATCH 5.10 021/104] arm64: dts: rockchip: remove interrupt-names property from rk3399 vdec node Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 022/104] kbuild: simplify GCC_PLUGINS enablement in dummy-tools/gcc Greg Kroah-Hartman
2021-02-17  9:08   ` Pavel Machek
2021-02-17  9:28     ` Greg Kroah-Hartman
2021-02-15 15:26 ` Greg Kroah-Hartman [this message]
2021-02-15 15:26 ` [PATCH 5.10 024/104] arm64: dts: rockchip: Disable display for NanoPi R2S Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 025/104] ovl: perform vfs_getxattr() with mounter creds Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 026/104] cap: fix conversions on getxattr Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 027/104] ovl: skip getxattr of security labels Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 028/104] scsi: lpfc: Fix EEH encountering oops with NVMe traffic Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 029/104] x86/split_lock: Enable the split lock feature on another Alder Lake CPU Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 030/104] nvme-pci: ignore the subsysem NQN on Phison E16 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 031/104] drm/amd/display: Fix DPCD translation for LTTPR AUX_RD_INTERVAL Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 032/104] drm/amd/display: Add more Clock Sources to DCN2.1 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 033/104] drm/amd/display: Release DSC before acquiring Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 034/104] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 035/104] drm/amd/display: Free atomic state after drm_atomic_commit Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 036/104] drm/amd/display: Decrement refcount of dc_sink before reassignment Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 037/104] riscv: virt_addr_valid must check the address belongs to linear mapping Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 038/104] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 039/104] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 040/104] kallsyms: fix nonconverging kallsyms table with lld Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 041/104] ARM: ensure the signal page contains defined contents Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 042/104] ARM: kexec: fix oops after TLB are invalidated Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 043/104] kasan: add explicit preconditions to kasan_report() Greg Kroah-Hartman
2021-02-16 11:50   ` Pavel Machek
2021-02-17  9:26     ` Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 044/104] ubsan: implement __ubsan_handle_alignment_assumption Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 045/104] Revert "lib: Restrict cpumask_local_spread to houskeeping CPUs" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 046/104] x86/efi: Remove EFI PGD build time checks Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 047/104] lkdtm: dont move ctors to .rodata Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 048/104] KVM: x86: cleanup CR3 reserved bits checks Greg Kroah-Hartman
2021-02-15 18:46   ` Pavel Machek
2021-02-15 19:04     ` Paolo Bonzini
2021-02-15 15:27 ` [PATCH 5.10 049/104] cgroup-v1: add disabled controller check in cgroup1_parse_param() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 050/104] dmaengine: idxd: fix misc interrupt completion Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 051/104] ath9k: fix build error with LEDS_CLASS=m Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 052/104] mt76: dma: fix a possible memory leak in mt76_add_fragment() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 053/104] drm/vc4: hvs: Fix buffer overflow with the dlist handling Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 054/104] dmaengine: idxd: check device state before issue command Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 055/104] bpf: Unbreak BPF_PROG_TYPE_KPROBE when kprobe is called via do_int3 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 056/104] bpf: Check for integer overflow when using roundup_pow_of_two() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 057/104] netfilter: xt_recent: Fix attempt to update deleted entry Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 058/104] selftests: netfilter: fix current year Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 059/104] netfilter: nftables: fix possible UAF over chains from packet path in netns Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 060/104] netfilter: flowtable: fix tcp and udp header checksum update Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 061/104] xen/netback: avoid race in xenvif_rx_ring_slots_available() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 062/104] net: hdlc_x25: Return meaningful error code in x25_open Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 063/104] net: ipa: set error code in gsi_channel_setup() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 064/104] hv_netvsc: Reset the RSC count if NVSP_STAT_FAIL in netvsc_receive() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 065/104] net: enetc: initialize the RFS and RSS memories Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 066/104] selftests: txtimestamp: fix compilation issue Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 067/104] net: stmmac: set TxQ mode back to DCB after disabling CBS Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 068/104] ibmvnic: Clear failover_pending if unable to schedule Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 069/104] netfilter: conntrack: skip identical origin tuple in same zone only Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 070/104] scsi: scsi_debug: Fix a memory leak Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 071/104] x86/build: Disable CET instrumentation in the kernel for 32-bit too Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 072/104] net: dsa: felix: implement port flushing on .phylink_mac_link_down Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 073/104] net: hns3: add a check for queue_id in hclge_reset_vf_queue() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 074/104] net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 075/104] net: hns3: add a check for index in hclge_get_rss_key() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 076/104] firmware_loader: align .builtin_fw to 8 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 077/104] drm/sun4i: tcon: set sync polarity for tcon1 channel Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 078/104] drm/sun4i: dw-hdmi: always set clock rate Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 079/104] drm/sun4i: Fix H6 HDMI PHY configuration Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 080/104] drm/sun4i: dw-hdmi: Fix max. frequency for H6 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 081/104] clk: sunxi-ng: mp: fix parent rate change flag check Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 082/104] i2c: stm32f7: fix configuration of the digital filter Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 083/104] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 084/104] scripts: set proper OpenSSL include dir also for sign-file Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 085/104] x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 086/104] arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 087/104] rxrpc: Fix clearance of Tx/Rx ring when releasing a call Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 088/104] udp: fix skb_copy_and_csum_datagram with odd segment sizes Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 089/104] net: dsa: call teardown method on probe failure Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 090/104] cpufreq: ACPI: Extend frequency tables to cover boost frequencies Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 091/104] cpufreq: ACPI: Update arch scale-invariance max perf ratio if CPPC is not there Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 092/104] net: gro: do not keep too many GRO packets in napi->rx_list Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 093/104] net: fix iteration for sctp transport seq_files Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 094/104] net/vmw_vsock: fix NULL pointer dereference Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 095/104] net/vmw_vsock: improve locking in vsock_connect_timeout() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 096/104] net: watchdog: hold device global xmit lock during tx disable Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 097/104] bridge: mrp: Fix the usage of br_mrp_port_switchdev_set_state Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 098/104] switchdev: mrp: Remove SWITCHDEV_ATTR_ID_MRP_PORT_STAT Greg Kroah-Hartman
2021-02-16 21:35   ` Pavel Machek
2021-02-16 22:08     ` Horatiu Vultur
2021-02-17 19:27       ` Pavel Machek
2021-02-15 15:27 ` [PATCH 5.10 099/104] vsock/virtio: update credit only if socket is not closed Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 100/104] vsock: fix locking in vsock_shutdown() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 101/104] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 102/104] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 103/104] ovl: expand warning in ovl_d_real() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 104/104] kcov, usb: only collect coverage from __usb_hcd_giveback_urb in softirq Greg Kroah-Hartman
2021-02-15 20:29 ` [PATCH 5.10 000/104] 5.10.17-rc1 review Pavel Machek
2021-02-16  4:08 ` Naresh Kamboju
2021-02-16 18:50 ` Guenter Roeck
2021-02-16 22:28 ` Shuah Khan
2021-02-17  1:19 ` Ross Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210215152720.230412063@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan.bruens@rwth-aachen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.