# Re: \[PATCH\] Input: gpio\_keys: support wakeup system from freeze mode

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2013-12-24 00:30:40 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2013/12/8922619
- Thread: https://ratatoskr.run/linux-input/2013/12/8922613/t.md

```text
Hi Anson,

On Mon, Dec 23, 2013 at 01:21:20PM -0500, Anson Huang wrote:
> For "freeze" mode of suspend, cpu will go into idle and
> those wakeup sources' irq should NOT be disabled during
> devices suspend, so we need to add IRQF_NO_SUSPEND flag
> for those wakeup sources.
> 
> Steps to test this patch:
> 
> 1. echo freeze > /sys/power/state;
> 2. press gpio key which has wakeup function, then system
>    will resume.

I do no think this is correct approach, otheriwse every driver that can
be a wakeup source would have to use IRQF_NO_SUSPEND flag. The driver
does use enable_irq_wake() in its suspend path, and platform code should
perform all necessary work for this IRQ to be usable as a wakeup source.

Thanks.

> 
> Signed-off-by: Anson Huang <redacted>
> ---
>  drivers/input/keyboard/gpio_keys.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index 2db1324..aadb1db 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -473,6 +473,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
>  
>  		isr = gpio_keys_gpio_isr;
>  		irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
> +		if (bdata->button->wakeup)
> +			irqflags |= IRQF_NO_SUSPEND;
>  
>  	} else {
>  		if (!button->irq) {
> -- 
> 1.7.9.5
> 
> 

-- 
Dmitry
```
