Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp487933pxu; Thu, 3 Dec 2020 05:35:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRkx9eil55AZq06XtvQk2uPbQDEqmCVYajWtHsLtr3Mg3qamV/X2D5euiKASTttOkzD8Ds X-Received: by 2002:a17:906:1b46:: with SMTP id p6mr2614557ejg.68.1607002504242; Thu, 03 Dec 2020 05:35:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607002504; cv=none; d=google.com; s=arc-20160816; b=lmjLgx/vLKT55wAKw+EZkFkMTd0OiRuIPiAYT/nv9xaOaiOhKe+W8LnyT7eFFwy1LA Th1nG2FHEEdzdX4Xrjqdg3i2Zyepo4rJzvi2iOlD5WfTsTPdIIrdi991r8nZZHfqbk+n ds0rpcsxBI+U7hhgUpR6CEuRyEvEGj/P7CxBVd9+zBQ+hP3Mpvu4B7vQ+ArCX7IOHjl6 LNPh3dWgF69oH+4u/L5mUzNpT3yeGO4/zjZl69JLr6hHcMODvt6OZIQKRa08BFqg7aRJ immjRVDp3OTIY35c23FBKURl6ILLr/y9S9EK+wYZw1ASo3TSS6XjMI50PS8YIA6GrRAA OVhQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dyLu8lz2jBiYhwnsEjtfSblOnifOWlPuof2Ab9mONnU=; b=0KtSBMl2Nf8GgTD5gv4x2dS2PVheilyPbtOKp0jqSBs5Muw8Mcoo4VLzK835EeQtYu Rj2lYAvcnkUrEE6oKs/n/HGTizpza0Dk3wQYMtjYOggO+0OPES+cKNS5BLSyaTn1Od77 VnWfiVyyyZhoj89q27Hk8U4AvQvl57dFPud9JcbxptGGBS4IV0tlmpXDFiBuSechd0tW t0sWGEj+mZ55SBna/p6IV8/7i2CLLIBfLg7Z4S3DEV+ALtPp8b+2ZpWAPvKI7ZrzNCR2 Lyf0aqZ5gqf/LyMhuz2axxFoZuc8Ai73DD4hExxiAXPFvXsmsSx3kB3h0xMr+EHe2LUs vhng== ARC-Authentication-Results: i=1; mx.google.com; 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 bi26si915097edb.553.2020.12.03.05.34.38; Thu, 03 Dec 2020 05:35:04 -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; 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 S2436809AbgLCNa7 (ORCPT + 99 others); Thu, 3 Dec 2020 08:30:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:49066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436735AbgLCNat (ORCPT ); Thu, 3 Dec 2020 08:30:49 -0500 From: Sasha Levin Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Sasha Levin , ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.9 31/39] platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11e Date: Thu, 3 Dec 2020 08:28:25 -0500 Message-Id: <20201203132834.930999-31-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201203132834.930999-1-sashal@kernel.org> References: <20201203132834.930999-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit f2eae1888cf22590c38764b8fa3c989c0283870e ] The Yoga 11e series has 2 accelerometers described by a BOSC0200 ACPI node. This setup relies on a Windows service which reads both accelerometers and then calculates the angle between the 2 halves to determine laptop / tent / tablet mode and then reports the calculated mode back to the EC by calling special ACPI methods on the BOSC0200 node. The bmc150 iio driver does not support this (it involves double calculations requiring sqrt and arccos so this really needs to be done in userspace), as a result of this on the Yoga 11e the thinkpad_acpi code always reports SW_TABLET_MODE=0, starting with GNOME 3.38 reporting SW_TABLET_MODE=0 causes GNOME to: 1. Not show the onscreen keyboard when a text-input field is focussed with the touchscreen. 2. Disable accelerometer based auto display-rotation. This makes sense when in laptop-mode but not when in tablet-mode. But since for the Yoga 11e the thinkpad_acpi code always reports SW_TABLET_MODE=0, GNOME does not know when the device is in tablet-mode. Stop reporting the broken (always 0) SW_TABLET_MODE on Yoga 11e models to fix this. Note there are plans for userspace to support 360 degree hinges style 2-in-1s with 2 accelerometers and figure out the mode by itself, see: https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216 Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20201106140130.46820-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/thinkpad_acpi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 4a5bb86d341ee..cd7e782791c71 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3214,7 +3214,14 @@ static int hotkey_init_tablet_mode(void) in_tablet_mode = hotkey_gmms_get_tablet_mode(res, &has_tablet_mode); - if (has_tablet_mode) + /* + * The Yoga 11e series has 2 accelerometers described by a + * BOSC0200 ACPI node. This setup relies on a Windows service + * which calls special ACPI methods on this node to report + * the laptop/tent/tablet mode to the EC. The bmc150 iio driver + * does not support this, so skip the hotkey on these models. + */ + if (has_tablet_mode && !acpi_dev_present("BOSC0200", "1", -1)) tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_GMMS; type = "GMMS"; } else if (acpi_evalf(hkey_handle, &res, "MHKG", "qd")) { -- 2.27.0