I am using imx6ul evk with yocto. Once my evk goes to sleep I want to wake it up once interrupt is received on gpio2 21. I added following lines to my dts file
gpio-keys {
compatible = "gpio-keys";
wakeup {
label = "wakeup gpio";
gpios = <&gpio2 21 GPIO_ACTIVE_LOW>;
linux,code = <29>;
gpio-key,wakeup;
};
};
I suspend using following command
echo standby > /sys/power/state
but it doesn't wake up once interrupt(high to low) is received on gpio2 21. Where I am making a mistake? Can anyone help me find out reason for failure to wake up?
Solved! Go to Solution.
Hello,
Please refer to the following :
GPIO Line - Wakeup - Level Trigger
How to configure iMX6 (Linux) to power resume via GPIO
Have a great day,
Yuri
------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
------------------------------------------------------------------------------
Hi Pratyush Tomar,
Will you please give your configuration. I am also struggling in wake up.
Thanks & Regards,
VinothS,
Hello,
Currently I am working on wandboard quad. I also want one of its external GPIO act as a Power Button in order to wake up the processor. With this respect, I find this post very useful. But I failed to interpret this line "linux,code = <29>" . From where we get this "linux,code = <29>". Kindly help.
Thanks,
Niti Gupta
If you take a look in the kernel documentation /devicetree/bindings/gpio/gpio_keys.txt you will find:
Subnode properties:
- gpios: OF device-tree gpio specification.
- label: Descriptive name of the key.
- linux,code: Keycode to emit.
i.e. what keyboard button the GPIO should correspond to.
A list of Linux keycodes can be found for example here:
Where you can see that keycode 29 is "Left CTRL", which is suitable as it would not have any noticeable effect when it is "pressed" for the wakeup event.
Hello Carl,
My dts file configuration was correct. The problem was with motion sensor which was not generating interrupt (wake up source from sleep). Secondly as you said the error was due to pin being used twice for 2 different functions.
Thanks
Pratyush
ok I managed to work out thing my device resumes from sleep but I receive following error messages
root@imx6ulevk:~# imx6ul-pinctrl 20e0000.iomuxc: pin MX6UL_PAD_SD1_DATA3 already requested by 20e0000.iomuxc; cannot claim for 2190000.usdhc
imx6ul-pinctrl 20e0000.iomuxc: pin-116 (2190000.usdhc) status -22
imx6ul-pinctrl 20e0000.iomuxc: could not request pin 116 (MX6UL_PAD_SD1_DATA3) from group usdhc1grp on device 20e0000.iomuxc
sdhci-esdhc-imx 2190000.usdhc: Error applying setting, reverse things back
Hi Pratyush,
The errors you are seeing relate to some of the pin's defined in your Device Tree being used twice for two different functions.
Can I ask, How did you manage to "work out things" with your suspend/resume issue with the gpio-keys gpio, what was wrong and how did you fix it? It would be useful for the community to explain.
Thanks
Carl
Hello Yuri I have already gone through these links but it didn't workout. I mad following changes in my dts file.
gpio-keys {
compatible = "gpio-keys";
wakeup {
label = "wakeup gpio";
gpios = <&gpio2 21 GPIO_ACTIVE_LOW>;
linux,code = <29>;
gpio-key,wakeup;
};
}
imx6ul-evk {
pinctrl_hog_1: hoggrp-1 {
fsl,pins = <
MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059 /* SD1 CD */
MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT 0x17059 /* SD1 VSELECT */
MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0x17059 /* SD1 RESET */
MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00 0x80000000
MX6UL_PAD_SD1_DATA3__GPIO2_IO21 0x80000000 //line added
>;
};
But it's still not working out.
Hello,
Please refer to the following :
GPIO Line - Wakeup - Level Trigger
How to configure iMX6 (Linux) to power resume via GPIO
Have a great day,
Yuri
------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
------------------------------------------------------------------------------