Touchscreen wakeup on iMX6ULL?

Hello! Is it possible to use the touchscreen as a wakeup source from sleep on the iMX6ULL running Linux/Ångström OS or Torizon? If so, then how? If not, then what wakeup sources are available and how can they be configured?

Thank you, Cristian M.

Greetings @CristianM!

Please take a look at the Linux kernel documentation for wakeup sources here: https://www.kernel.org/doc/Documentation/devicetree/bindings/power/wakeup-source.txt.

The wakeup-source device tree property specifies wakeup capabilities for devices so you can try adding that to your touchscreen driver node.

On our embedded Linux BSP you’ll have to modify the device tree, recompile and replace it. On Torizon, you should be able to do this with Device Tree Overlays using the Torizon Developer Tools container image.
Please note that Torizon support for the Colibri iMX6ULL is experimental due to the smaller storage. The recommended way to go on this module is using our embedded Linux BSP.

Thank you. I will try once I will receive the board and let you know.

@CristianM,

Please let us know your results.

I’ve also edited my answer to clarify about the Torizon support for the Colibri iMX6ULL, please make sure to consider that.

I’ve added that property to the touchscreen controller node, as seen below (I’ve modified the imx6ull-colibri-aster.dtsi file). I am using the Toradex 7 inch capacitive touchscreen, Aster carrier board and Linux BSP 5 (tdx-reference-multimedia-image - tdx-X11 image).

&i2c1 {
	pinctrl-names = "default", "gpio";
	pinctrl-0 = <&pinctrl_i2c1>;
	pinctrl-1 = <&pinctrl_i2c1_gpio>;
	sda-gpios = <&gpio1 29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	scl-gpios = <&gpio1 28 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	status = "okay";

	/* Atmel maxtouch controller */
	atmel_mxt_ts: atmel_mxt_ts@4a {
		compatible = "atmel,maxtouch";
		reg = <0x4a>;
		interrupt-parent = <&gpio5>;
		interrupts = <4 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 107 */
		reset-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; /* SODIMM 106 */
		wakeup-source;
		status = "okay";
	};

	/* M41T0M6 real time clock on carrier board */
	rtc: m41t0m6@68 {
		compatible = "st,m41t0";
		reg = <0x68>;
	};
};

However, the device does not wake up from sleep when touching the screen.

Do you have any suggestions?

@CristianM,

Can you please check if the correct device tree file is being used? How did you update your device tree?

Also, can you show the output /sys/kernel/debug/gpio? Your interrupt pin should appear there as a wakeup source.

I have modified the imx6ull-colibri-aster.dtsi file and compiled with the command make imx6ull-colibri-wifi-aster.dtb. I copied the file to the board and updated the device tree with the command ubiupdatevol /dev/ubi0_1 imx6ull-colibri-wifi-aster.dtb (according to this Toradex article) and rebooted.

I don’t know how to check if the correct device tree file is used.

This is the output of cat /sys/kernel/debug/gpio:

cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
 gpio-0   (SODIMM_8            )
 gpio-1   (SODIMM_6            )
 gpio-2   (SODIMM_129          |regulator-usbh-vbus ) out lo ACTIVE LOW
 gpio-3   (                    )
 gpio-4   (SODIMM_19           )
 gpio-5   (SODIMM_21           )
 gpio-6   (UNUSABLE_SODIMM_180 )
 gpio-7   (UNUSABLE_SODIMM_184 )
 gpio-8   (SODIMM_4            )
 gpio-9   (SODIMM_2            )
 gpio-10  (SODIMM_106          |reset               ) out hi
 gpio-11  (SODIMM_71           |enable              ) out lo
 gpio-12  (SODIMM_23           )
 gpio-13  (SODIMM_31           )
 gpio-14  (SODIMM_99           )
 gpio-15  (SODIMM_102          )
 gpio-16  (SODIMM_33           )
 gpio-17  (SODIMM_35           )
 gpio-18  (SODIMM_25           )
 gpio-19  (SODIMM_27           )
 gpio-20  (SODIMM_36           )
 gpio-21  (SODIMM_38           )
 gpio-22  (SODIMM_32           )
 gpio-23  (SODIMM_34           )
 gpio-24  (SODIMM_135          )
 gpio-25  (SODIMM_77           )
 gpio-26  (SODIMM_100          )
 gpio-27  (SODIMM_186          )
 gpio-28  (SODIMM_196          |scl                 ) out hi
 gpio-29  (SODIMM_194          |sda                 ) in  hi
 gpio-30  (                    |scl                 ) out hi
 gpio-31  (                    |sda                 ) in  hi

