]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Input: goodix - disable IRQs while suspended
authorHans de Goede <hdegoede@redhat.com>
Fri, 12 Jan 2018 08:36:48 +0000 (00:36 -0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 12 Apr 2018 13:06:41 +0000 (10:06 -0300)
BugLink: http://bugs.launchpad.net/bugs/1763366
[ Upstream commit faec44b6838312484d63e82286087cf2d5ebb891 ]

We should not try to do any i2c transfers before the controller is
resumed (which happens before our resume method gets called).

So we need to disable our IRQ while suspended to enforce this. The
code paths for devices with GPIOs for the int and reset pins already
disable the IRQ the through goodix_free_irq().

This commit also disables the IRQ while suspended for devices without
GPIOs for the int and reset pins.

This fixes the i2c bus sometimes getting stuck after a suspend/resume
causing the touchscreen to sometimes not work after a suspend/resume.
This has been tested on a GPD pocked device.

BugLink: https://github.com/nexus511/gpd-ubuntu-packages/issues/10
BugLink: https://www.reddit.com/r/GPDPocket/comments/7niut2/fix_for_broken_touch_after_resume_all_linux/
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/input/touchscreen/goodix.c

index 69d0b8cbc71f8cab52d83a4ca411bd9b4eb1d670..ecec8eb17f28bf8aa8c44ebffd63572a7528a214 100644 (file)
@@ -878,8 +878,10 @@ static int __maybe_unused goodix_suspend(struct device *dev)
        int error;
 
        /* We need gpio pins to suspend/resume */
-       if (!ts->gpiod_int || !ts->gpiod_rst)
+       if (!ts->gpiod_int || !ts->gpiod_rst) {
+               disable_irq(client->irq);
                return 0;
+       }
 
        wait_for_completion(&ts->firmware_loading_complete);
 
@@ -919,8 +921,10 @@ static int __maybe_unused goodix_resume(struct device *dev)
        struct goodix_ts_data *ts = i2c_get_clientdata(client);
        int error;
 
-       if (!ts->gpiod_int || !ts->gpiod_rst)
+       if (!ts->gpiod_int || !ts->gpiod_rst) {
+               enable_irq(client->irq);
                return 0;
+       }
 
        /*
         * Exit sleep mode by outputting HIGH level to INT pin