Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp110853ybg; Mon, 8 Jun 2020 17:54:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOUOOFe1CvmPWpBdyceG4uCqiFs6KjN0yOeQQvs4CCVGtu5iPlGwuSQNKu/QulxuS2fWH4 X-Received: by 2002:a05:6402:17f9:: with SMTP id t25mr24734101edy.134.1591664084132; Mon, 08 Jun 2020 17:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664084; cv=none; d=google.com; s=arc-20160816; b=nGcErdnd7CSr32G4hW43JUzLsMAjeInUvnhlixzqKWAD4mY6tgSOFdh2r4JOrPGrHD Tb081xE3/asYRcWhAYz+Yt/iB4kR6NCgVWc/Vtw5JkJphHw7X2lG+Yq1cDh+LZXF45PJ JE+aQqwY0bIDtKMBdR9YpYPR9iv6mMUR9vIH+T0mNi2KjOiZtKngrjyP4jk4yn3DN37L s5x1YacjEVfajc+/YV+crWdELq1VM1bEqcQALqUtq+bD0DZWtoMnGXtHc/mBdWDaLraz 0UxGmH4/ZhVppdoe8oojTs2KLMXivtg9YyzPl1A4rctj72z3DKNPcLdMtpt1pU1I57eK yOvA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hvRw7hzB78kgofUtM4FFg3S/0CAKBIksG3izIuHLjqQ=; b=wypBIuHxIRnzFggWT8MoJEry7cNhCm6yFVwaR8yywL33YvByACiwp5+A8mjNhaqDVy WfMYN/abXonIjTuLvfKPyURX9tUTwEh/0Hms8nU3OjsN9fiC/ioxybxweSN8m1jaim/f vXO/T1rleTJTReBhiPjxFnv9pprP+NkHg3By+HGA0d6G0H08xEd1iHlGte/yHnLRcudu wnX3Z8xAINL5Yc68w34UyrNMHzR3yroTQcymq/Va8yMBaSUdvF4sPm8gUfzdIxjDL+3P QeZ8rhWb5UCljYzEdkJDjTEk/PK6KNB/jfmP9myK+Kxw2VG0QqkkUgrnfbqn5SkUScNj FCTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oxaUUpDQ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si9989371ejp.589.2020.06.08.17.54.21; Mon, 08 Jun 2020 17:54:44 -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=oxaUUpDQ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgFIAwg (ORCPT + 99 others); Mon, 8 Jun 2020 20:52:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:56002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728544AbgFHXKA (ORCPT ); Mon, 8 Jun 2020 19:10:00 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1B0B20890; Mon, 8 Jun 2020 23:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657800; bh=qViuOa0tFAuzGHOi+ZLjbhAYpuI3NFwXYEk9AAsSz0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxaUUpDQg643gAXaoUjAc1CCjtsgK0pdbMl3LQFc5bzIw/LCW6p3DIXScdXn8r1+Y yJSqSaFYKuXjfGGUoBpT7P4jys9CmlToOxrW0ilgTHkjalpYrWtnFGhcCudU2QZ7GX JFGI+mh2wfcFCOfY8QPXId/td/gId2NHOjk5e23k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Mario Limonciello , Andy Shevchenko , Sasha Levin , platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 178/274] platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types Date: Mon, 8 Jun 2020 19:04:31 -0400 Message-Id: <20200608230607.3361041-178-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 500fae82e12c..4921fc15dc6c 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -158,12 +158,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