gpio as both interrupt pin and wake-up source

cancel
Showing results for 
Search instead for 
Did you mean: 

gpio as both interrupt pin and wake-up source

255 Views
akbar123
Contributor III

Hi,

I have used GPIO pin as wake-up source in my imx6 apalis board by enabling it with the following snippet in device tree:

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

    wakeup {
        label = "Wake-Up";
        gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
        linux,code = <KEY_WAKEUP>;
        debounce-interval = <10>;
        wakeup-source;
    };
};

Now I can wake up imx6 when it's in sleep by the gpio pin

I have test another scenario to generate interrupt by a gpio pin with the following snippet in the device tree:

gpio-controller;
interrupt-controller;
interrupt-parent = <&gpio1>;
interrupts = <4 IRQ_TYPE_EDGE_FALLING>;

 

Now, I want to combine these two scenarios. I want a gpio pin to act as both wake-up source and interrupt pin, i.e. when imx6 is in sleep, the interrupt will wake it up, and when it's wakeup, the interrupt acts as usual and be received by other parts such as a driver willing to receive it

 

Question: How can I do the above scenario?

Thanks in advance

Labels (2)
Tags (3)
0 Kudos
1 Reply

228 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Asghar

 

one can try to follow gpio-keys linux documentation, wakeup-source is optional:

https://github.com/varigit/linux-imx/blob/imx_4.14.78_1.0.0_ga_var01/Documentation/devicetree/bindin...

 

Best regards
igor

0 Kudos