Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp94822pxb; Thu, 20 Jan 2022 09:31:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcBRnB/qUIqQ9QUWqfEQRCv7bNTqpfdTTUUrvwYso+bRhiB1liYmbZ9VI0embvrZS5SmkR X-Received: by 2002:a17:902:ab89:b0:14a:1802:7c15 with SMTP id f9-20020a170902ab8900b0014a18027c15mr38265681plr.88.1642699908639; Thu, 20 Jan 2022 09:31:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642699908; cv=none; d=google.com; s=arc-20160816; b=BDIWT4aHI2so39jQdSe85it0eN/2Ii/iBlT2OQAS/Ajz2HkBOOyS+4WgJRcO3hzPUN /P7N/6/s+KIUxlbg42ej6uLvpHq5PnQ4/+kDL/TBsHFXEfaJSyX9lqF9WbISA7hgftzh MSAf317BTIQlWHyICpKUDR58/pGhHZmcnnVVfxFAk3Nvt/DZeml/0tfnG8HgW+lRxvjg 7fVI9S5rwg0niZFo5nLsIz/oj42LK4S3jcPhZbgW/8FCCyFxRh4i9bULND+l5nk6HzlA SIEOBsWoRM0gjTkQkvGKMBMMTboKeFYRxIWujLWHRFKTN1HApnjtF5z23SHOFpZCsgE3 Q95g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:subject:cc:to:from :message-id:date:dkim-signature:dkim-signature; bh=Lx/Z9SeDGM3W+/cBe8eTNsJa2aLajFhkjxex7cRbyoA=; b=SscdnJAIkvZG2ibosieWKiaPsQU36YfzmPclniQQMY1EQR3fYAj2AuLNhcFqUB3u79 ixy+M6JdnDY4BubZ8YwTIGJza8d/oGS0kgk7zD0cbxQ2ogbfsW8b/VcVvk82e8UmPkcg cZkyboIjq+SkTwB2FTQq/Wo2fKt2cjXKYrkgaVd7et/4jenANo8n3+1McA38PiMehyGo vF1pypSccZlf40Rs8rYXZbBeBmX8+LL0yWAC515E+QmW9ePk+z/WaEs4y3s6o2joROeu oQStcAiEx9WHdnQkMm04cc2Rbe9zvg9NT9TBfeIQgqKzGbqEah3mXLdmMlKOT7TfKcJ6 NQMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wLGqBDcZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ydDF72+h; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mq17si12315480pjb.175.2022.01.20.09.31.29; Thu, 20 Jan 2022 09:31:48 -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=@suse.de header.s=susede2_rsa header.b=wLGqBDcZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ydDF72+h; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239074AbiARQ2x (ORCPT + 99 others); Tue, 18 Jan 2022 11:28:53 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:54628 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233718AbiARQ2w (ORCPT ); Tue, 18 Jan 2022 11:28:52 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EE0DD1F3BB; Tue, 18 Jan 2022 16:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1642523330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=Lx/Z9SeDGM3W+/cBe8eTNsJa2aLajFhkjxex7cRbyoA=; b=wLGqBDcZpGDIqPiyZqVvCMMt8dHxBugDblIG5AQYaassoxMFjyOoAfT6e5AyBeLviJwP8b skW033DiGWW9ORopZAlLPpTNp2J1Vj+pBUzJ9mlgoDjl7gfnNIN7uR4ncThvGk/wlNJwPS 16Gb6qepybnJZfdtUaImG3gnHSuIawc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1642523330; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=Lx/Z9SeDGM3W+/cBe8eTNsJa2aLajFhkjxex7cRbyoA=; b=ydDF72+hXRhDC8jhefdahQYwD/KlFZmdF5diaMauG+ORwMyj64l5bZHFAnLoN4e75bIypf Ip7sbYIOD6FdwGBQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id E7B50A3B83; Tue, 18 Jan 2022 16:28:50 +0000 (UTC) Date: Tue, 18 Jan 2022 17:28:50 +0100 Message-ID: From: Takashi Iwai To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , linux-kernel@vger.kernel.org Subject: [PATCH] Input: synaptics: retry query upon error 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") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some recent laptops such as Lenovo ThinkPad T14 AMD Gen 1 show the errors at querying synaptics attributes. This results in the driver falling back to the legacy mode without multi-finger support. It happens only intermittently at some boots, and it seems that the same query command seems working fine after retrying. This patch implements a retry of synaptics_query_hardware() call after some delay when it fails as a workaround. BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1194086 Signed-off-by: Takashi Iwai --- It's rather an RFC, as I'm not sure whether it's the best way to fix the problem. At least, the retry of query seems working reliably, as well as re-binding via sysfs. And, I have no idea in which condition this happens; it might be a flaky BIOS issue, of course :) Above all, the device should have been connected via SMBUS. But the binding with SMBUS fails, so some other pieces are missing. Maybe the support with psmouse is suboptimal in anyway, but it's currently the only way to make it working. Any suggestions are appreciated. thanks, Takashi drivers/input/mouse/synaptics.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index ffad142801b3..0f23fba4c36e 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -416,7 +416,7 @@ static int synaptics_resolution(struct psmouse *psmouse, return 0; } -static int synaptics_query_hardware(struct psmouse *psmouse, +static int __synaptics_query_hardware(struct psmouse *psmouse, struct synaptics_device_info *info) { int error; @@ -450,6 +450,21 @@ static int synaptics_query_hardware(struct psmouse *psmouse, return 0; } +static int synaptics_query_hardware(struct psmouse *psmouse, + struct synaptics_device_info *info) +{ + int err; + + err = __synaptics_query_hardware(psmouse, info); + if (err) { + psmouse_info(psmouse, "Query error (%d), retrying...\n", err); + msleep(100); + err = __synaptics_query_hardware(psmouse, info); + } + + return err; +} + #endif /* CONFIG_MOUSE_PS2_SYNAPTICS || CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS */ #ifdef CONFIG_MOUSE_PS2_SYNAPTICS -- 2.31.1