diff mbox

input:gpio-key: set IRQF_NO_SUSPEND for wake capable key

Message ID 1442506019-13687-1-git-send-email-qipeng.zha@intel.com (mailing list archive)
State Rejected
Headers show

Commit Message

qipeng.zha Sept. 17, 2015, 4:06 p.m. UTC
When wakeup attribute is set, GPIO key is supposed to wake up
the system from system sleep state, So set IRQF_NO_SUSPEND
flag to keep IRQ enabled during suspend.

Signed-off-by: Qi Zheng <qi.zheng@intel.com>
Signed-off-by: Aubrey Li <aubrey.li@intel.com>
Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
---
 drivers/input/keyboard/gpio_keys.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Linus Walleij Oct. 2, 2015, 10:26 a.m. UTC | #1
On Thu, Sep 17, 2015 at 9:06 AM, Qipeng Zha <qipeng.zha@intel.com> wrote:

> When wakeup attribute is set, GPIO key is supposed to wake up
> the system from system sleep state, So set IRQF_NO_SUSPEND
> flag to keep IRQ enabled during suspend.
>
> Signed-off-by: Qi Zheng <qi.zheng@intel.com>
> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Should this not be tagged for stable?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov Oct. 2, 2015, 5:41 p.m. UTC | #2
On Fri, Oct 02, 2015 at 03:26:27AM -0700, Linus Walleij wrote:
> On Thu, Sep 17, 2015 at 9:06 AM, Qipeng Zha <qipeng.zha@intel.com> wrote:
> 
> > When wakeup attribute is set, GPIO key is supposed to wake up
> > the system from system sleep state, So set IRQF_NO_SUSPEND
> > flag to keep IRQ enabled during suspend.
> >
> > Signed-off-by: Qi Zheng <qi.zheng@intel.com>
> > Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> > Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Should this not be tagged for stable?

I do not believe we need this at all. Otherwise every single driver for
devices that might be wakeup sources needs this flag set. Which would
basically means it is a noop and we should not suspend IRQ threads by
default.

The dirver correctly calls enable_irq_wake() and platform should do
whatever it needs to make sure wakeup interrupt will be serviced.

Thanks.
Zheng, Qi Oct. 9, 2015, 2:14 a.m. UTC | #3
Hi,

"enable_irq_wake" is to enable/disable power-management wake-on of an IRQ.
It is wake-on control not interrupt enable control.
In my opinion, to make sure the keys press working when system suspend, both wake-on and interrupt should be enabled.
Besides,  for many platforms, the gpio irq chip don't implement the method "enable_irq_wake" by setting "IRQCHIP_SKIP_SET_WAKE".
So, I think "IRQF_NO_SUSPEND" is necessary for this case.

BRs

Zheng Qi
PEG->IPG->EIG SH IO/LPSS team

-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] 
Sent: Saturday, October 3, 2015 1:42 AM
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Zha, Qipeng <qipeng.zha@intel.com>; Linux Input <linux-input@vger.kernel.org>; Zheng, Qi <qi.zheng@intel.com>; Li, Aubrey <aubrey.li@intel.com>
Subject: Re: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key

On Fri, Oct 02, 2015 at 03:26:27AM -0700, Linus Walleij wrote:
> On Thu, Sep 17, 2015 at 9:06 AM, Qipeng Zha <qipeng.zha@intel.com> wrote:
> 
> > When wakeup attribute is set, GPIO key is supposed to wake up the 
> > system from system sleep state, So set IRQF_NO_SUSPEND flag to keep 
> > IRQ enabled during suspend.
> >
> > Signed-off-by: Qi Zheng <qi.zheng@intel.com>
> > Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> > Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Should this not be tagged for stable?

I do not believe we need this at all. Otherwise every single driver for devices that might be wakeup sources needs this flag set. Which would basically means it is a noop and we should not suspend IRQ threads by default.

The dirver correctly calls enable_irq_wake() and platform should do whatever it needs to make sure wakeup interrupt will be serviced.

Thanks.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Aubrey Li Oct. 9, 2015, 2:47 a.m. UTC | #4
On Friday, October 09, 2015 10:14 AM, Zheng, Qi wrote:
> 
> Hi,
> 
> "enable_irq_wake" is to enable/disable power-management wake-on of an
> IRQ.
> It is wake-on control not interrupt enable control.
> In my opinion, to make sure the keys press working when system suspend, both
> wake-on and interrupt should be enabled.
> Besides,  for many platforms, the gpio irq chip don't implement the method
> "enable_irq_wake" by setting "IRQCHIP_SKIP_SET_WAKE".
> So, I think "IRQF_NO_SUSPEND" is necessary for this case.

We had a discussion on this before. Here is the thread:
https://lkml.org/lkml/2014/7/8/970

device_init_wakeup() is a general interface and supposed to be used to enable
wakeup for the wakeup sources. How gpio keys probe and call device_init_wakeup()
is a good reference for your case.

Thanks,
-Aubrey

