public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Stefan Brüns" <stefan.bruens@rwth-aachen.de>,
	"Mark Gross" <mgross@linux.intel.com>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 5.10 09/36] platform/x86: hp-wmi: Disable tablet-mode reporting by default
Date: Wed, 10 Feb 2021 15:22:31 -0800	[thread overview]
Message-ID: <20210210232231.GA75203@linux.intel.com> (raw)
In-Reply-To: <20210208175806.2091668-9-sashal@kernel.org>

looks good to me.

--mark

On Mon, Feb 08, 2021 at 12:57:39PM -0500, Sasha Levin wrote:
> 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
> 

  reply	other threads:[~2021-02-10 23:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 17:57 [PATCH AUTOSEL 5.10 01/36] soc: ti: omap-prm: Fix boot time errors for rst_map_012 bits 0 and 1 Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 02/36] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 03/36] Input: goodix - add support for Goodix GT9286 chip Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 04/36] arm64: dts: qcom: sdm845: Reserve LPASS clocks in gcc Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 05/36] ARM: OMAP2+: Fix suspcious RCU usage splats for omap_enter_idle_coupled Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 06/36] arm64: dts: rockchip: remove interrupt-names property from rk3399 vdec node Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 07/36] kbuild: simplify GCC_PLUGINS enablement in dummy-tools/gcc Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 08/36] Input: xpad - sync supported devices with fork on GitHub Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 09/36] platform/x86: hp-wmi: Disable tablet-mode reporting by default Sasha Levin
2021-02-10 23:22   ` mark gross [this message]
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 10/36] arm64: dts: rockchip: Disable display for NanoPi R2S Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 11/36] ovl: perform vfs_getxattr() with mounter creds Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 12/36] cap: fix conversions on getxattr Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 13/36] ovl: skip getxattr of security labels Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 14/36] media: rkisp1: uapi: change hist_bins array type from __u16 to __u32 Sasha Levin
2021-02-08 20:46   ` Hans Verkuil
2021-02-09 12:45     ` Dafna Hirschfeld
2021-02-09 13:02       ` Greg Kroah-Hartman
2021-02-09 13:39         ` Hans Verkuil
2021-02-09 13:44           ` Greg Kroah-Hartman
2021-02-10 15:33             ` Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 15/36] media: rkisp1: stats: remove a wrong cast to u8 Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 16/36] media: rkisp1: stats: mask the hist_bins values Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 17/36] scsi: lpfc: Fix EEH encountering oops with NVMe traffic Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 18/36] x86/split_lock: Enable the split lock feature on another Alder Lake CPU Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 19/36] nvme-pci: ignore the subsysem NQN on Phison E16 Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 20/36] drm/amd/display: Fix DPCD translation for LTTPR AUX_RD_INTERVAL Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 21/36] drm/amd/display: Add more Clock Sources to DCN2.1 Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 22/36] drm/amd/display: Release DSC before acquiring Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 23/36] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 24/36] drm/amd/display: Free atomic state after drm_atomic_commit Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 25/36] drm/amd/display: Decrement refcount of dc_sink before reassignment Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 26/36] riscv: virt_addr_valid must check the address belongs to linear mapping Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 27/36] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 28/36] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Sasha Levin
2021-02-08 17:57 ` [PATCH AUTOSEL 5.10 29/36] kallsyms: fix nonconverging kallsyms table with lld Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 30/36] ARM: ensure the signal page contains defined contents Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 31/36] ARM: kexec: fix oops after TLB are invalidated Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 32/36] init/gcov: allow CONFIG_CONSTRUCTORS on UML to fix module gcov Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 33/36] kasan: add explicit preconditions to kasan_report() Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 34/36] ubsan: implement __ubsan_handle_alignment_assumption Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 35/36] Revert "lib: Restrict cpumask_local_spread to houskeeping CPUs" Sasha Levin
2021-02-08 17:58 ` [PATCH AUTOSEL 5.10 36/36] x86/efi: Remove EFI PGD build time checks Sasha Levin

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=20210210232231.GA75203@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox