Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp783780ybt; Fri, 19 Jun 2020 13:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFTIRSOvUCQapuaxRbJqKfSErjv0J5MvznHL4L1inHBf4ob7PgZja7fP0Nxwm+YAQ2V5hN X-Received: by 2002:a17:906:9402:: with SMTP id q2mr5303427ejx.216.1592599347377; Fri, 19 Jun 2020 13:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592599347; cv=none; d=google.com; s=arc-20160816; b=U33zPiFafUqcI21+XplWIetFLtnCjbjOBc4ZB7SUxVqVbrruxIGoGL+ernHiWS0aLp AO9N5K/o9lE5BIRCQW4rMZSDGaAwk/J4mFkJa3X098A5Btp85eJbkJPXW32fcDnbFRny dPGYCWHwTuXHFGT+7AlhlVifWYRTyGYsfkwDeEZDsJmkeV5QYKTYb57VwSoq0SW75vqP R5ATaeiWyQ/4SinwEJKXGXGveYptYeyLgmStE01NCw170mEgN+KLPukIhergUJPmTAvM 8o9MEhmPqOiKSTefYHuLHv06P4HuGKqWlfFUsPhYRID1khsTCKLprScG57EpYlJDlubv HAaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sHSO/h3ZEUngXo+M5t7YNZd8Ovjq1K8/Os45X7Hau7k=; b=D9Or/qLkOtxbSGecLE1p8AIK4FCI1MX45jSYVsA8PHziEZGfak9BMy6K/ATJQuqawV a5TO37bpa8xfwW+bIOR9yPYiyx0dQIG6TMUrTd2/iS2Q14izx0aIZSyXw5jkHj8JntKT Y4A1iC7GiLYmBDxR+XUislfM1faVDZxbatid2zhKKRGeu0xuEQJiXKtlNjhxSUbNYuG6 ixxtLY4mZJfIXBbmgSZ4TqHthmDsdODn/kOu1zX801/8C1GlVz1vRtCr3uS+Zm4mP7Nn yaMvqKLXBcokl/rAQtsk+8MgrXCA+voLqFWpZPTfipGLXEZ+o+acTV2LSzvOTE93RttI przw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nfnx7BBc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q21si4355759edw.46.2020.06.19.13.42.04; Fri, 19 Jun 2020 13:42:27 -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=Nfnx7BBc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390615AbgFSPAG (ORCPT + 99 others); Fri, 19 Jun 2020 11:00:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:56234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389916AbgFSO7z (ORCPT ); Fri, 19 Jun 2020 10:59:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B29B0218AC; Fri, 19 Jun 2020 14:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578795; bh=18KOcZajMmpY2rbqPpuMqji5HUMM1Fd6BXCK/THQZIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nfnx7BBcnQmVBE6i1l0pNDSXawj3w1wB6RsyDaQxBdLVA++s6DuaLKqJ+SL76biyS iopllzBs8ZLh0w1L46bjjwpJ/cm+8n/pEvzdf7Dqo759mAu2M+HZnfntZnrgc49rUw Cub7Lci58kcbXLizvFp0h1WfzchosWguSAnWQe+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mario Limonciello , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.19 152/267] platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types Date: Fri, 19 Jun 2020 16:32:17 +0200 Message-Id: <20200619141656.121339159@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit 1fac39fd0316b19c3e57a182524332332d1643ce ] Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a DMI chassis-type check to avoid accidentally reporting SW_TABLET_MODE = 1 to userspace on laptops. Some devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report if they are in tablet mode (keyboard detached) or not, report 32 / "Detachable" as chassis-type, e.g. the HP Pavilion X2 series. Other devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report SW_TABLET_MODE, report 8 / "Portable" as chassis-type. The Dell Venue 11 Pro 7130 is an example of this. Extend the DMI chassis-type check to also accept Portables and Detachables so that the intel-vbtn driver will report SW_TABLET_MODE on these devices. Note the chassis-type check was originally added to avoid a false-positive tablet-mode report on the Dell XPS 9360 laptop. To the best of my knowledge that laptop is using a chassis-type of 9 / "Laptop", so after this commit we still ignore the tablet-switch for that chassis-type. Fixes: de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") Signed-off-by: Hans de Goede Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/platform/x86/intel-vbtn.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c index 23cda7aa96cd..5f8120d12859 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -157,12 +157,22 @@ static void detect_tablet_mode(struct platform_device *device) static bool intel_vbtn_has_switches(acpi_handle handle) { const char *chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); + unsigned long chassis_type_int; unsigned long long vgbs; acpi_status status; - if (!(chassis_type && strcmp(chassis_type, "31") == 0)) + if (kstrtoul(chassis_type, 10, &chassis_type_int)) return false; + switch (chassis_type_int) { + case 8: /* Portable */ + case 31: /* Convertible */ + case 32: /* Detachable */ + break; + default: + return false; + } + status = acpi_evaluate_integer(handle, "VGBS", NULL, &vgbs); return ACPI_SUCCESS(status); } -- 2.25.1