gpiochip1: GPIOs 32-63, parent: platform/20a0000.gpio, 20a0000.gpio:
 gpio-32  (SODIMM_55           )
 gpio-33  (SODIMM_63           )
 gpio-34  (SODIMM_178          )
 gpio-35  (SODIMM_188          )
 gpio-36  (SODIMM_73           )
 gpio-37  (SODIMM_30           )
 gpio-38  (SODIMM_67           )
 gpio-39  (SODIMM_104          )
 gpio-40  (                    )
 gpio-41  (                    )
 gpio-42  (                    )
 gpio-43  (                    )
 gpio-44  (                    )
 gpio-45  (                    )
 gpio-46  (                    )
 gpio-47  (                    )
 gpio-48  (SODIMM_190          )
 gpio-49  (SODIMM_47           )
 gpio-50  (SODIMM_192          )
 gpio-51  (SODIMM_49           )
 gpio-52  (SODIMM_51           )
 gpio-53  (SODIMM_53           )

gpiochip2: GPIOs 64-95, parent: platform/20a4000.gpio, 20a4000.gpio:
 gpio-64  (SODIMM_56           )
 gpio-65  (SODIMM_44           )
 gpio-66  (SODIMM_68           )
 gpio-67  (SODIMM_82           )
 gpio-68  (                    )
 gpio-69  (SODIMM_76           )
 gpio-70  (SODIMM_70           )
 gpio-71  (SODIMM_60           )
 gpio-72  (SODIMM_58           )
 gpio-73  (SODIMM_78           )
 gpio-74  (SODIMM_72           )
 gpio-75  (SODIMM_80           )
 gpio-76  (SODIMM_46           )
 gpio-77  (SODIMM_62           )
 gpio-78  (SODIMM_48           )
 gpio-79  (SODIMM_74           )
 gpio-80  (SODIMM_50           )
 gpio-81  (SODIMM_52           )
 gpio-82  (SODIMM_54           )
 gpio-83  (SODIMM_66           )
 gpio-84  (SODIMM_64           )
 gpio-85  (SODIMM_57           )
 gpio-86  (SODIMM_61           )
 gpio-87  (SODIMM_29           )
 gpio-88  (SODIMM_37           )
 gpio-89  (SODIMM_88           )
 gpio-90  (SODIMM_86           |spi_imx             ) in  hi
 gpio-91  (SODIMM_92           )
 gpio-92  (SODIMM_90           )
gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-96  (                    )
 gpio-97  (                    )
 gpio-98  (                    )
 gpio-99  (                    )
 gpio-100 (                    )
 gpio-101 (                    )
 gpio-102 (                    )
 gpio-103 (                    )
 gpio-104 (                    )
 gpio-105 (                    )
 gpio-106 (                    )
 gpio-107 (SODIMM_59           )
 gpio-108 (                    )
 gpio-109 (                    )
 gpio-110 (SODIMM_133          )
 gpio-111 (                    )
 gpio-112 (SODIMM_28           )
 gpio-113 (SODIMM_75           )
 gpio-114 (SODIMM_96           )
 gpio-115 (                    )
 gpio-116 (                    )
 gpio-117 (                    )
 gpio-118 (                    )
 gpio-119 (                    )
 gpio-120 (                    )
 gpio-121 (SODIMM_69           )
 gpio-122 (SODIMM_98           )
 gpio-123 (SODIMM_85           )
 gpio-124 (SODIMM_65           |spi_imx             ) in  hi

gpiochip4: GPIOs 128-159, parent: platform/20ac000.gpio, 20ac000.gpio:
 gpio-128 (SODIMM_43           |cd                  ) in  hi IRQ ACTIVE LOW
 gpio-129 (SODIMM_45           |Wake-Up             ) in  lo IRQ
 gpio-130 (SODIMM_137          |id                  ) in  lo IRQ
 gpio-131 (SODIMM_95           )
 gpio-132 (SODIMM_107          )
 gpio-133 (SODIMM_131          )
 gpio-134 (                    )
 gpio-135 (                    )
 gpio-136 (                    )
 gpio-137 (                    |+V3.3_1.8_SD        ) out hi
 gpio-138 (SODIMM_105          )
 gpio-139 (                    |reset               ) out hi ACTIVE LOW

