On Wed, Nov 27, 2019 at 01:09:48PM +0100, Marco Felsch wrote: > It is possible to bring the device into a deep sleep state. To exit this > state the reset or wakeup pin must be toggeled as documented in [1]. > Because of the poor documentation I used the several downstream kernels > [2] and other applications notes [3] to indentify the related registers. > > Furthermore I added the support to disable the device completely. This is > the most effective power-saving mechanism. Disabling the device don't > change the suspend logic because the hibernate mode needs a hardware > reset anyway. > > [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf > [2] https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/input/touchscreen/ft5x_ts.c > https://github.com/Pablito2020/focaltech-touch-driver/blob/master/ft5336_driver.c > [3] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x16_registers.pdf > + /* Recover from hibernate mode if hardware supports it */ > + if (tsdata->wake_gpio) { > + gpiod_set_value_cansleep(tsdata->wake_gpio, 0); > + usleep_range(5000, 6000); > + gpiod_set_value_cansleep(tsdata->wake_gpio, 1); > + msleep(300); > + } else if (tsdata->reset_gpio) { > + gpiod_set_value_cansleep(tsdata->reset_gpio, 1); > + usleep_range(5000, 6000); > + gpiod_set_value_cansleep(tsdata->reset_gpio, 0); > + msleep(300); > + } Perhaps static void edt_ft5x06_ts_toggle_gpio(struct gpio_desc *gpiod) { ... } ...resume(...) { ... if (wake_gpio) ...toggle_gpio(wake_gpio); else if (reset_gpio) ...toggle_gpio(reset_gpio); ... } ? -- With Best Regards, Andy Shevchenko