linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
@ 2015-09-17 16:06 Qipeng Zha
  2015-10-02 10:26 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Qipeng Zha @ 2015-09-17 16:06 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, linus.walleij, qipeng.zha, Qi Zheng, Aubrey Li

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(+)

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);
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
  2015-09-17 16:06 [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key Qipeng Zha
@ 2015-10-02 10:26 ` Linus Walleij
  2015-10-02 17:41   ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2015-10-02 10:26 UTC (permalink / raw)
  To: Qipeng Zha; +Cc: Linux Input, Dmitry Torokhov, Qi Zheng, Aubrey Li

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
  2015-10-02 10:26 ` Linus Walleij
@ 2015-10-02 17:41   ` Dmitry Torokhov
  2015-10-09  2:14     ` Zheng, Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2015-10-02 17:41 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Qipeng Zha, Linux Input, Qi Zheng, Aubrey Li

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
  2015-10-02 17:41   ` Dmitry Torokhov
@ 2015-10-09  2:14     ` Zheng, Qi
  2015-10-09  2:47       ` Li, Aubrey
  0 siblings, 1 reply; 6+ messages in thread
From: Zheng, Qi @ 2015-10-09  2:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Linus Walleij; +Cc: Zha, Qipeng, Linux Input, Li, Aubrey

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
  2015-10-09  2:14     ` Zheng, Qi
@ 2015-10-09  2:47       ` Li, Aubrey
  2015-10-09  5:36         ` Zheng, Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Li, Aubrey @ 2015-10-09  2:47 UTC (permalink / raw)
  To: Zheng, Qi, Dmitry Torokhov, Linus Walleij; +Cc: Zha, Qipeng, Linux Input

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key
  2015-10-09  2:47       ` Li, Aubrey
@ 2015-10-09  5:36         ` Zheng, Qi
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng, Qi @ 2015-10-09  5:36 UTC (permalink / raw)
  To: Li, Aubrey, Dmitry Torokhov, Linus Walleij; +Cc: Zha, Qipeng, Linux Input

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-09  5:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 16:06 [PATCH] input:gpio-key: set IRQF_NO_SUSPEND for wake capable key Qipeng Zha
2015-10-02 10:26 ` Linus Walleij
2015-10-02 17:41   ` Dmitry Torokhov
2015-10-09  2:14     ` Zheng, Qi
2015-10-09  2:47       ` Li, Aubrey
2015-10-09  5:36         ` Zheng, Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).