Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp55589ybg; Mon, 8 Jun 2020 16:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza2mU4N9m+GKWPFnQ5OO0iiAnjtT6IBsDALfpNQ+Zx1ApGKF1nOSvrgQKARg8tzF5z90y/ X-Received: by 2002:a17:906:7e50:: with SMTP id z16mr23836693ejr.277.1591658222780; Mon, 08 Jun 2020 16:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658222; cv=none; d=google.com; s=arc-20160816; b=Umqf1pQUELbVOOAzYSaohukBrMFGELqAxmybWF03GyKhgbiBHk9/ToPEUtn45ykKwR fW6B0lP4GpWA7GeCoLCzUBOCDudid6lzQPQuaENCfnCpByHnJlcwHohhEOTy9MaU2ijn oC6H7oQun9BEXYqxAvny6oCBLV9qOzZsT3lm3EedgbYBPetnHvm/HadlaKUHOUV9Iqca IhRvRNoOOLPfmkwQPvBxbsUpkhBzrUoSkALStGnAWyk4H1FFaar3NQoOh6HnxNKwjH7d SrEhDca5hROlJg/X3PfCYmVUA8FZMQiCcSETdNul3Mby5JWAjRAR7lM/qjJjzFC5gUoL TRPw== 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=ha3UUY1bKcHBqXQz5L+W8IUGRmZVy5u9GRHkuhunNFc=; b=LvTGFeZ+c5f4ariUfqnrSMVbbjgS5sqenI7ATZi1YOY1JLLA/OsdmcyjgK2BCv1XGi jMZ4OufMwHDJu19N7dZ7UjGkxDq8SrKMKkTu2E4+KPOZZOp25wLvAXV5qqKAROnqPI2I qjUiLNJKsRPqKd8+Dn/onYZLbbNOQarUzSUG4vo2ZdBiIYq3vHS21c4DnEJ3QvQCclJg L7RuvZHIIoV/iDrbmMvWV/viroIyVdp3UfjNA2kuQDByhHspE+JcR9K+JJTWcrFDucsY O3vZ4dpahXQ5dCXUXIFzhB38yy0EkiVkrKE/iQMA0m/gYV9ElHEOlnLAW6ZugRMULMZz 3aqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Cwaw529; 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 si29si9759190ejb.40.2020.06.08.16.16.40; Mon, 08 Jun 2020 16:17:02 -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=1Cwaw529; 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 S1729784AbgFHXOU (ORCPT + 99 others); Mon, 8 Jun 2020 19:14:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:58894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728996AbgFHXLv (ORCPT ); Mon, 8 Jun 2020 19:11:51 -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 D4E9E21532; Mon, 8 Jun 2020 23:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657910; bh=E/7HYZcFWCYad9Xsm1E7dzZCby4y08/7lx/4/FuHRzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Cwaw5297o3l5zl1pNqnLFW+vs5zOxT5vTMD9kQ2aowD3YQnRZa6nA5LSoiEwVBJV IFqXS9n1xbsQVRdOstfyZWDMUUx7Uj8mx+UBM1/H1DZGKoONiKm/95r8VUldNcgjLH Vp3TZnFudi7LaeOuL9uO4VzXrxa1YChA5IfLJ+sQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Mario Limonciello , Mario Limonciello , Andy Shevchenko , Sasha Levin , platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 262/274] platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type Date: Mon, 8 Jun 2020 19:05:55 -0400 Message-Id: <20200608230607.3361041-262-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 cfae58ed681c5fe0185db843013ecc71cd265ebf ] The HP Stream x360 11-p000nd no longer report SW_TABLET_MODE state / events with recent kernels. This model reports a chassis-type of 10 / "Notebook" which is not on the recently introduced chassis-type whitelist Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a chassis-type whitelist and only listed 31 / "Convertible" as being capable of generating valid SW_TABLET_MOD events. Commit 1fac39fd0316 ("platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types") extended the whitelist with chassis-types 8 / "Portable" and 32 / "Detachable". And now we need to exten the whitelist again with 10 / "Notebook"... The issue original fixed by the whitelist is really a ACPI DSDT bug on the Dell XPS 9360 where it has a VGBS which reports it is in tablet mode even though it is not a 2-in-1 at all, but a regular laptop. So since this is a workaround for a DSDT issue on that specific model, instead of extending the whitelist over and over again, lets switch to a blacklist and only blacklist the chassis-type of the model for which the chassis-type check was added. Note this also fixes the current version of the code no longer checking if dmi_get_system_info(DMI_CHASSIS_TYPE) returns NULL. Fixes: 1fac39fd0316 ("platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types") Cc: Mario Limonciello 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 | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c index 4921fc15dc6c..a05b80955dcd 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -158,21 +158,18 @@ 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 (kstrtoul(chassis_type, 10, &chassis_type_int)) - return false; - - switch (chassis_type_int) { - case 8: /* Portable */ - case 31: /* Convertible */ - case 32: /* Detachable */ - break; - default: + /* + * Some normal laptops have a VGBS method despite being non-convertible + * and their VGBS method always returns 0, causing detect_tablet_mode() + * to report SW_TABLET_MODE=1 to userspace, which causes issues. + * These laptops have a DMI chassis_type of 9 ("Laptop"), do not report + * switches on any devices with a DMI chassis_type of 9. + */ + if (chassis_type && strcmp(chassis_type, "9") == 0) return false; - } status = acpi_evaluate_integer(handle, "VGBS", NULL, &vgbs); return ACPI_SUCCESS(status); -- 2.25.1