You need to set gpio-132 (SODIMM_107) as a wake up source.

I’ve added the SODIMM_107 (GPIO5.4) to gpio-keys, in imx6ull-colibri-aster.dtsi, as follows:

gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_snvs_gpiokeys>;

		power {
			label = "Wake-Up";
			gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
			linux,code = <KEY_WAKEUP>;
			debounce-interval = <10>;
			gpio-key,wakeup;
		};

		touch {
			label = "Wake-T";
			gpios = <&gpio5 4 GPIO_ACTIVE_HIGH>;
			linux,code = <KEY_WAKEUP>;
			gpio-key,wakeup;
		};
	};

I also left the wakeup-source property as above at atmel_mxt_ts: atmel_mxt_ts@4a. However, it does not work and I get a different output from the cat /sys/kernel/debug/gpio command:

gpiochip4: GPIOs 128-159, parent: platform/20ac000.gpio, 20ac000.gpio:
 gpio-128 (SODIMM_43           |cd                  ) in  hi IRQ ACTIVE LOW
 gpio-129 (SODIMM_45           )
 gpio-130 (SODIMM_137          |id                  ) in  lo IRQ
 gpio-131 (SODIMM_95           )
 gpio-132 (SODIMM_107          )
 gpio-133 (SODIMM_131          )
 gpio-134 (                    )
 gpio-135 (                    )
 gpio-136 (                    )
 gpio-137 (                    |+V3.3_1.8_SD        ) out hi
 gpio-138 (SODIMM_105          )
 gpio-139 (                    |reset               ) out hi ACTIVE LOW

Can you please tell me how to properly configure the gpio as a wakeup source?

I’ve tried many solutions I found on the internet, but nothing works. I even changed to pinctrl-0 = <&pinctrl_snvs_gpio2>; (for SODIMM 107) and commented out the power pin (GPIO 5.1), but without success.

Can you confirm that you can enable wake up on a GPIO or touchscreen wakeup? I think there is an issue here.

Hi @CristianM!

I’ll investigate this further and try to reproduce your issue with SODIMM_107. I’ll get back to you ASAP.

Have you made any progress?

I had this exact issue with my IMX7 setup, in my scenario there was nothing in my device tree to make the touchscreen a wakeup source, but yet the touch was still waking up my imx7. The issue for me was a line of code in my touchscreen driver, this was the line of code in my driver that I needed to play with to enable/disable touch

device_init_wakeup(&client->dev, 0/1/);

Hi. I need exactly the opposite - to enable the touch screen as a wake up source. Where can I find this line of code in the Linux sources and how should it be to enable the touch screen as a wake up source?

UPDATE

I think I’ve found the touchscreen driver file: \oe-core\build\tmp\work-shared\colibri-imx6ull\kernel-source\drivers\input\touchscreen\atmel_mxt_ts.c, but it does not contain a line with device_init_wakeup.

@CristianM,

I got it kind of working by just modifying the touchscreen node to look like this:

atmel_mxt_ts: atmel_mxt_ts@4a {
		compatible = "atmel,maxtouch";
		reg = <0x4a>;
		interrupt-parent = <&gpio5>;
		interrupts = <4 IRQ_TYPE_EDGE_FALLING>; /* SODIMM 107 */
		reset-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; /* SODIMM 106 */
		status = "okay";
		wakeup-source;
		interrupt-names = "irq", "wakeup";
	};

The issue is that Linux is expecting the wakeup signal to change from it’s previous status. For the interrupt to work I had to first disconnect the touchscreen cable, then connect it again. Just then the wakeup interrupt would work, but only a couple times. I’m investigating how to modify such behavior.

OK. Nice to see there is some progress.

Hi. I didn’t manage to reproduce this behavior. I tried the following:

  • put the module to sleep and touch the screen;
  • put the module to sleep, disconnect and reconnect the touchscreen cable and touch the screen;
  • disconnect and reconnect the touchscreen cable, put the module to sleep, and touch the screen.

Hi. Have you made any progress?

Please, do you have any updates?