All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Ferruh Yigit <fery@cypress.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Javier Martinez Canillas <javier@dowhile0.org>
Cc: Henrik Rydberg <rydberg@bitmath.org>,
	linux-input@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 5/8 v3] Input: cyttsp - Reduce reset pulse timings
Date: Thu,  8 Apr 2021 15:11:50 +0200	[thread overview]
Message-ID: <20210408131153.3446138-6-linus.walleij@linaro.org> (raw)
In-Reply-To: <20210408131153.3446138-1-linus.walleij@linaro.org>

The data sheet for CY8CTMA340 specifies that the reset pulse
shall be at least 1 ms. Specify 1-2 ms with usleep_range()
to cut some slack for the scheduler.

Curiously the datasheet does not specify how long we have to
wait after a hard reset until the chip is up, but I have found
a vendor tree (Samsung GT-S7710) that has code for this touch
screen and there this is set to 5 ms so I use this with
the same 1 ms fuzz.

Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v3:
- Collect Javier's Reviewed-by
---
 drivers/input/touchscreen/cyttsp_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 91f8f38b3f06..84f4f1c1a220 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -230,10 +230,16 @@ static int cyttsp_set_sysinfo_regs(struct cyttsp *ts)
 static void cyttsp_hard_reset(struct cyttsp *ts)
 {
 	if (ts->reset_gpio) {
+		/*
+		 * According to the CY8CTMA340 datasheet page 21, the external
+		 * reset pulse width should be >= 1 ms. The datasheet does not
+		 * specify how long we have to wait after reset but a vendor
+		 * tree specifies 5 ms here.
+		 */
 		gpiod_set_value_cansleep(ts->reset_gpio, 1);
-		msleep(CY_DELAY_DFLT);
+		usleep_range(1000, 2000);
 		gpiod_set_value_cansleep(ts->reset_gpio, 0);
-		msleep(CY_DELAY_DFLT);
+		usleep_range(5000, 6000);
 	}
 }
 
-- 
2.29.2


  parent reply	other threads:[~2021-04-08 13:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 13:11 [PATCH 0/8 v3] Update CYTTSP driver Linus Walleij
2021-04-08 13:11 ` [PATCH 1/8 v3] Input: cyttsp - Convert bindings to YAML and extend Linus Walleij
2021-04-10  7:44   ` Dmitry Torokhov
2021-04-08 13:11 ` [PATCH 2/8 v3] Input: cyttsp - Probe from compatibles Linus Walleij
2021-04-08 13:11 ` [PATCH 3/8 v3] Input: cyttsp - Obtain regulators Linus Walleij
2021-04-08 13:11 ` [PATCH 4/8 v3] Input: cyttsp - Error message on boot mode exit error Linus Walleij
2021-04-10  7:31   ` Dmitry Torokhov
2021-04-08 13:11 ` Linus Walleij [this message]
2021-04-10  7:32   ` [PATCH 5/8 v3] Input: cyttsp - Reduce reset pulse timings Dmitry Torokhov
2021-04-08 13:11 ` [PATCH 6/8 v3] Input: cyttsp - Drop the phys path Linus Walleij
2021-04-10  7:33   ` Dmitry Torokhov
2021-04-08 13:11 ` [PATCH 7/8 v3] Input: cyttsp - Set abs params for ABS_MT_TOUCH_MAJOR Linus Walleij
2021-04-10  7:34   ` Dmitry Torokhov
2021-04-08 13:11 ` [PATCH 8/8 v3] Input: cyttsp - Flag the device properly Linus Walleij
2021-04-10  7:41   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210408131153.3446138-6-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fery@cypress.com \
    --cc=javier@dowhile0.org \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.