How to configure iMX6 (Linux) to power resume via GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure iMX6 (Linux) to power resume via GPIO

14,414 Views
normancheung
Contributor III

I have a wandboard iMX6-solo platform with Yocto build.  I can set UART as power resume source, but I am not able to do it with GPIO.

with UART, I can do

echo enabled > /sys/de is no /platform/imx-uart.0/tty/ttymxc0/power/wakeup

echo mem > /sys/power/state

Then board go to sleep.  And any UART activity will wake up CPU.

But there is NO  /sys/class/gpio/gpio<n>/power/wakeup in the gpio /sys/class.  I wonder if there is any .config option I need to set in the Linux kernel?  Our do I have to setup the GPIO's IRQ as source of wakeup, if so, how?

Thanks,

Norman

Labels (2)
3 Replies

4,267 Views
AnsonHuang
NXP Employee
NXP Employee

Hi, Norman

     You can refer to power key setting in our BSP, see dts config, you can add the GPIO you want as a power key, then it should be able to wake up from this GPIO, basically, you only need to enable this GPIO's interrupt and unmask this irq in GPC, then system should be able to resume from this GPIO, but there is a demo driver for you to make it happen easier, to set this GPIO as a "power key"

arch/arm/boot/dts/imx6qdl-sabresd.dtsi :

set IOMUX:

561 &iomuxc {

562         pinctrl-names = "default";

563         pinctrl-0 = <&pinctrl_hog_1>;

564

565         hog {

566                 pinctrl_hog_1: hoggrp-1 {

567                         fsl,pins = <

568                                 MX6QDL_PAD_GPIO_4__GPIO1_IO04   0x80000000

569                                 MX6QDL_PAD_GPIO_5__GPIO1_IO05   0x80000000

570                                 MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x80000000

571                                 MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x80000000

572                                 MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x80000000

573                                 MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x80000000

574                                 MX6QDL_PAD_NANDF_ALE__GPIO6_IO08 0x80000000

575                                 MX6QDL_PAD_NANDF_CLE__GPIO6_IO07 0x80000000

576                                 MX6QDL_PAD_GPIO_0__CCM_CLKO1    0x130b0

577                                 MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000

578                                 MX6QDL_PAD_NANDF_CS3__GPIO6_IO16 0x80000000

579                                 MX6QDL_PAD_EIM_D26__GPIO3_IO26 0x80000000

580                                 MX6QDL_PAD_EIM_CS1__GPIO2_IO24 0x80000000

581                                 MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x80000000

582                                 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x80000000

583                                 MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000

584                                 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000

585                                 MX6QDL_PAD_EIM_D22__GPIO3_IO22  0x80000000

586                                 MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000

587                                 MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x80000000

588                                 MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000

589                                 MX6QDL_PAD_EIM_D16__GPIO3_IO16 0x80000000

590                                 MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000

591                                 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000

592                                 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x80000000

593                                 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000

106         gpio-keys {

107                 compatible = "gpio-keys";

108                 power {

109                         label = "Power Button";

110                         gpios = <&gpio3 29 1>;

111                         linux,code = <116>; /* KEY_POWER */

112                         gpio-key,wakeup;

113                 };

4,267 Views
normancheung
Contributor III

Many thank Yongcai, this is exactly what I was looking for.  I will try.

Norman

0 Kudos
Reply

4,267 Views
seanchen
Contributor III

Dear Norman,

Could you please tell me wakeup function workable?

I have customer board and need several gpio to wakeup iMX6.

BR,

Sean.

0 Kudos
Reply