Message ID | 20221208111910.5.I6edfb3f459662c041563a54e5b7df727c27caaba@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp379804wrr; Thu, 8 Dec 2022 11:24:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf44foj57+0KeaDcMu6e4HrfPwFf88thKsWyeff3z6o6AsQ98tBEUkkOUuPy8P4CAO5rQ4/+ X-Received: by 2002:a63:5d55:0:b0:46e:fd0a:fe7a with SMTP id o21-20020a635d55000000b0046efd0afe7amr70240863pgm.59.1670527441105; Thu, 08 Dec 2022 11:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670527441; cv=none; d=google.com; s=arc-20160816; b=bFlzqZv2QYqKxBBa0/MQUKf9GwAqGWhVjYAdFw6klqLD14cJYjnjbwxIo4sQhgN13X l8jwuquqGtyfN9Tt9qSzUj8KId8GWfzOuPH82fjGIPpeoE3FiagKA8Pwcc2yC4N2N19F OAGBdih4UiN6wJo8t/DKYsTGqLgsdVnIaQeUmuK0o5uG2PW+ABOORaari8aF836a4qsH rShWifBxbCFgHOMjhcsaFgiM7DpqncAR/7N8AsKN02tWdneX8k6DJOCZCEM9JPRQV9Hg 6mg4GfPbp5QXTDQyY22WAiY77sLTDXubgYz9bka+DrqBbu5gqZE6e7c/jO0WbqEBzsYM ZfKQ== 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 :dkim-signature; bh=qBUYq/f5W1QpvWQ1L0owj+9liBAfVOZ5HyYf2BUvGw4=; b=MRtCVYQqLOZVTR3LjX7MjdadG044mprkyQi8Uk3oJSRpB/ERJVAgkLI2d1cNkfo/l0 EgqoDzeVMgUTvrQ1Y3WR7dGyW+ut83OWnoE8+UFZNeipuvM5mHMwtDzGSWRXa6F9xvm8 Fd9dOmFZ7uac8/ho3a6CngT1DIehMtdvpUBlQDf4+VqF/qIgAzO9nPP6d+r9MatMQKxE mIJ4p6DxiAnaWLHxheFbImh6w8TEeWWTpPH+Uv8k7a5JOWGTvwYGC2UFPzAkUN9Vajfr MsvU7PcQp3/pd/Wjihm445k0LH8jF5y8c0TYtPr6VTvXypwoeqoQmCMXjW8z93datQT3 GpYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yq20ujLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb12-20020a17090b35cc00b00200b014d2adsi16111pjb.26.2022.12.08.11.23.47; Thu, 08 Dec 2022 11:24:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yq20ujLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiLHTVU (ORCPT <rfc822;foxyelen666@gmail.com> + 99 others); Thu, 8 Dec 2022 14:21:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiLHTUx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Dec 2022 14:20:53 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02509B285 for <linux-kernel@vger.kernel.org>; Thu, 8 Dec 2022 11:20:38 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id e7-20020a17090a77c700b00216928a3917so5677247pjs.4 for <linux-kernel@vger.kernel.org>; Thu, 08 Dec 2022 11:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qBUYq/f5W1QpvWQ1L0owj+9liBAfVOZ5HyYf2BUvGw4=; b=Yq20ujLHdDmxfsm6nXV56O+R5s3byqsOzEHjK+WiS1J/KE/7s2Me27w3dKPKEBUPXj EBxaZvKRup2jGETzG6pHkC4C/xO67Cr3V2UFuWIZ7iYRcD+t8/x/7b6NpJY4r9h9ugBF i2f52c853182eqqlzGcIlS/0+SsTPdNlNu2oo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qBUYq/f5W1QpvWQ1L0owj+9liBAfVOZ5HyYf2BUvGw4=; b=I78WiK6/M0LGLVRGDkR8zFF+FbSwj32YoUrhVmdmNiYbwgu5n/etfcu8dAaRnx7q9C 8GBPpizXpzjd1/NDhTof9ut+h4sWyVvlzIFxcEEcAZeTNXSQaWofs+Pw/etUTuBdlxf5 zrGwsIBHg3fuuTR5ClF3O+bDNrUUPW8lFDkD7OgAkQw2JIIXBNgDmR/g2r65jHJT4SkN f4AtIQfwVDZeQJASWOIZzlTeOfXBMT0Mz+M0fVoD6akNHVWdVuFLVVF/iNq6MciGS66W CgDJ3vJw+LMLHqZjRjsgHwqQNeT3+A6m2MZ3KUmLGSWVHX4K1VAXcczheyzT8ghgT3oX VAZw== X-Gm-Message-State: ANoB5pmQfvaBVqQ1y9GoYaWgi+ivK2bnmh+bX+hIXnufwRpG35NjC3LI cwEnectNCQjYMsO79mOjWjsIaw== X-Received: by 2002:a17:903:40cf:b0:189:ccb2:f20a with SMTP id t15-20020a17090340cf00b00189ccb2f20amr3555544pld.49.1670527238392; Thu, 08 Dec 2022 11:20:38 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:3aa1:2c62:9ac:4468]) by smtp.gmail.com with ESMTPSA id u5-20020a170902e5c500b00186a2274382sm17112019plf.76.2022.12.08.11.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 11:20:37 -0800 (PST) From: Douglas Anderson <dianders@chromium.org> To: Bjorn Andersson <andersson@kernel.org>, Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: mka@chromium.org, swboyd@chromium.org, linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org, Yunlong Jia <ecs.beijing2022@gmail.com>, Konrad Dybcio <konrad.dybcio@linaro.org>, Douglas Anderson <dianders@chromium.org>, Johnny Chuang <johnny.chuang.emc@gmail.com>, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] Input: elants_i2c: Delay longer with reset asserted Date: Thu, 8 Dec 2022 11:20:06 -0800 Message-Id: <20221208111910.5.I6edfb3f459662c041563a54e5b7df727c27caaba@changeid> X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog In-Reply-To: <20221208192006.1070898-1-dianders@chromium.org> References: <20221208192006.1070898-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751674982030311079?= X-GMAIL-MSGID: =?utf-8?q?1751674982030311079?= |
Series |
arm64: dts: qcom: sc7180: Make pazquel360's touchscreen work
|
|
Commit Message
Doug Anderson
Dec. 8, 2022, 7:20 p.m. UTC
The elan touchscreen datasheet says that the reset GPIO only needs to
be asserted for 500us in order to reset the regulator. The problem is
that some boards need a level shifter between the signals on the GPIO
controller and the signals on the touchscreen. All of these extra
components on the line can slow the transition of the signals. On one
board, we measured the reset line and saw that it took almost 1.8ms to
go low. Even after we bumped up the "drive strength" of the signal
from the default 2mA to 8mA we still saw it take 421us for the signal
to go low.
In order to account for this we let's lengthen the amount of time that
we keep the reset asserted. Let's bump it up from 500us to 5000us.
That's still a relatively short amount of time and is much safer.
It should be noted that this fixes real problems. Case in point:
1. The touchscreen power rail may be shared with another device (like
an eDP panel). That means that at probe time power might already be
on.
2. In probe we grab the reset GPIO and assert it (make it low).
3. We turn on power (a noop since it was already on).
4. We wait 500us.
5. We deassert the reset GPIO.
With the above case and only a 500us delay we saw only a partial reset
asserted, which is bad. Giving it 5ms is overkill but feels safer in
case someone else has a different level shifter setup.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
drivers/input/touchscreen/elants_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Dec 08, 2022 at 11:20:06AM -0800, Douglas Anderson wrote: > The elan touchscreen datasheet says that the reset GPIO only needs to > be asserted for 500us in order to reset the regulator. The problem is > that some boards need a level shifter between the signals on the GPIO > controller and the signals on the touchscreen. All of these extra > components on the line can slow the transition of the signals. On one > board, we measured the reset line and saw that it took almost 1.8ms to > go low. Even after we bumped up the "drive strength" of the signal > from the default 2mA to 8mA we still saw it take 421us for the signal > to go low. > > In order to account for this we let's lengthen the amount of time that nit: s/we let's/we/ || s/we let's/let's/ no need to re-spin just for this > we keep the reset asserted. Let's bump it up from 500us to 5000us. > That's still a relatively short amount of time and is much safer. > > It should be noted that this fixes real problems. Case in point: > 1. The touchscreen power rail may be shared with another device (like > an eDP panel). That means that at probe time power might already be > on. > 2. In probe we grab the reset GPIO and assert it (make it low). > 3. We turn on power (a noop since it was already on). > 4. We wait 500us. > 5. We deassert the reset GPIO. > > With the above case and only a 500us delay we saw only a partial reset > asserted, which is bad. Giving it 5ms is overkill but feels safer in > case someone else has a different level shifter setup. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
On Thu, Dec 08, 2022 at 11:20:06AM -0800, Douglas Anderson wrote: > The elan touchscreen datasheet says that the reset GPIO only needs to > be asserted for 500us in order to reset the regulator. The problem is > that some boards need a level shifter between the signals on the GPIO > controller and the signals on the touchscreen. All of these extra > components on the line can slow the transition of the signals. On one > board, we measured the reset line and saw that it took almost 1.8ms to > go low. Even after we bumped up the "drive strength" of the signal > from the default 2mA to 8mA we still saw it take 421us for the signal > to go low. > > In order to account for this we let's lengthen the amount of time that > we keep the reset asserted. Let's bump it up from 500us to 5000us. > That's still a relatively short amount of time and is much safer. > > It should be noted that this fixes real problems. Case in point: > 1. The touchscreen power rail may be shared with another device (like > an eDP panel). That means that at probe time power might already be > on. > 2. In probe we grab the reset GPIO and assert it (make it low). > 3. We turn on power (a noop since it was already on). > 4. We wait 500us. > 5. We deassert the reset GPIO. > > With the above case and only a 500us delay we saw only a partial reset > asserted, which is bad. Giving it 5ms is overkill but feels safer in > case someone else has a different level shifter setup. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> Applied, thank you.
Hi Douglas, I love your patch! Yet something to improve: [auto build test ERROR on next-20221208] [cannot apply to robh/for-next dtor-input/next dtor-input/for-linus hid/for-next v6.1-rc8 v6.1-rc7 v6.1-rc6 linus/master v6.1-rc8] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Douglas-Anderson/arm64-dts-qcom-sc7180-Make-pazquel360-s-touchscreen-work/20221209-032214 patch link: https://lore.kernel.org/r/20221208111910.5.I6edfb3f459662c041563a54e5b7df727c27caaba%40changeid patch subject: [PATCH 5/5] Input: elants_i2c: Delay longer with reset asserted config: arm-randconfig-r046-20221207 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/intel-lab-lkp/linux/commit/8e4ac288d13f505629004cb39e1621bcf877b8a3 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Douglas-Anderson/arm64-dts-qcom-sc7180-Make-pazquel360-s-touchscreen-work/20221209-032214 git checkout 8e4ac288d13f505629004cb39e1621bcf877b8a3 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: __bad_udelay >>> referenced by elants_i2c.c >>> drivers/input/touchscreen/elants_i2c.o:(elants_i2c_power_on) in archive vmlinux.a
On Thu, Dec 08, 2022 at 05:38:28PM -0800, Dmitry Torokhov wrote: > On Thu, Dec 08, 2022 at 11:20:06AM -0800, Douglas Anderson wrote: > > The elan touchscreen datasheet says that the reset GPIO only needs to > > be asserted for 500us in order to reset the regulator. The problem is > > that some boards need a level shifter between the signals on the GPIO > > controller and the signals on the touchscreen. All of these extra > > components on the line can slow the transition of the signals. On one > > board, we measured the reset line and saw that it took almost 1.8ms to > > go low. Even after we bumped up the "drive strength" of the signal > > from the default 2mA to 8mA we still saw it take 421us for the signal > > to go low. > > > > In order to account for this we let's lengthen the amount of time that > > we keep the reset asserted. Let's bump it up from 500us to 5000us. > > That's still a relatively short amount of time and is much safer. > > > > It should be noted that this fixes real problems. Case in point: > > 1. The touchscreen power rail may be shared with another device (like > > an eDP panel). That means that at probe time power might already be > > on. > > 2. In probe we grab the reset GPIO and assert it (make it low). > > 3. We turn on power (a noop since it was already on). > > 4. We wait 500us. > > 5. We deassert the reset GPIO. > > > > With the above case and only a 500us delay we saw only a partial reset > > asserted, which is bad. Giving it 5ms is overkill but feels safer in > > case someone else has a different level shifter setup. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > Applied, thank you. Unapplied ;) I guess we should follow kernel test robot's advise and switch to using usleep_range().
Hi, On Thu, Dec 8, 2022 at 5:48 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > > On Thu, Dec 08, 2022 at 05:38:28PM -0800, Dmitry Torokhov wrote: > > On Thu, Dec 08, 2022 at 11:20:06AM -0800, Douglas Anderson wrote: > > > The elan touchscreen datasheet says that the reset GPIO only needs to > > > be asserted for 500us in order to reset the regulator. The problem is > > > that some boards need a level shifter between the signals on the GPIO > > > controller and the signals on the touchscreen. All of these extra > > > components on the line can slow the transition of the signals. On one > > > board, we measured the reset line and saw that it took almost 1.8ms to > > > go low. Even after we bumped up the "drive strength" of the signal > > > from the default 2mA to 8mA we still saw it take 421us for the signal > > > to go low. > > > > > > In order to account for this we let's lengthen the amount of time that > > > we keep the reset asserted. Let's bump it up from 500us to 5000us. > > > That's still a relatively short amount of time and is much safer. > > > > > > It should be noted that this fixes real problems. Case in point: > > > 1. The touchscreen power rail may be shared with another device (like > > > an eDP panel). That means that at probe time power might already be > > > on. > > > 2. In probe we grab the reset GPIO and assert it (make it low). > > > 3. We turn on power (a noop since it was already on). > > > 4. We wait 500us. > > > 5. We deassert the reset GPIO. > > > > > > With the above case and only a 500us delay we saw only a partial reset > > > asserted, which is bad. Giving it 5ms is overkill but feels safer in > > > case someone else has a different level shifter setup. > > > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > > > Applied, thank you. > > Unapplied ;) I guess we should follow kernel test robot's advise and > switch to using usleep_range(). Crud. I'll send a v2 right away. -Doug
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 879a4d984c90..377adf89b25c 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -114,7 +114,7 @@ /* calibration timeout definition */ #define ELAN_CALI_TIMEOUT_MSEC 12000 -#define ELAN_POWERON_DELAY_USEC 500 +#define ELAN_POWERON_DELAY_USEC 5000 #define ELAN_RESET_DELAY_MSEC 20 /* FW boot code version */