Is it possible to use pin as GPIO and wakeup source?

I want to use a button (SODIMM 55) as both wakeup source and input. I have modified the device tree 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>; // SODIMM 45
			linux,code = <KEY_WAKEUP>;
			debounce-interval = <10>;

		wakeup {
			label = "Wake-Up_BTN";
			gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; // SODIMM 55
			linux,code = <KEY_WAKEUP>;
			debounce-interval = <10>;

&iomuxc {
	imx6ull-colibri {
		pinctrl_misc_gpio: misc-gpio-grp {
			fsl,pins = <
				MX6UL_PAD_ENET1_RX_DATA0__GPIO2_IO00	0x28 // SODIMM 55; general button

It works fine (the system wakes up from standby/suspend when pressing the button). But if I try to access the the pin with gpioget 1 0, it says the gpioget: error reading GPIO values: Device or resource busy. Also, gpioinfo shows that the resource is used:

gpioinfo 1
gpiochip1 - 32 lines:
        line   0:  "SODIMM_55" "Wake-Up_BTN" input active-high [used]

So, is it possible to use the pin as both wakeup source and input?

Greetings @CristianM!

Another customer has had success in implementing something similar.

Can you please check the following post and see if that works for you? Gpio as both interrupt pin and wake-up source - Technical Support - Toradex Community

Hi. From the answer indicated it is not clear to me what driver code needs to be modified. Also, I need to use the pin as a regular input, not an interrupt source.

This solution works for me. Thank you!


You can try using this method to unbind the GPIO from the gpio-keys driver. It should then be accessible as a regular GPIO. Unfortunately you cannot do both at the same time - this is a driver limitation to avoid concurrent use.

Glad that this works!