Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp12965998pxu; Sat, 2 Jan 2021 19:41:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxSvKDHqhgy/L3smafu4bt6dmujrv+3yBSvTqVKvWfydr0UzRlEVtIS8EPrIvGUxzp9dnl X-Received: by 2002:a17:906:4717:: with SMTP id y23mr21342652ejq.6.1609645274307; Sat, 02 Jan 2021 19:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609645274; cv=none; d=google.com; s=arc-20160816; b=uh08Sse4JiDbsXlD4F2jEWq16ujPi6WfdT438omMphaP8qA7CJ4GtdHr4YGAvqjTtn Y+xOpjtPTMWYlgeo+6UuZLsukDQYeTtrpgw/VywXCUGr1Mxb0fpCJYFqh8EVp9ADs5Ak +rbMq3HTFfWxP92jab6WnwOoJrlzInc4SGFHAr5fmxRKpVHsTYR9CbZRLg75z5J39FqC UJQzMBrQ+CTHm3gt3qTdrKRNPCfWSc1vwfUdsnmIeXHkrheJaILDMj9Iqxcc6sAmO1mS fINPtxhn/l3bxaWrM31FUBBjLv35LYcHVpVVsoiDSiPvXmcnk0Gp8LMQt4fAwZVpNf0D fv5Q== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=prgSBV48sskv7qoxiNhz9ZZeflFHExPWuOS3tRXXsD4=; b=eLXKbj4qQxi9Ekxb6ecBm0R7Bc1OrFDvCTlP4US8HxQccKCISJ6sjeSAzdk0Kbma9L fooTdMRRpLYqZOcuocTuV2JOxuS+taJQtC5P2zzPsy/O6/VBXeTezlrxxA7FfS2GXXJQ /m6PBaMYe8GVHlK/0CcE+Fv80XEyL5LAammgWCL18+Txdn05MwoRAnGQ21OjdbEZW2W8 Fla8lpacLuMf6eHPN2i6KP1t0yUGnhb8bUhoEWdupedv5fWvSTMyOh8/hlSEjX2+rWbr fOPxo30Egc+AUgRvDsMTuM9eDjVVUMExRC5yWRMG5Bgf0hSc1wE8Q+sowmQm9qixMjt8 FAKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=pOL86OOf; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EqSRDVmO; 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 c2si29469745edd.415.2021.01.02.19.40.37; Sat, 02 Jan 2021 19:41:14 -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=@flygoat.com header.s=fm1 header.b=pOL86OOf; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=EqSRDVmO; 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 S1726363AbhACDiK (ORCPT + 99 others); Sat, 2 Jan 2021 22:38:10 -0500 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:49733 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbhACDiK (ORCPT ); Sat, 2 Jan 2021 22:38:10 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A1477580138; Sat, 2 Jan 2021 22:37:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 02 Jan 2021 22:37:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=prgSBV48sskv7qoxiNhz9ZZefl FHExPWuOS3tRXXsD4=; b=pOL86OOf8Sse/XpCRDO7WxZlF0nUWkQS0kOYz3VnVt p7ZbOpcZoIzW3FLZ1woAIzB66pPQpcJtzCCyhPKbyN07eAdPun8Ers26BpSwVgl1 mOEZprjot9rVZikuSXGCjp1WeI6E98JK7jLUe7Rcttqqtbi3Fp4KNb2pp9fZfEh0 M46VvrYB1HwmSerPHaA5dbDWVVCwUX10CmMyYQge8X0rf+6+mlSl68J5Ii9zjNTZ NLzMGFzQdSI3B21s2SxOq7qFojMyi/FDAqc34RcBXyTgTZb1oYChgXIhJgKAkEOW KUR/orGsJkQJ5Qtatf6Fq/KQFsGCttDR/Sy+cbv1pGOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=prgSBV48sskv7qoxi Nhz9ZZeflFHExPWuOS3tRXXsD4=; b=EqSRDVmO5ORlac/JfYspOykp5MklJr6jD 4FwlCJAsZT8yvWtFgq/t66+mtcXLuTxO9caXzz4eoIySslhrl9mg5DQ472tXgQL/ O7rrrLHpPMplsEJ1o5IGb9rD146MT/6z0JqvQJbR4Hao+pFuKsvgufr9mlmVa4De yOboEUD9Zw6CVa3Ko6Ur7nXsO5CjcT+5jIxGd7DfzV0/EzOIaVrnli0Dyjb2ts8t +fiLayEvPwh5I/jB9QEpDr8J+cwe5N6yHugwyvIiLgmzgEjqLjWQPii8yPoLU4Bv so/6aPGJuyuBWoqxn1W+mTVCaB0rgdaYDcIlp/MyTRDAdea03WPIw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdeftddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeflihgrgihunhcu jggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecuggftrf grthhtvghrnhephfejtdektdeuhedtieefteekveffteejteefgeekveegffetvddugfel iefhtddunecukfhppedukeefrdduheejrdefvddruddtudenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhih ghhorghtrdgtohhm X-ME-Proxy: Received: from strike.202.net.flygoat.com (unknown [183.157.32.101]) by mail.messagingengine.com (Postfix) with ESMTPA id 78217108005C; Sat, 2 Jan 2021 22:36:58 -0500 (EST) From: Jiaxun Yang To: platform-driver-x86@vger.kernel.org Cc: Jiaxun Yang , stable@vger.kernel.org, Ike Panhc , Hans de Goede , Mark Gross , linux-kernel@vger.kernel.org Subject: [PATCH fixes v3] platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634 Date: Sun, 3 Jan 2021 11:36:51 +0800 Message-Id: <20210103033651.47580-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Newer ideapads (e.g.: Yoga 14s, 720S 14) come with ELAN0634 touchpad do not use EC to switch touchpad. Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly. Writing VPCCMD_W_TOUCHPAD may cause a spurious key press. Add has_touchpad_switch to workaround these machines. Signed-off-by: Jiaxun Yang Cc: stable@vger.kernel.org # 5.4+ -- v2: Specify touchpad to ELAN0634 v3: Stupid missing ! in v2 --- drivers/platform/x86/ideapad-laptop.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 7598cd46cf60..427970b3b0da 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -92,6 +92,7 @@ struct ideapad_private { struct dentry *debug; unsigned long cfg; bool has_hw_rfkill_switch; + bool has_touchpad_switch; const char *fnesc_guid; }; @@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj, } else if (attr == &dev_attr_fn_lock.attr) { supported = acpi_has_method(priv->adev->handle, "HALS") && acpi_has_method(priv->adev->handle, "SALS"); - } else + } else if (attr == &dev_attr_touchpad.attr) + supported = priv->has_touchpad_switch; + else supported = true; return supported ? attr->mode : 0; @@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) { unsigned long value; + if (!priv->has_touchpad_switch) + return; + /* Without reading from EC touchpad LED doesn't switch state */ if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { /* Some IdeaPads don't really turn off touchpad - they only @@ -989,6 +995,9 @@ static int ideapad_acpi_add(struct platform_device *pdev) priv->platform_device = pdev; priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list); + /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ + priv->has_touchpad_switch = !acpi_dev_present("PNP0C50", "ELAN0634", -1); + ret = ideapad_sysfs_init(priv); if (ret) return ret; @@ -1006,6 +1015,10 @@ static int ideapad_acpi_add(struct platform_device *pdev) if (!priv->has_hw_rfkill_switch) write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1); + /* The same for Touchpad */ + if (!priv->has_touchpad_switch) + write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1); + for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) ideapad_register_rfkill(priv, i); -- 2.30.0