Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4321806pxu; Mon, 12 Oct 2020 16:09:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqO9L/OWNBccYtWfdP7y3OmQp5fUbaae6x5yeFPgfBvN+giYS26pgjuWwSuF+MHJUwWIZR X-Received: by 2002:a17:906:fb86:: with SMTP id lr6mr30115480ejb.510.1602544182463; Mon, 12 Oct 2020 16:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602544182; cv=none; d=google.com; s=arc-20160816; b=ydozlJk3rxUdQKX+FDvGkZCQQjxR8wr+GcEWprG0MniOVgMQfSc6mCf9ykVcFrxMGG dVgQbpbMGE7lI2F0yBu/Aaf2x2ukUCXx26PBvWucPDxTqUQEPcLCKkbPP5Cd6/f96JhP 1c6E0egZuEjQITis8iIoT47l7HUGPkkrtAqz4R+OZ6VuXp3d1qh60FKATRSqkFCXJ51z 5JrJdkuJUbL0mCRkkKHgaApaZZZQLr9Oli/6DWA5WHQN0/ktq5vpaGMkKBiOaniu55WA PAdoagGpJUjE6H18a8XRLNHtekZqGFRgTRFGuyiDlu3IvGJyGeHk4Up0I/j5kBoOwM1V hmOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9u5P10XTT9n4HjIiNkznvaVvwtKSXJJenUFB2xBUjao=; b=NoR6phEdxptbbH3w/b0VQX75zDEccp58i2dO3lu/f+aE7/f7G2OiqmMhZJ8HCQbU5m YiXIrmIha3K7pDtLbhHNz7zP4H/lB4Rc8EQydbmAJ7zvqxZj1X6T8xitAK5VL2PC59tw v6LcRS9mZht9QwwBzTmlbVJl3BumsnDu2MzWndpWimTc9DPwiR40UeZkUB3ciEEf9E2S ppnkjQH7KXu5S23BCK2vPD6blKYepMWMuYg/okuS1ehrXLsOtYM4A3kw5P4YnNef+J5A Zk2ShY/2HQyxzbvSNJa/RZxZ7PGZD/0yCgihUrhN2ZDXM2aNC8t5Kb0ANncyte5vWSSu 8H7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDZTkSO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si13039451edd.408.2020.10.12.16.09.19; Mon, 12 Oct 2020 16:09:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDZTkSO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389235AbgJLNmU (ORCPT + 99 others); Mon, 12 Oct 2020 09:42:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:46186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731505AbgJLNmD (ORCPT ); Mon, 12 Oct 2020 09:42:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD6D422202; Mon, 12 Oct 2020 13:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510113; bh=XtpB59G9TYE4H0HNJH7eGgnDt+9I9era3TAO16Mqdc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDZTkSO6dCg+9NnIoiHLQesKuXHsuNnBrrn1bZSXqYr3TERUDPRqFv7uZb4YWJKE4 IMLNyTGSwRSOvh3BDWWB60KMYKAT6LLKTiodWhe2zUtDMxgoJfIL6+rGxTTDxVwzco Y2quvUFTlxSK7h7uhocoHAUKuyaI4Lw7enXEjZcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mark Gross , Andy Shevchenko Subject: [PATCH 5.4 15/85] platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360 Date: Mon, 12 Oct 2020 15:26:38 +0200 Message-Id: <20201012132633.594520872@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132632.846779148@linuxfoundation.org> References: <20201012132632.846779148@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit d823346876a970522ff9e4d2b323c9b734dcc4de upstream. 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 Acked-by: Mark Gross Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/intel-vbtn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -15,9 +15,13 @@ #include #include +/* 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"); @@ -148,9 +152,9 @@ static void detect_tablet_mode(struct pl 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); }