Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Input: goodix - sync the irq controller while starting firmware
@ 2026-11-24  8:46 Luca Leonardo Scorcia
  2026-11-24 11:21 ` AngeloGioacchino Del Regno
  2026-11-24 18:22 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Luca Leonardo Scorcia @ 2026-11-24  8:46 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Luca Leonardo Scorcia, Hans de Goede, Dmitry Torokhov,
	Matthias Brugger, AngeloGioacchino Del Regno, linux-input,
	linux-kernel, linux-arm-kernel

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.

Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
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/20261020122712.526797-1-l.scorcia@gmail.com/

 drivers/input/touchscreen/goodix_fwupload.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/goodix_fwupload.c b/drivers/input/touchscreen/goodix_fwupload.c
index 888da7538c06..642a632d363c 100644
--- a/drivers/input/touchscreen/goodix_fwupload.c
+++ b/drivers/input/touchscreen/goodix_fwupload.c
@@ -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;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Input: goodix - sync the irq controller while starting firmware
  2026-11-24  8:46 [PATCH v2] Input: goodix - sync the irq controller while starting firmware Luca Leonardo Scorcia
@ 2026-11-24 11:21 ` AngeloGioacchino Del Regno
  2026-11-24 18:22 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-11-24 11:21 UTC (permalink / raw)
  To: Luca Leonardo Scorcia, linux-mediatek
  Cc: Hans de Goede, Dmitry Torokhov, Matthias Brugger, linux-input,
	linux-kernel, linux-arm-kernel

On 11/24/26 09:46, Luca Leonardo Scorcia wrote:
> 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.
> 
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
> 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/20261020122712.526797-1-l.scorcia@gmail.com/
> 
>   drivers/input/touchscreen/goodix_fwupload.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/goodix_fwupload.c b/drivers/input/touchscreen/goodix_fwupload.c
> index 888da7538c06..642a632d363c 100644
> --- a/drivers/input/touchscreen/goodix_fwupload.c
> +++ b/drivers/input/touchscreen/goodix_fwupload.c
> @@ -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;
>   



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Input: goodix - sync the irq controller while starting firmware
  2026-11-24  8:46 [PATCH v2] Input: goodix - sync the irq controller while starting firmware Luca Leonardo Scorcia
  2026-11-24 11:21 ` AngeloGioacchino Del Regno
@ 2026-11-24 18:22 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2026-11-24 18:22 UTC (permalink / raw)
  To: Luca Leonardo Scorcia
  Cc: linux-mediatek, Hans de Goede, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-input, linux-kernel,
	linux-arm-kernel

On Tue, Nov 24, 2026 at 09:46:22AM +0100, Luca Leonardo Scorcia wrote:
> 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.
> 
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>

Applied, thank you.

-- 
Dmitry


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-24 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  8:46 [PATCH v2] Input: goodix - sync the irq controller while starting firmware Luca Leonardo Scorcia
2026-11-24 11:21 ` AngeloGioacchino Del Regno
2026-11-24 18:22 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox