X86 platform drivers
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360
Date: Thu, 17 Sep 2020 14:33:24 -0700	[thread overview]
Message-ID: <20200917213324.GB29136@mtg-dev.jf.intel.com> (raw)
In-Reply-To: <20200912093532.18522-1-hdegoede@redhat.com>

Acked-by: Mark Gross <mgross@linux.intel.com>

--mark

On Sat, Sep 12, 2020 at 11:35:32AM +0200, Hans de Goede wrote:
> Commit cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist
> SW_TABLET_MODE on the 9 / "Laptop" chasis-type") restored SW_TABLET_MODE
> reporting on the HP stream x360 11 series on which it was previously broken
> by commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet
> mode switch on 2-in-1's").
> 
> It turns out that enabling SW_TABLET_MODE reporting on devices with a
> chassis-type of 10 ("Notebook") causes SW_TABLET_MODE to always report 1
> at boot on the HP Pavilion 11 x360, which causes libinput to disable the
> kbd and touchpad.
> 
> The HP Pavilion 11 x360's ACPI VGBS method sets bit 4 instead of bit 6 when
> NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT collection
> shows only one other model, the Medion E1239T ever setting bit 4 and it
> always sets this together with bit 6.
> 
> So lets treat bit 4 as a second bit which when set indicates the device not
> being in tablet-mode, as we already do for bit 6.
> 
> While at it also prefix all VGBS constant defines with "VGBS_".
> 
> Fixes: cfae58ed681c ("platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/intel-vbtn.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
> index e85d8e58320c..f443619e1e7e 100644
> --- a/drivers/platform/x86/intel-vbtn.c
> +++ b/drivers/platform/x86/intel-vbtn.c
> @@ -15,9 +15,13 @@
>  #include <linux/platform_device.h>
>  #include <linux/suspend.h>
>  
> +/* Returned when NOT in tablet mode on some HP Stream x360 11 models */
> +#define VGBS_TABLET_MODE_FLAG_ALT	0x10
>  /* When NOT in tablet mode, VGBS returns with the flag 0x40 */
> -#define TABLET_MODE_FLAG 0x40
> -#define DOCK_MODE_FLAG   0x80
> +#define VGBS_TABLET_MODE_FLAG		0x40
> +#define VGBS_DOCK_MODE_FLAG		0x80
> +
> +#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT)
>  
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("AceLan Kao");
> @@ -72,9 +76,9 @@ static void detect_tablet_mode(struct platform_device *device)
>  	if (ACPI_FAILURE(status))
>  		return;
>  
> -	m = !(vgbs & TABLET_MODE_FLAG);
> +	m = !(vgbs & VGBS_TABLET_MODE_FLAGS);
>  	input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
> -	m = (vgbs & DOCK_MODE_FLAG) ? 1 : 0;
> +	m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0;
>  	input_report_switch(priv->input_dev, SW_DOCK, m);
>  }
>  
> -- 
> 2.28.0
> 

           reply	other threads:[~2020-09-17 21:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200912093532.18522-1-hdegoede@redhat.com>]

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=20200917213324.GB29136@mtg-dev.jf.intel.com \
    --to=mgross@linux.intel.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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