Skip to contentSkip to conversation

Input: goodix - sync the irq controller while starting firmware

PATCH Applied Luca Leonardo Scorcia 4 participants 4 messages Nov 24

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Input: goodix - sync the irq controller while starting firmware

On the Lenovo Tab E7 (TB-7104F), which has a Goodix GT-912 touch screen, the touch screen fails to come online after loading firmware, printing the error "Error reading 1 bytes from 0x8041: -6".

Comparing the upstream code with the Android stock sources, the existing call to goodix_int_sync should be moved between the upload of the firmware and the watchdog restart. With this change the touchscreen is correctly detected and working.

---
Relevant bit of the stock source driver at [1].

Credits for noticing the issue and finding its cause go to matemiller992 on the postmarketOS forums, I cannot provide tags as he wants to stay anonymous.

Patch tested on the Lenovo Tab E7 (TB-7104F).

Changes in v2:
- Instead of adding a second call to goodix_int_sync, move the existing one;
- Simplify the access to the necessary arguments/parameters.

v1: [2]

[1] https://github.com/lscorcia/linux-lenovo-tb7104f/blob/2dad69c9f28611ac6d3db2f1ee11b480a60d83ee/kernel-4.4/drivers/input/touchscreen/mediatek/gt912_p98996/gt9xx_driver.c#L1529
[2] https://lore.kernel.org/linux-mediatek/[email protected]/

 drivers/input/touchscreen/goodix_fwupload.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/input/touchscreen/goodix_fwupload.c +7 -6
index 888da7538c06..642a632d363c 100644
@@ -153,8 +153,9 @@ static int goodix_enter_upload_mode(struct i2c_client *client)
 	return 0;
 }
 
-static int goodix_start_firmware(struct i2c_client *client)
+static int goodix_start_firmware(struct goodix_ts_data *ts)
 {
+	struct i2c_client *client = ts->client;
 	int error;
 	u8 val;
 
@@ -168,6 +169,10 @@ static int goodix_start_firmware(struct i2c_client *client)
 	if (error)
 		return error;
 
+	error = goodix_int_sync(ts);
+	if (error)
+		return error;
+
 	error = goodix_i2c_read(client, GOODIX_REG_SW_WDT, &val, 1);
 	if (error)
 		return error;
@@ -249,11 +254,7 @@ static int goodix_firmware_upload(struct goodix_ts_data *ts)
 	if (error)
 		return error;
 
-	error = goodix_start_firmware(ts->client);
-	if (error)
-		return error;
-
-	error = goodix_int_sync(ts);
+	error = goodix_start_firmware(ts);
 	if (error)
 		return error;
 
Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] Input: goodix - missing Fixes: trailer for commit 09182ed20c04 --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] Input: goodix - missing Fixes: trailer for commit 09182ed20c04 --

commit d918ba5a6383fc7860788d1a29ce075f8dc1159e
Author: Luca Leonardo Scorcia <[email protected]>

Quoted 6 lines

Input: goodix - sync the irq controller while starting firmware

On the Lenovo Tab E7 (TB-7104F), which has a Goodix GT-912 touch screen, the touch screen fails to come online after loading firmware, printing the error "Error reading 1 bytes from 0x8041: -6".

Quoted 6 lines

Comparing the upstream code with the Android stock sources, the existing call to goodix_int_sync should be moved between the upload of the firmware and the watchdog restart. With this change the touchscreen is correctly detected and working.

[Severity: Low]
This fixes the firmware startup sequence introduced when flashless controller support was added. Should it include a Fixes: tag?

Fixes 09182ed20c04 ("Input: goodix - add support for controllers without flash")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Luca Leonardo Scorcia
Quoted 10 lines · Luca Leonardo Scorcia

On the Lenovo Tab E7 (TB-7104F), which has a Goodix GT-912 touch screen, the touch screen fails to come online after loading firmware, printing the error "Error reading 1 bytes from 0x8041: -6".

Comparing the upstream code with the Android stock sources, the existing call to goodix_int_sync should be moved between the upload of the firmware and the watchdog restart. With this change the touchscreen is correctly detected and working.

Quoted 61 lines

---
Relevant bit of the stock source driver at [1].

Credits for noticing the issue and finding its cause go to matemiller992 on the postmarketOS forums, I cannot provide tags as he wants to stay anonymous.

Patch tested on the Lenovo Tab E7 (TB-7104F).

Changes in v2:
- Instead of adding a second call to goodix_int_sync, move the existing one;
- Simplify the access to the necessary arguments/parameters.

v1: [2]

[1] https://github.com/lscorcia/linux-lenovo-tb7104f/blob/2dad69c9f28611ac6d3db2f1ee11b480a60d83ee/kernel-4.4/drivers/input/touchscreen/mediatek/gt912_p98996/gt9xx_driver.c#L1529
[2] https://lore.kernel.org/linux-mediatek/[email protected]/

  drivers/input/touchscreen/goodix_fwupload.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)
drivers/input/touchscreen/goodix_fwupload.c +7 -6
index 888da7538c06..642a632d363c 100644
@@ -153,8 +153,9 @@ static int goodix_enter_upload_mode(struct i2c_client *client)
  	return 0;
  }
 
-static int goodix_start_firmware(struct i2c_client *client)
+static int goodix_start_firmware(struct goodix_ts_data *ts)
  {
+	struct i2c_client *client = ts->client;
  	int error;
  	u8 val;
 
@@ -168,6 +169,10 @@ static int goodix_start_firmware(struct i2c_client *client)
  	if (error)
  		return error;
 
+	error = goodix_int_sync(ts);
+	if (error)
+		return error;
+
  	error = goodix_i2c_read(client, GOODIX_REG_SW_WDT, &val, 1);
  	if (error)
  		return error;
@@ -249,11 +254,7 @@ static int goodix_firmware_upload(struct goodix_ts_data *ts)
  	if (error)
  		return error;
 
-	error = goodix_start_firmware(ts->client);
-	if (error)
-		return error;
-
-	error = goodix_int_sync(ts);
+	error = goodix_start_firmware(ts);
  	if (error)
  		return error;
 
maintainer Applied
#3 lore raw
In reply to Luca Leonardo Scorcia
Quoted 10 lines · Luca Leonardo Scorcia

On the Lenovo Tab E7 (TB-7104F), which has a Goodix GT-912 touch screen, the touch screen fails to come online after loading firmware, printing the error "Error reading 1 bytes from 0x8041: -6".

Comparing the upstream code with the Android stock sources, the existing call to goodix_int_sync should be moved between the upload of the firmware and the watchdog restart. With this change the touchscreen is correctly detected and working.

Applied, thank you.

Signature · 1 line
Dmitry