Message ID | 20240125-x13s-touchscreen-v1-2-ab8c882def9c@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp429904dyb; Thu, 25 Jan 2024 19:56:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEz+lDiP8sEWOcbxHFiW4xpsVr+D3MiD/BBGOJMShpKXeJLb1gmzdpjAukYX+WHlq6gjZMn X-Received: by 2002:a05:6a20:6d0a:b0:199:a2a9:4150 with SMTP id fv10-20020a056a206d0a00b00199a2a94150mr583467pzb.121.1706241374353; Thu, 25 Jan 2024 19:56:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706241374; cv=pass; d=google.com; s=arc-20160816; b=LOhM2nFWe5oZz7OIdz8qOXQQViQrDbWfuF04rQ3O6S2ww+kqlYCGNyC0eAw4xcYmWn 0jJZ3DjAEhBGRyr8pRJf4LgtL/EYW1IYXBxhe1tcDLB3IdXEoIJNmpXZlKt0+oD8r1Rb bvqdrvnXobKD6QawPCmFiybt8lAF2Rk7mRVUyIqexpx5le5g2Mmec4LYC3wzJkD5awVr GiucbQfSuw18fcpBfXwRIjmB4J1Jrs+h1e9y4WFe61htyRK0SV0s9p+9kkizHi3FFMT+ ylfcauO5hRifA3Iz/cuz3UY5ajKAjr4nm3uM0VjJFZNFyZ9opUVpvGiJBICqSFywl785 PMkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Cck/GJxSluI5ev4MbkCdy2c7VJsUu3P8mIgrgZQqg0o=; fh=JASAEPYKLgS69vVDzsrNlPvFdidWhQf3L3WUeeF5VWc=; b=ORKgvtHrm2BG2Ficl8UtFgpJa7OYJ1ewn3QRLy3iZnAgt7Crd/kJe/SuNGfvqh38n9 nC3loHA0WOe+wWK83Ye55DgqWkkqh207ZuSPkCsc6GUvETix1IEtQnrNXJ+fERzI7eBL FhJi29kKQvT/kbx7rO41Yg36CcQFS6XUt/vaO5yo5Oz96l4moTLFNv6STKPCof4QlVMI kvg2mm8almR6he9sOZ82+nIPzjEgAeglTX4SwZ8oWPQrnmAovWWlliZnbqAFCY2hTgte D+5ijWeZMGH4p9/d9lXAmODelJAuM/TGW4OULmJ1wL9I0xwXRcRc7Jhr3gNvTnM2gUYR 83/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FQZ2jyqn; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ga5-20020a17090b038500b0029065f05934si2470687pjb.2.2024.01.25.19.56.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 19:56:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FQZ2jyqn; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39576-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2468928C164 for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 03:56:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5580F1118D; Fri, 26 Jan 2024 03:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FQZ2jyqn" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AC5EBE49; Fri, 26 Jan 2024 03:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706241332; cv=none; b=Gt8i/9ZOozfhIOK6egNH8dBQ9SIFoacf+mje9oWRg6XK8obQ+YddLyidfhJwsrJTTVaML2D5PpUKqUVHJuyKJUI/uEolkVDGVMp0nu1o2cLy/aZMSPdTMNN6mqZw+3ihIi0pNEwczrXaenzacyY789vkQ8Leh5oUEv48sCQzaAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706241332; c=relaxed/simple; bh=Kk+y5hNnOiQ2qFggH/zRNiKdLX4XwYFzmrAqZbWNdE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=p6wkreno5qS8JWm4EB9wRi6d3TYWCA0pL6+egyJEACmCHMeppPbxEqR8k0N+K9x1+fuoV7CHPO+CAXzH56jv9PHfhv6IDG8QaUirz5S4HI9U5apEOGf6zV0+uvXm5PVqgOKK80TPwsDK4GBqyaiUt70dnVwpP3gXTtGtaTLXTAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FQZ2jyqn; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40Q0uWGk023947; Fri, 26 Jan 2024 03:55:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=Cck/GJxSluI5ev4MbkCdy2c7VJsUu3P8mIgrgZQqg0o =; b=FQZ2jyqnH6QiChIcx1hgrlX3uZC2Kl4xmM/4TerUXvd4Y4mKDEsM4iSINFv 6CBTRDiHbd/3v3hiOsb/H9/4f+9FDetcunv0zVl0146wxQH9VhjnOquoS08xB8ym jvrnGlI0X4oQC6j7ZY2zEdbQ911qFcdUCFza5oiS2+tWoa2OOby4qwt+0do0fo1v kV9cYGZ/O+6vnbKyVU2su/cDO63LamR4Jx2w7I/aYsUC7akGTiDyMyWrTekjdGs4 sD4imc+zra+q0qFxcIoMRx8rVFZpgNIuTh5//e1whHJryG8tMod6WpITGfOsXBW1 gpPsm2s8qyqOmx+R/uLI8u/wHJw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vuqra1xek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Jan 2024 03:55:18 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40Q3tH9G023435 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Jan 2024 03:55:17 GMT Received: from [169.254.0.1] (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 25 Jan 2024 19:55:17 -0800 From: Bjorn Andersson <quic_bjorande@quicinc.com> Date: Thu, 25 Jan 2024 19:55:14 -0800 Subject: [PATCH 2/2] arm64: dts: qcom: sc8280xp-x13s: Fix/enable touchscreen Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240125-x13s-touchscreen-v1-2-ab8c882def9c@quicinc.com> References: <20240125-x13s-touchscreen-v1-0-ab8c882def9c@quicinc.com> In-Reply-To: <20240125-x13s-touchscreen-v1-0-ab8c882def9c@quicinc.com> To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Benjamin Tissoires <benjamin.tissoires@redhat.com>, Jiri Kosina <jikos@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Johan Hovold <johan+linaro@kernel.org> CC: <linux-arm-msm@vger.kernel.org>, <linux-input@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Konrad Dybcio <konrad.dybcio@somainline.org>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Bjorn Andersson <quic_bjorande@quicinc.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706241316; l=1330; i=quic_bjorande@quicinc.com; s=20230915; h=from:subject:message-id; bh=Kk+y5hNnOiQ2qFggH/zRNiKdLX4XwYFzmrAqZbWNdE4=; b=XXT4ELI9bJf5JFfwnJVzWRjPWf/opRDOL12nu58PFDtuwjH3AZI9SKtQvEzhzxzkdqWkA9Fu6 w5PjI8TexGKCCUz/IQmmsi0XRVCrjWOtx8ww5WL8+CISnVfZhjNoyWL X-Developer-Key: i=quic_bjorande@quicinc.com; a=ed25519; pk=VkhObtljigy9k0ZUIE1Mvr0Y+E1dgBEH9WoLQnUtbIM= X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: RgVbnw65RNvrWLmkuNOf9f2ff1_gARDJ X-Proofpoint-ORIG-GUID: RgVbnw65RNvrWLmkuNOf9f2ff1_gARDJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_14,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 impostorscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401260026 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789123755352132731 X-GMAIL-MSGID: 1789123755352132731 |
Series |
arm64: dts: qcom: sc8280xp-x13s: Enable touchscreen
|
|
Commit Message
Bjorn Andersson
Jan. 26, 2024, 3:55 a.m. UTC
The failing read-test in __i2c_hid_core_probe() determines that there's
nothing connected at the documented address of the touchscreen.
Introduce the 5ms after-power and 200ms after-reset delays found in the
ACPI tables. Also wire up the reset-gpio, for good measure.
Fixes: 32c231385ed4 ("arm64: dts: qcom: sc8280xp: add Lenovo Thinkpad X13s devicetree")
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
---
arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > The failing read-test in __i2c_hid_core_probe() determines that there's > nothing connected at the documented address of the touchscreen. > > Introduce the 5ms after-power and 200ms after-reset delays found in the > ACPI tables. Also wire up the reset-gpio, for good measure. As the supplies for the touchscreen are always on (and left on by the bootloader) it would seem that it is really the addition of the reset gpio which makes things work here. Unless the delay is needed for some other reason. (The power-on delay also looks a bit short compared to what is used for other devices.) Reset support was only recently added with commit 2be404486c05 ("HID: i2c-hid-of: Add reset GPIO support to i2c-hid-of") so we should not backport this one before first determining that. That commit also added a comment in the HID driver about the 'post-reset-deassert-delay-ms' to the driver which should now be removed: /* * Note this is a kernel internal device-property set by x86 platform code, * this MUST not be used in devicetree files without first adding it to * the DT bindings. */ Johan
On Fri, Jan 26, 2024 at 09:12:37AM +0100, Johan Hovold wrote: > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > The failing read-test in __i2c_hid_core_probe() determines that there's > > nothing connected at the documented address of the touchscreen. > > > > Introduce the 5ms after-power and 200ms after-reset delays found in the > > ACPI tables. Also wire up the reset-gpio, for good measure. > > As the supplies for the touchscreen are always on (and left on by the > bootloader) it would seem that it is really the addition of the reset > gpio which makes things work here. Unless the delay is needed for some > other reason. > > (The power-on delay also looks a bit short compared to what is used for > other devices.) > > Reset support was only recently added with commit 2be404486c05 ("HID: > i2c-hid-of: Add reset GPIO support to i2c-hid-of") so we should not > backport this one before first determining that. This comment attracted my attention so I tried booting with each of the three lines individually. On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > + reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; This is not enough, on it's own, to get the touch screen running. I guess that's not so much of a surprise since the rebind-the-driver from userspace trick wouldn't have been touching this reset. > + post-power-on-delay-ms = <5>; This line alone is enough (in v6.7.1). > + post-reset-deassert-delay-ms = <200>; This line alone is also enough! In short it looks like the delays make the difference and, even a short delay, can fix the problem. Of course, regardless of the line-by-line results I also ran with all the changes so, FWIW: Tested-by: Daniel Thompson <daniel.thompson@linaro.org> Daniel.
On Fri, Jan 26, 2024 at 01:02:32PM +0000, Daniel Thompson wrote: > On Fri, Jan 26, 2024 at 09:12:37AM +0100, Johan Hovold wrote: > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > > The failing read-test in __i2c_hid_core_probe() determines that there's > > > nothing connected at the documented address of the touchscreen. > > > > > > Introduce the 5ms after-power and 200ms after-reset delays found in the > > > ACPI tables. Also wire up the reset-gpio, for good measure. > > > > As the supplies for the touchscreen are always on (and left on by the > > bootloader) it would seem that it is really the addition of the reset > > gpio which makes things work here. Unless the delay is needed for some > > other reason. > > > > (The power-on delay also looks a bit short compared to what is used for > > other devices.) > > > > Reset support was only recently added with commit 2be404486c05 ("HID: > > i2c-hid-of: Add reset GPIO support to i2c-hid-of") so we should not > > backport this one before first determining that. > > This comment attracted my attention so I tried booting with each of the > three lines individually. > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > + reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; > > This is not enough, on it's own, to get the touch screen running. > > I guess that's not so much of a surprise since the rebind-the-driver > from userspace trick wouldn't have been touching this reset. Right, I realised that after hitting send. For the record, people have successfully been using the touchpad after forcing the driver to reprobe through sysfs: echo 4-0010 >/sys/bus/i2c/drivers/i2c_hid_of/bind > > + post-power-on-delay-ms = <5>; > > This line alone is enough (in v6.7.1). Thanks for confirming. > > + post-reset-deassert-delay-ms = <200>; > > This line alone is also enough! Yes, the driver honours this delay regardless of whether a reset gpio is defined currently, so this is expected. > In short it looks like the delays make the difference and, even a short > delay, can fix the problem. Right, but since the suppliers are left enabled by the bootloader (and never disabled by the kernel), that only begs the question of why this makes a difference. Without the delay, the other HID devices are probing (successfully) slightly before, but essentially in parallel with the touchscreen while using the same resources. Is that causing trouble somehow? Or is there a bug in the i2c controller driver affecting only this device that can be worked around by adding a delay before the first transfer? Johan
On Fri, Jan 26, 2024 at 03:31:02PM +0100, Johan Hovold wrote: > On Fri, Jan 26, 2024 at 01:02:32PM +0000, Daniel Thompson wrote: > > On Fri, Jan 26, 2024 at 09:12:37AM +0100, Johan Hovold wrote: > > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > > > The failing read-test in __i2c_hid_core_probe() determines that there's > > > > nothing connected at the documented address of the touchscreen. > > > > > > > > Introduce the 5ms after-power and 200ms after-reset delays found in the > > > > ACPI tables. Also wire up the reset-gpio, for good measure. > > > > > > As the supplies for the touchscreen are always on (and left on by the > > > bootloader) it would seem that it is really the addition of the reset > > > gpio which makes things work here. Unless the delay is needed for some > > > other reason. > > > > > > (The power-on delay also looks a bit short compared to what is used for > > > other devices.) > > > > > > Reset support was only recently added with commit 2be404486c05 ("HID: > > > i2c-hid-of: Add reset GPIO support to i2c-hid-of") so we should not > > > backport this one before first determining that. > > > > This comment attracted my attention so I tried booting with each of the > > three lines individually. > > > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > > + reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; > > > > This is not enough, on it's own, to get the touch screen running. > > > > I guess that's not so much of a surprise since the rebind-the-driver > > from userspace trick wouldn't have been touching this reset. > > Right, I realised that after hitting send. > > For the record, people have successfully been using the touchpad after > forcing the driver to reprobe through sysfs: > > echo 4-0010 >/sys/bus/i2c/drivers/i2c_hid_of/bind > > > > + post-power-on-delay-ms = <5>; > > > > This line alone is enough (in v6.7.1). > > Thanks for confirming. > > > > + post-reset-deassert-delay-ms = <200>; > > > > This line alone is also enough! > > Yes, the driver honours this delay regardless of whether a reset gpio is > defined currently, so this is expected. > > > In short it looks like the delays make the difference and, even a short > > delay, can fix the problem. > > Right, but since the suppliers are left enabled by the bootloader (and > never disabled by the kernel), that only begs the question of why this > makes a difference. > You're right, the supply is kept on by other things, so this isn't the problem. > Without the delay, the other HID devices are probing (successfully) > slightly before, but essentially in parallel with the touchscreen while > using the same resources. Is that causing trouble somehow? > The difference to those other HID devices is GPIO 99 - the reset pin, which is configured pull down input from boot - i.e. the chip is held in reset. When the HID device is being probed, pinctrl applies &ts0_default starts driving it high, bringing the device out of reset. But insufficient time is given for the chip to come up so the I2C read fails. If you later try to probe again, 200ms has elapsed since the reset was deasserted (driven high). Regards, Bjorn > Or is there a bug in the i2c controller driver affecting only this > device that can be worked around by adding a delay before the first > transfer? > > Johan
On Fri, Jan 26, 2024 at 01:02:32PM +0000, Daniel Thompson wrote: > On Fri, Jan 26, 2024 at 09:12:37AM +0100, Johan Hovold wrote: > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > > The failing read-test in __i2c_hid_core_probe() determines that there's > > > nothing connected at the documented address of the touchscreen. > > > > > > Introduce the 5ms after-power and 200ms after-reset delays found in the > > > ACPI tables. Also wire up the reset-gpio, for good measure. > > > > As the supplies for the touchscreen are always on (and left on by the > > bootloader) it would seem that it is really the addition of the reset > > gpio which makes things work here. Unless the delay is needed for some > > other reason. > > > > (The power-on delay also looks a bit short compared to what is used for > > other devices.) > > > > Reset support was only recently added with commit 2be404486c05 ("HID: > > i2c-hid-of: Add reset GPIO support to i2c-hid-of") so we should not > > backport this one before first determining that. > > This comment attracted my attention so I tried booting with each of the > three lines individually. > > > On Thu, Jan 25, 2024 at 07:55:14PM -0800, Bjorn Andersson wrote: > > + reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; > > This is not enough, on it's own, to get the touch screen running. > No, because pinctrl already brings the chip out of reset without this. > I guess that's not so much of a surprise since the rebind-the-driver > from userspace trick wouldn't have been touching this reset. > Right, it would just have been left deasserted from the first attempt. That said, the addition of the reset means that we're now asserting reset in such rebind attempts. And as such the post-reset-deassert-delay-ms is now needed between the explicit deassert from the driver and the i2c read. > > > + post-power-on-delay-ms = <5>; > > This line alone is enough (in v6.7.1). > So the delay taken through really_probe() until we reach that i2c read is almost the entire delay needed, on your specific device. > > > + post-reset-deassert-delay-ms = <200>; > > This line alone is also enough! > > In short it looks like the delays make the difference and, even a short > delay, can fix the problem. > > Of course, regardless of the line-by-line results I also ran with all > the changes so, FWIW: > Tested-by: Daniel Thompson <daniel.thompson@linaro.org> > Thanks, Bjorn > > Daniel.
On Fri, Jan 26, 2024 at 06:53:46AM -0800, Bjorn Andersson wrote: > On Fri, Jan 26, 2024 at 03:31:02PM +0100, Johan Hovold wrote: > > On Fri, Jan 26, 2024 at 01:02:32PM +0000, Daniel Thompson wrote: > > > In short it looks like the delays make the difference and, even a short > > > delay, can fix the problem. > > > > Right, but since the suppliers are left enabled by the bootloader (and > > never disabled by the kernel), that only begs the question of why this > > makes a difference. > > You're right, the supply is kept on by other things, so this isn't the > problem. > > > Without the delay, the other HID devices are probing (successfully) > > slightly before, but essentially in parallel with the touchscreen while > > using the same resources. Is that causing trouble somehow? > > The difference to those other HID devices is GPIO 99 - the reset pin, > which is configured pull down input from boot - i.e. the chip is held in > reset. > > When the HID device is being probed, pinctrl applies &ts0_default starts > driving it high, bringing the device out of reset. But insufficient time > is given for the chip to come up so the I2C read fails. Ah, that's it. You should drop that 'output-high' from the pin config as part of this patch to avoid toggling the reset line twice at boot. Looks like we have the same problem on the CRD as well. There the touchscreen still works, possibly because it has been enabled by the boot firmware or simply because that touchscreen can handle a shorter delay. Where exactly did you find those delay values in the ACPI tables? I couldn't seem to find anything in the decompiled DSDT. > If you later try to probe again, 200ms has elapsed since the reset was > deasserted (driven high). Right. Johan
On Fri, Jan 26, 2024 at 05:23:30PM +0100, Johan Hovold wrote: > On Fri, Jan 26, 2024 at 06:53:46AM -0800, Bjorn Andersson wrote: > > On Fri, Jan 26, 2024 at 03:31:02PM +0100, Johan Hovold wrote: > > > On Fri, Jan 26, 2024 at 01:02:32PM +0000, Daniel Thompson wrote: > > > > > In short it looks like the delays make the difference and, even a short > > > > delay, can fix the problem. > > > > > > Right, but since the suppliers are left enabled by the bootloader (and > > > never disabled by the kernel), that only begs the question of why this > > > makes a difference. > > > > You're right, the supply is kept on by other things, so this isn't the > > problem. > > > > > Without the delay, the other HID devices are probing (successfully) > > > slightly before, but essentially in parallel with the touchscreen while > > > using the same resources. Is that causing trouble somehow? > > > > The difference to those other HID devices is GPIO 99 - the reset pin, > > which is configured pull down input from boot - i.e. the chip is held in > > reset. > > > > When the HID device is being probed, pinctrl applies &ts0_default starts > > driving it high, bringing the device out of reset. But insufficient time > > is given for the chip to come up so the I2C read fails. > > Ah, that's it. > > You should drop that 'output-high' from the pin config as part of this > patch to avoid toggling the reset line twice at boot. > Sounds reasonable, let's fix that while we're at it... > Looks like we have the same problem on the CRD as well. There the > touchscreen still works, possibly because it has been enabled by the > boot firmware or simply because that touchscreen can handle a shorter > delay. > I only poke the CRD remotely, forgot that it had touchscreen. Let's bake a patch for that as well... > Where exactly did you find those delay values in the ACPI tables? I > couldn't seem to find anything in the decompiled DSDT. > The PEP sequence for the touchscreen device. Regards, Bjorn > > If you later try to probe again, 200ms has elapsed since the reset was > > deasserted (driven high). > > Right. > > Johan
diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts index def3976bd5bb..d64d0e76c1ea 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts @@ -620,7 +620,6 @@ &i2c4 { status = "okay"; - /* FIXME: verify */ touchscreen@10 { compatible = "hid-over-i2c"; reg = <0x10>; @@ -630,6 +629,11 @@ touchscreen@10 { vdd-supply = <&vreg_misc_3p3>; vddl-supply = <&vreg_s10b>; + reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; + + post-power-on-delay-ms = <5>; + post-reset-deassert-delay-ms = <200>; + pinctrl-names = "default"; pinctrl-0 = <&ts0_default>; };