Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9087052pxu; Mon, 28 Dec 2020 06:19:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUHr9PlylYavLXgiz9VFR5T2S9IYGvWe3iFOtMhvgVz7CJRIru5+9lJOp03DpgXEVVruB4 X-Received: by 2002:a17:906:ce23:: with SMTP id sd3mr41881071ejb.69.1609165141749; Mon, 28 Dec 2020 06:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165141; cv=none; d=google.com; s=arc-20160816; b=OBFx53Y7r1IvfXnCLBzKzvmb5PEVm7mxGzSwP4oyc3N/arrx0YIRb3wutzITf7E8wi FUqME8h0ZaMmTQKqscjA1gOsCELr3r/AKOj1AmmBtyJ74NZEukfoJRS243WSM9o1MUJl cwRHdkeNwG7q7tAMGRfyfBGp2T4RcCEyljcdDxc9OocoERh1ijZ7gwZoB5/jjapgu7am HnSUPVklIob8ACLtQjQVldSYxeH6BJeCIaVc2g1jlrRlAEkdN4wZqmMuXXiJY3KnboHD jhhGfpVQwiOrymHU+zPnLZS/g/nZii+QaQl02bsbsLkILjs4YQFr1XjtvpyC9Cz6BbcG DNcA== 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=FU7ieV3NFFHvKn62MFcQ9Y9A7fmiY3X3nP6VE8q/ub4=; b=E0HbFy014AVJ06eUxXamLrvj8z2yeX784OivHmGaW0IQoEtb1FL0Eo42tFbZeLfmGz SdHBdveztyrdGCxtsmvo3wXBLMRum9j6q3R6xKhn+9Wj1YS+6uu7JFftwiBtJ7sag0uQ a+/QCsfBFUzyzR1p4969AYjbR99DJSmgD1uQwEt73Y11tRXyf+v4HmRaA3g9tPMBFHOA 7acHllqUn/wJyuTxhGN/WjsMDMbYGd/VGzefrs1/kmslWYKLoSgRG+wK1qb4Pt9WgNZL T8o7jv8kE66YjPsjeTVvOyQAdgViZjb+k3ryimzHKLQb3wygsOw5XVuJ+55w/U63oqTy fXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jyTaS7HN; 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=pass (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 b21si18356785ejk.520.2020.12.28.06.18.39; Mon, 28 Dec 2020 06:19:01 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=jyTaS7HN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441341AbgL1ORC (ORCPT + 99 others); Mon, 28 Dec 2020 09:17:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:51948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441236AbgL1OQp (ORCPT ); Mon, 28 Dec 2020 09:16:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFBCA207A9; Mon, 28 Dec 2020 14:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164964; bh=tabp5gX2tkCFcibSKiI8VWJhPIInDjw/Up4ucq/JRHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyTaS7HNZfKMaLICgqUrna7iqlkADQvraiouzOZmWUlG5GorY9KJmqM5yJ6j/5pw2 5c4Je3Hxekz346QOdgSZiNhsMw8FZ/6fyY0T4fhuU6y2UeNxjuW+hjBu2FuFN51myz UJ7ZSckrwP9/W4zlL15htsXz6BrlvypEN+ZxUDws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 5.10 344/717] platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on some HP x360 models Date: Mon, 28 Dec 2020 13:45:42 +0100 Message-Id: <20201228125037.508636844@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 [ Upstream commit a4327979a19e8734ddefbd8bcbb73bd9905b69cd ] Some HP x360 models have an ACPI VGBS method which 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_". Note this wrokaround was first added to the kernel as commit d823346876a9 ("platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360"). After commit 8169bd3e6e19 ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting") got added to the kernel this was reverted, because with the new allow-list approach the workaround was no longer necessary for the model on which the issue was first reported. But it turns out that the workaround is still necessary because some affected models report a chassis-type of 31 which is on the allow-list. BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894017 Fixes: 21d64817c724 ("platform/x86: intel-vbtn: Revert "Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360"") Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- 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 0419c8001fe33..123401f04b55a 100644 --- 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"); @@ -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.27.0