Skip to content

Commit 9e1f2d7

Browse files
jwrdegoededtor
authored andcommitted
Input: goodix - try to reset the controller if the i2c-test fails
On some ACPI/x86 devices (where we use one of the ACPI IRQ pin access methods) the firmware is buggy, it does not properly reset the controller at boot, and we cannot communicate with it. Normally on ACPI/x86 devices we do not want to reset the controller at probe time since in some cases this causes the controller to loose its configuration and this is loaded into it by the system's firmware. So on these systems we leave the reset_controller_at_probe flag unset, even though we have a access to both the IRQ and reset pins and thus could reset it. In the case of the buggy firmware we have to reset the controller to actually be able to talk to it. This commit adds a special case for this, if the goodix_i2c_test() fails, and we have not reset the controller yet; and we do have a way to reset the controller then retry the i2c-test after resetting the controller. This fixes the driver failing at probe on ACPI/x86 systems with this firmware bug. Reported-and-tested-by: Dmitry Mastykin <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 273ec6b commit 9e1f2d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/input/touchscreen/goodix.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ static int goodix_ts_probe(struct i2c_client *client,
11591159
if (error)
11601160
return error;
11611161

1162+
reset:
11621163
if (ts->reset_controller_at_probe) {
11631164
/* reset the controller */
11641165
error = goodix_reset(ts);
@@ -1170,6 +1171,12 @@ static int goodix_ts_probe(struct i2c_client *client,
11701171

11711172
error = goodix_i2c_test(client);
11721173
if (error) {
1174+
if (!ts->reset_controller_at_probe &&
1175+
ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) {
1176+
/* Retry after a controller reset */
1177+
ts->reset_controller_at_probe = true;
1178+
goto reset;
1179+
}
11731180
dev_err(&client->dev, "I2C communication failure: %d\n", error);
11741181
return error;
11751182
}

0 commit comments

Comments
 (0)