Skip to contentSkip to conversation

Input: ili210x - Fix reset timing

PATCH Superseded Marek Vasut 3 participants 4 messages May 18, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: ili210x - Fix reset timing

According to Ilitek "231x & ILI251x Programming Guide" Version: 2.30 "2.1. Power Sequence", "T4 Chip Reset and discharge time" is minimum 10ms and "T2 Chip initial time" is maximum 150ms. Adjust the reset timings such that T4 is 15ms and T2 is 160ms to fit those figures.

This prevents sporadic touch controller start up failures when some systems with at least ILI251x controller boot, without this patch the systems sometimes fail to communicate with the touch controller.

Fixes 201f3c803544c ("Input: ili210x - add reset GPIO support")
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/ili210x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ili210x.c +2 -2
index 2bd407d86bae5..131cb648a82ae 100644
@@ -951,9 +951,9 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		if (error)
 			return error;
 
-		usleep_range(50, 100);
+		msleep(15);
 		gpiod_set_value_cansleep(reset_gpio, 0);
-		msleep(100);
+		msleep(160);
 	}
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 35 lines · Marek Vasut

According to Ilitek "231x & ILI251x Programming Guide" Version: 2.30 "2.1. Power Sequence", "T4 Chip Reset and discharge time" is minimum 10ms and "T2 Chip initial time" is maximum 150ms. Adjust the reset timings such that T4 is 15ms and T2 is 160ms to fit those figures.

This prevents sporadic touch controller start up failures when some systems with at least ILI251x controller boot, without this patch the systems sometimes fail to communicate with the touch controller.

Fixes 201f3c803544c ("Input: ili210x - add reset GPIO support")
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/ili210x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ili210x.c +2 -2
index 2bd407d86bae5..131cb648a82ae 100644
@@ -951,9 +951,9 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		if (error)
 			return error;
 
-		usleep_range(50, 100);
+		msleep(15);
 		gpiod_set_value_cansleep(reset_gpio, 0);
-		msleep(100);
+		msleep(160);
 	}
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Signature · 1 line
2.35.1

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

maintainer
#2 lore raw
In reply to Marek Vasut
Quoted 21 lines · Marek Vasut

According to Ilitek "231x & ILI251x Programming Guide" Version: 2.30 "2.1. Power Sequence", "T4 Chip Reset and discharge time" is minimum 10ms and "T2 Chip initial time" is maximum 150ms. Adjust the reset timings such that T4 is 15ms and T2 is 160ms to fit those figures.

This prevents sporadic touch controller start up failures when some systems with at least ILI251x controller boot, without this patch the systems sometimes fail to communicate with the touch controller.

Fixes 201f3c803544c ("Input: ili210x - add reset GPIO support")
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/ili210x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ili210x.c +0 -0
index 2bd407d86bae5..131cb648a82ae 100644

drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 954

Quoted 5 lines
drivers/input/touchscreen/ili210x.c +1 -1
@@ -951,9 +951,9 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		if (error)
 			return error;
 
-		usleep_range(50, 100);
+		msleep(15);

WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst
#38: FILE: drivers/input/touchscreen/ili210x.c:954:
+ msleep(15);

Should this be usleep_range(10000, 15000) like in ili251x_hardware_reset()? Actually, should we adopt ili251x_hardware_reset() to be used there?

Quoted 9 lines
drivers/input/touchscreen/ili210x.c +1 -1
 		gpiod_set_value_cansleep(reset_gpio, 0);
-		msleep(100);
+		msleep(160);
 	}
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Signature · 1 line
2.35.1

Thanks.

Signature · 1 line
Dmitry
#3 lore raw
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Marek Vasut

According to Ilitek "231x & ILI251x Programming Guide" Version: 2.30 "2.1. Power Sequence", "T4 Chip Reset and discharge time" is minimum 10ms and "T2 Chip initial time" is maximum 150ms. Adjust the reset timings such that T4 is 15ms and T2 is 160ms to fit those figures.

This prevents sporadic touch controller start up failures when some systems with at least ILI251x controller boot, without this patch the systems sometimes fail to communicate with the touch controller.

Fixes 201f3c803544c ("Input: ili210x - add reset GPIO support")
Cc Dmitry Torokhov <[email protected]>
---
  drivers/input/touchscreen/ili210x.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ili210x.c +0 -0
index 2bd407d86bae5..131cb648a82ae 100644
@@ -951,9 +951,9 @@ static int ili210x_i2c_probe(struct i2c_client *client,
  		if (error)
  			return error;
 
Quoted 7 lines

drivers/input/touchscreen/ili210x.c static int ili210x_i2c_probe(struct i2c_client *client, · line 954

Quoted 2 lines
drivers/input/touchscreen/ili210x.c +1 -1
-		usleep_range(50, 100);
+		msleep(15);

WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst
#38: FILE: drivers/input/touchscreen/ili210x.c:954:
+ msleep(15);

Sigh, yes, fixed in V2 to be 12..15ms .

Quoted 3 lines

Should this be usleep_range(10000, 15000) like in ili251x_hardware_reset()? Actually, should we adopt ili251x_hardware_reset() to be used there?

I'll send a separate patch for that, it is indeed a good idea, but I think we should keep the fix as simple as possible for backporting ?