All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yunlong Jia <yunlong.jia@ecs.corp-partner.google.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Henry Sun <henrysun@google.com>,
	Douglas Anderson <dianders@chromium.org>,
	Bob Moragues <moragues@chromium.org>,
	Yunlong Jia <yunlong.jia@ecs.com.tw>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Johnny Chuang <johnny.chuang.emc@gmail.com>,
	linux-input@vger.kernel.org
Subject: [PATCH v3 2/2] input: touchscreen: elants_i2c: Add eth3915n touchscreen chip
Date: Fri,  9 Sep 2022 10:27:55 +0000	[thread overview]
Message-ID: <20220909102720.v3.2.I22ae48d8ee064456073a828393704809360c4368@changeid> (raw)
In-Reply-To: <20220909102720.v3.1.Ib599a6001558a4afd11016e7016d74dce748a749@changeid>

The eth3915n requires more delay time than the eth3500 when poweron
 & reset.
Define EKTH3915_POWERON_DELAY_MSEC as the poweron delay time of eth3915n,
 about 80ms.
Define EKTH3915_RESET_DELAY_MSEC as the reset delay time of eth3915n,
 about 300ms.

Signed-off-by: Yunlong Jia <yunlong.jia@ecs.com.tw>
Reviewed-by: Douglas Anderson <dianders@chromium.org>

---

Changes in v3:
 1. Add poweron delay time.

Changes in v2:
 1. Adjust the 'Signed-off-by'.

 drivers/input/touchscreen/elants_i2c.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index c9dd703b0c7d8..fb99dd10b0b6d 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -116,6 +116,8 @@
 
 #define ELAN_POWERON_DELAY_USEC	500
 #define ELAN_RESET_DELAY_MSEC	20
+#define EKTH3915_POWERON_DELAY_MSEC    80
+#define EKTH3915_RESET_DELAY_MSEC	300
 
 /* FW boot code version */
 #define BC_VER_H_BYTE_FOR_EKTH3900x1_I2C        0x72
@@ -133,6 +135,7 @@
 enum elants_chip_id {
 	EKTH3500,
 	EKTF3624,
+	EKTH3915,
 };
 
 enum elants_state {
@@ -664,6 +667,7 @@ static int elants_i2c_initialize(struct elants_data *ts)
 
 	switch (ts->chip_id) {
 	case EKTH3500:
+	case EKTH3915:
 		if (!error)
 			error = elants_i2c_query_ts_info_ekth(ts);
 		break;
@@ -1331,6 +1335,9 @@ static int elants_i2c_power_on(struct elants_data *ts)
 	if (IS_ERR_OR_NULL(ts->reset_gpio))
 		return 0;
 
+	if (ts->chip_id == EKTH3915)
+		msleep(EKTH3915_POWERON_DELAY_MSEC);
+
 	gpiod_set_value_cansleep(ts->reset_gpio, 1);
 
 	error = regulator_enable(ts->vcc33);
@@ -1361,7 +1368,17 @@ static int elants_i2c_power_on(struct elants_data *ts)
 	if (error)
 		return error;
 
-	msleep(ELAN_RESET_DELAY_MSEC);
+	if (ts->chip_id == EKTH3915)
+		/*
+		 * There need delay 300ms for power on sequence.
+		 * T1 + T2 + T3 >= 305 ms
+		 * T1: 0<time<500us
+		 * T2: >5ms
+		 * T3: >300ms
+		 */
+		msleep(EKTH3915_RESET_DELAY_MSEC);
+	else
+		msleep(ELAN_RESET_DELAY_MSEC);
 
 	return 0;
 }
@@ -1686,6 +1703,7 @@ static const struct i2c_device_id elants_i2c_id[] = {
 	{ DEVICE_NAME, EKTH3500 },
 	{ "ekth3500", EKTH3500 },
 	{ "ektf3624", EKTF3624 },
+	{ "ekth3915", EKTH3915 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, elants_i2c_id);
@@ -1702,6 +1720,7 @@ MODULE_DEVICE_TABLE(acpi, elants_acpi_id);
 static const struct of_device_id elants_of_match[] = {
 	{ .compatible = "elan,ekth3500", .data = (void *)EKTH3500 },
 	{ .compatible = "elan,ektf3624", .data = (void *)EKTF3624 },
+	{ .compatible = "elan,ekth3915", .data = (void *)EKTH3915 },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, elants_of_match);
-- 
2.17.1


  reply	other threads:[~2022-09-09 10:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 10:27 [PATCH v3 1/2] dt-bindings: input: touchscreen: elants_i2c: Add eth3915n touchscreen chip Yunlong Jia
2022-09-09 10:27 ` Yunlong Jia [this message]
2022-09-10 21:53   ` [PATCH v3 2/2] " Doug Anderson
2022-09-20  4:19   ` Dmitry Torokhov
     [not found]     ` <CAFvdKjuBFoKXmU9zN8vQ65LT3=MMX-_3vhay16uhN3Z05QN6eA@mail.gmail.com>
2022-09-20 14:24       ` Doug Anderson
2022-09-10 21:52 ` [PATCH v3 1/2] dt-bindings: " Doug Anderson

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=20220909102720.v3.2.I22ae48d8ee064456073a828393704809360c4368@changeid \
    --to=yunlong.jia@ecs.corp-partner.google.com \
    --cc=dianders@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=henrysun@google.com \
    --cc=johnny.chuang.emc@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moragues@chromium.org \
    --cc=yunlong.jia@ecs.com.tw \
    /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.