> 
> BRs
> 
> Zheng Qi
> PEG->IPG->EIG SH IO/LPSS team
> 
> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Saturday, October 3, 2015 1:42 AM
> To: Linus Walleij <linus.walleij@linaro.org>
> Cc: Zha, Qipeng <qipeng.zha@intel.com>; Linux Input
> <linux-input@vger.kernel.org>; Zheng, Qi <qi.zheng@intel.com>; Li, Aubrey
> <aubrey.li@intel.com>
> Subject: Re: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable
> key
> 
> On Fri, Oct 02, 2015 at 03:26:27AM -0700, Linus Walleij wrote:
> > On Thu, Sep 17, 2015 at 9:06 AM, Qipeng Zha <qipeng.zha@intel.com>
> wrote:
> >
> > > When wakeup attribute is set, GPIO key is supposed to wake up the
> > > system from system sleep state, So set IRQF_NO_SUSPEND flag to keep
> > > IRQ enabled during suspend.
> > >
> > > Signed-off-by: Qi Zheng <qi.zheng@intel.com>
> > > Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> > > Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Should this not be tagged for stable?
> 
> I do not believe we need this at all. Otherwise every single driver for devices
> that might be wakeup sources needs this flag set. Which would basically means
> it is a noop and we should not suspend IRQ threads by default.
> 
> The dirver correctly calls enable_irq_wake() and platform should do whatever it
> needs to make sure wakeup interrupt will be serviced.
> 
> Thanks.
> 
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zheng, Qi Oct. 9, 2015, 5:36 a.m. UTC | #5
Thanks help from Aubrey.
We can fix this bug in platform gpio driver instead of modifying general gpio_keys.c.

BRs

Zheng Qi
PEG->IPG->EIG SH IO/LPSS team

-----Original Message-----
From: Li, Aubrey 
Sent: Friday, October 9, 2015 10:48 AM
To: Zheng, Qi <qi.zheng@intel.com>; Dmitry Torokhov <dmitry.torokhov@gmail.com>; Linus Walleij <linus.walleij@linaro.org>
Cc: Zha, Qipeng <qipeng.zha@intel.com>; Linux Input <linux-input@vger.kernel.org>
Subject: RE: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key

On Friday, October 09, 2015 10:14 AM, Zheng, Qi wrote:
> 
> Hi,
> 
> "enable_irq_wake" is to enable/disable power-management wake-on of an 
> IRQ.
> It is wake-on control not interrupt enable control.
> In my opinion, to make sure the keys press working when system 
> suspend, both wake-on and interrupt should be enabled.
> Besides,  for many platforms, the gpio irq chip don't implement the 
> method "enable_irq_wake" by setting "IRQCHIP_SKIP_SET_WAKE".
> So, I think "IRQF_NO_SUSPEND" is necessary for this case.

We had a discussion on this before. Here is the thread:
https://lkml.org/lkml/2014/7/8/970

device_init_wakeup() is a general interface and supposed to be used to enable wakeup for the wakeup sources. How gpio keys probe and call device_init_wakeup() is a good reference for your case.

Thanks,
-Aubrey

> 
> BRs
> 
> Zheng Qi
> PEG->IPG->EIG SH IO/LPSS team
> 
> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Saturday, October 3, 2015 1:42 AM
> To: Linus Walleij <linus.walleij@linaro.org>
> Cc: Zha, Qipeng <qipeng.zha@intel.com>; Linux Input 
> <linux-input@vger.kernel.org>; Zheng, Qi <qi.zheng@intel.com>; Li, 
> Aubrey <aubrey.li@intel.com>
> Subject: Re: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake 
> capable key
> 
> On Fri, Oct 02, 2015 at 03:26:27AM -0700, Linus Walleij wrote:
> > On Thu, Sep 17, 2015 at 9:06 AM, Qipeng Zha <qipeng.zha@intel.com>
> wrote:
> >
> > > When wakeup attribute is set, GPIO key is supposed to wake up the 
> > > system from system sleep state, So set IRQF_NO_SUSPEND flag to 
> > > keep IRQ enabled during suspend.
> > >
> > > Signed-off-by: Qi Zheng <qi.zheng@intel.com>
> > > Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> > > Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Should this not be tagged for stable?
> 
> I do not believe we need this at all. Otherwise every single driver 
> for devices that might be wakeup sources needs this flag set. Which 
> would basically means it is a noop and we should not suspend IRQ threads by default.
> 
> The dirver correctly calls enable_irq_wake() and platform should do 
> whatever it needs to make sure wakeup interrupt will be serviced.
> 
> Thanks.
> 
> --
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ddf4045..9744ad9 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -528,6 +528,8 @@  static int gpio_keys_setup_key(struct platform_device *pdev,
 	 */
 	if (!button->can_disable)
 		irqflags |= IRQF_SHARED;
+	if (button->wakeup)
+		irqflags |= IRQF_NO_SUSPEND;
 
 	error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
 					     isr, irqflags, desc, bdata);