Wakeup CPU from suspend with touchscreen

Hello Toradex team,

In our application, the CPU will be in suspend to RAM mode and will wake up from GPIO input, but in fact what we want is to wakeup from screen touch. At the moment we are using imx8mm and toradex 10" cap display with LVDS module.
Is there any way we can wake up the CPU using the touch screen? Using INT pin, maybe some i2c interrupts? Not sure what can be done here.

Regards,

Hi @peterz

Unfortuantely, we (nor the upstream kernel) do not support this use case. You would have to modify the touch driver to make this work. First, you would have to mark the device as wakeup-source in the device tree overlay:

&atmel_mxt_ts {
	wakeup-source;
	status = "okay";
};

The patch for the driver would look most likely as follows (untestet):

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 542a31448c8f..a5579c36bb0a 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3387,6 +3387,11 @@ static int mxt_suspend(struct device *dev)
        if (!input_dev)
                return 0;

+       if (data->irq > 0 && device_may_wakeup(dev)) {
+               enable_irq_wake(data->irq);
+               return 0;
+       }
+
        mutex_lock(&input_dev->mutex);

        if (input_device_enabled(input_dev))
@@ -3408,6 +3413,11 @@ static int mxt_resume(struct device *dev)
        if (!input_dev)
                return 0;

+       if (data->irq > 0 && device_may_wakeup(dev)) {
+               disable_irq_wake(data->irq);
+               return 0;
+       }
+
        enable_irq(data->irq);

        mutex_lock(&input_dev->mutex);

With the modified kernel and device tree overlay, it should be possible to wakeup the device with the interrupt pin. Does this information help you?

Regards,
Stefan