aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/goodix.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2020-03-24 11:37:23 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2020-03-24 15:07:59 -0700
commit9e1f2d70ec3998e6d9948f8ac616db21fa4243d5 (patch)
treeeb2e6fb50d6e447f2ce4aebe1e714b7d387b9b6e /drivers/input/touchscreen/goodix.c
parentInput: goodix - restore config on resume if necessary (diff)
downloadlinux-dev-9e1f2d70ec3998e6d9948f8ac616db21fa4243d5.tar.xz
linux-dev-9e1f2d70ec3998e6d9948f8ac616db21fa4243d5.zip
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 <dmastykin@astralinux.ru> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20200311191013.10826-2-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/goodix.c')
-rw-r--r--drivers/input/touchscreen/goodix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 7811500ba3b5..99a88bd3d212 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -1159,6 +1159,7 @@ static int goodix_ts_probe(struct i2c_client *client,
if (error)
return error;
+reset:
if (ts->reset_controller_at_probe) {
/* reset the controller */
error = goodix_reset(ts);
@@ -1170,6 +1171,12 @@ static int goodix_ts_probe(struct i2c_client *client,
error = goodix_i2c_test(client);
if (error) {
+ if (!ts->reset_controller_at_probe &&
+ ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) {
+ /* Retry after a controller reset */
+ ts->reset_controller_at_probe = true;
+ goto reset;
+ }
dev_err(&client->dev, "I2C communication failure: %d\n", error);
return error;
}