From patchwork Fri Feb 4 16:57:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 540203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6947EC433EF for ; Fri, 4 Feb 2022 16:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376689AbiBDQ5P (ORCPT ); Fri, 4 Feb 2022 11:57:15 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:36828 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376686AbiBDQ5P (ORCPT ); Fri, 4 Feb 2022 11:57:15 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 87DE7210F6; Fri, 4 Feb 2022 16:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643993834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=r+n2BzjZMe4yiKM8UnN2vZKd6/dHpNsv/LrkEagLy+4=; b=QG44PRx1ZRF++uxRI5LpbRMe3VdzZjWTJMubYNohZMvHjiWjnJqOo/+qy5U5pXegcf9TKy fxEdHnzxZohTXobVIyiF4zC2lI7UFUzFWqnTBZNwd5YRFUyfFk4k1bd25kj0vSpc/OepGM OPx3xz8xnEiUEVltzhnBtHa6X620WUs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643993834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=r+n2BzjZMe4yiKM8UnN2vZKd6/dHpNsv/LrkEagLy+4=; b=maJjJNyekt8rAkNjEwmOgwVvvsxku+eRvW/uKml7PgRbSUykoplypEjePlRer4rAAsQR+l gWo3ncU2fkiT7TBA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 8196BA3B89; Fri, 4 Feb 2022 16:57:14 +0000 (UTC) Date: Fri, 04 Feb 2022 17:57:14 +0100 Message-ID: From: Takashi Iwai To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: Wrongly bound Elantech touchpad on Lenovo Yoga Slim 7 User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?utf-8?b?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Hi, we've got a bug report on openSUSE Bugzilla about the broken touchpad on Lenovo Yoga Slim 7: https://bugzilla.opensuse.org/show_bug.cgi?id=1193064 The touchpad is an Elantech one, connected over i2c, and there are two drivers supporting it. Unfortunately, the default one the system binds, elan-i2c input driver, doesn't seem working properly, while i2c-hid driver works. I'm not sure what's the best fix for this, but below a quick workaround using a deny list with DMI matching. If this is OK, I can resubmit the patch for merging. Any comments appreciated. thanks, Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] Input: elan_i2c: Add deny list for Lenovo Yoga Slim 7 The touchpad on Lenovo Yoga Slim 7 doesn't work well with elan-i2c but rather better with i2c-hid. Add a deny list for avoiding to bind with elan-i2c. BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1193064 Signed-off-by: Takashi Iwai Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/input/mouse/elan_i2c_core.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 47af62c12267..fd08481f7aea 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1222,6 +1223,20 @@ static void elan_disable_regulator(void *_data) regulator_disable(data->vcc); } +static const struct dmi_system_id elan_i2c_denylist[] __initconst = { +#if IS_ENABLED(CONFIG_I2C_HID_ACPI) + { + /* Lenovo Yoga Slim 7 is better supported by i2c-hid */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "82A3"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Yoga Slim 7 14ITL05"), + }, + }, +#endif + { } +}; + static int elan_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) { @@ -1233,6 +1248,10 @@ static int elan_probe(struct i2c_client *client, if (IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_I2C) && i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (dmi_check_system(elan_i2c_denylist)) { + dev_info(dev, "Hits deny list, skipping\n"); + return -ENODEV; + } transport_ops = &elan_i2c_ops; } else if (IS_ENABLED(CONFIG_MOUSE_ELAN_I2C_SMBUS) && i2c_check_functionality(client->adapter,