All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
@ 2012-04-12 14:06 Paul Parsons
  2012-04-12 18:07 ` Paul Parsons
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-12 14:06 UTC (permalink / raw)
  To: linux-arm-kernel

The PXA GPIO irq_chip structure (pxa_muxed_gpio_chip) sets neither:
1. The irq_set_wake() handler.
2. The IRQCHIP_SKIP_SET_WAKE flag.

Consequently any attempt to configure the PXA GPIOs as wakeup sources
results in Unbalanced IRQ warnings when the system is woken from sleep
mode:

WARNING: at kernel/irq/manage.c:520 irq_set_irq_wake+0xc4/0xf8()
Unbalanced IRQ 96 wake disable
...
WARNING: at kernel/irq/manage.c:520 irq_set_irq_wake+0xc4/0xf8()
Unbalanced IRQ 190 wake disable
...
WARNING: at kernel/irq/manage.c:520 irq_set_irq_wake+0xc4/0xf8()
Unbalanced IRQ 195 wake disable
...

This patch sets the pxa_muxed_gpio_chip IRQCHIP_SKIP_SET_WAKE flag,
thereby eliminating the Unbalanced IRQ warnings.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
---
 drivers/gpio/gpio-pxa.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 5689ce6..93ce960 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -427,6 +427,7 @@ static struct irq_chip pxa_muxed_gpio_chip = {
 	.irq_mask	= pxa_mask_muxed_gpio,
 	.irq_unmask	= pxa_unmask_muxed_gpio,
 	.irq_set_type	= pxa_gpio_irq_type,
+	.flags		= IRQCHIP_SKIP_SET_WAKE,
 };
 
 static int pxa_gpio_nums(void)
-- 
1.7.3.4

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-12 14:06 [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag Paul Parsons
@ 2012-04-12 18:07 ` Paul Parsons
  2012-04-17 21:28   ` Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-12 18:07 UTC (permalink / raw)
  To: linux-arm-kernel

--- On Thu, 12/4/12, Paul Parsons <lost.distance@yahoo.com> wrote:
> The PXA GPIO irq_chip structure
> (pxa_muxed_gpio_chip) sets neither:
> 1. The irq_set_wake() handler.
> 2. The IRQCHIP_SKIP_SET_WAKE flag.
> 
> Consequently any attempt to configure the PXA GPIOs as
> wakeup sources
> results in Unbalanced IRQ warnings when the system is woken
> from sleep
> mode:
> 
> WARNING: at kernel/irq/manage.c:520
> irq_set_irq_wake+0xc4/0xf8()
> Unbalanced IRQ 96 wake disable
> ...
> WARNING: at kernel/irq/manage.c:520
> irq_set_irq_wake+0xc4/0xf8()
> Unbalanced IRQ 190 wake disable
> ...
> WARNING: at kernel/irq/manage.c:520
> irq_set_irq_wake+0xc4/0xf8()
> Unbalanced IRQ 195 wake disable
> ...
> 
> This patch sets the pxa_muxed_gpio_chip
> IRQCHIP_SKIP_SET_WAKE flag,
> thereby eliminating the Unbalanced IRQ warnings.
> 
> Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
> ---
>  drivers/gpio/gpio-pxa.c |? ? 1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-pxa.c
> b/drivers/gpio/gpio-pxa.c
> index 5689ce6..93ce960 100644
> --- a/drivers/gpio/gpio-pxa.c
> +++ b/drivers/gpio/gpio-pxa.c
> @@ -427,6 +427,7 @@ static struct irq_chip
> pxa_muxed_gpio_chip = {
>  ??? .irq_mask??? =
> pxa_mask_muxed_gpio,
>  ??? .irq_unmask??? =
> pxa_unmask_muxed_gpio,
>  ??? .irq_set_type??? =
> pxa_gpio_irq_type,
> +??? .flags???
> ??? = IRQCHIP_SKIP_SET_WAKE,
>  };
>  
>  static int pxa_gpio_nums(void)
> -- 

Hmm, now I'm wondering if an irq_chip irq_set_wake() handler should
be provided instead.

This question arises because of the gpio_keys driver, which
provides a per-button wakeup flag (in struct gpio_keys_button).

Without an irq_set_wake() handler, the per-button wakeup flag
seems to serve no useful purpose: the flag is used to call
enable_irq_wake() from gpio_keys_suspend(), but enable_irq_wake()
does nothing useful without a handler.

However if an irq_set_wake() handler were to be provided, and if
that handler were to call gpio_set_wake(), then the per-button wakeup
flag would indeed determine which buttons act as wakeup sources.

For example:

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 5689ce6..0a75f3c 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -23,6 +23,9 @@
 #include <linux/slab.h>
 
 #include <mach/irqs.h>
+#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
+#include <mach/mfp-pxa2xx.h>
+#endif
 
 /*
  * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
@@ -421,12 +424,24 @@ static void pxa_unmask_muxed_gpio(struct irq_data *d)
 	update_edge_detect(c);
 }
 
+#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
+static int pxa_gpio_irq_wake(struct irq_data *d, unsigned int on)
+{
+	int gpio = pxa_irq_to_gpio(d->irq);
+
+	return gpio_set_wake(gpio, on);
+}
+#endif
+
 static struct irq_chip pxa_muxed_gpio_chip = {
 	.name		= "GPIO",
 	.irq_ack	= pxa_ack_muxed_gpio,
 	.irq_mask	= pxa_mask_muxed_gpio,
 	.irq_unmask	= pxa_unmask_muxed_gpio,
 	.irq_set_type	= pxa_gpio_irq_type,
+#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
+	.irq_set_wake	= pxa_gpio_irq_wake,
+#endif
 };
 
 static int pxa_gpio_nums(void)

So the underlying question is:
Was it the intention that gpio_set_wake() be called from irq_chip
irq_set_wake() handlers?

Regards,
Paul

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-12 18:07 ` Paul Parsons
@ 2012-04-17 21:28   ` Robert Jarzmik
  2012-04-18  1:04     ` Paul Parsons
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-17 21:28 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Parsons <lost.distance@yahoo.com> writes:

> --- On Thu, 12/4/12, Paul Parsons <lost.distance@yahoo.com> wrote:
>> The PXA GPIO irq_chip structure
>> (pxa_muxed_gpio_chip) sets neither:
>> 1. The irq_set_wake() handler.
>> 2. The IRQCHIP_SKIP_SET_WAKE flag.

Hi Paul and others,

I tried the v3.4-rc2 today, and it _seems_ gpio button wakeups don't work
anymore (ie. wakeup set up by gpio-keys driver). More specifically, the GPIO0
(power button) doesn't wakeup my board from "echo mem > /proc/power/state".

I haven't investigated much, but tracing PWER register on suspend,
while GPIO0 (power button) was set as a wakeup source gives 0x80100000, which
lacks the bit0 setting (ie. GPIO0 as a wakeup source).

I don't know it this is a recent or known issue, or if I'm have missed a change in
pxa/gpio-keys driver.

Would anyone have an idea what's happening or should I look for the issue myself ?

Cheers.

-- 
Robert

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-17 21:28   ` Robert Jarzmik
@ 2012-04-18  1:04     ` Paul Parsons
  2012-04-18 10:58       ` Paul Parsons
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-18  1:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Robert,

--- On Tue, 17/4/12, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> >> The PXA GPIO irq_chip structure
> >> (pxa_muxed_gpio_chip) sets neither:
> >> 1. The irq_set_wake() handler.
> >> 2. The IRQCHIP_SKIP_SET_WAKE flag.
> 
> Hi Paul and others,
> 
> I tried the v3.4-rc2 today, and it _seems_ gpio button
> wakeups don't work
> anymore (ie. wakeup set up by gpio-keys driver). More
> specifically, the GPIO0
> (power button) doesn't wakeup my board from "echo mem >
> /proc/power/state".

Which board are you using?

> 
> I haven't investigated much, but tracing PWER register on
> suspend,
> while GPIO0 (power button) was set as a wakeup source gives
> 0x80100000, which
> lacks the bit0 setting (ie. GPIO0 as a wakeup source).

PWER bit 0 (WE0) has a reset value of 1 on the PXA250/PXA270.
If your WE0 is 0 then presumably either your bootloader or kernel
has cleared it.

> 
> I don't know it this is a recent or known issue, or if I'm
> have missed a change in
> pxa/gpio-keys driver.

I can only comment on the hx4700 platform, which has 4 pending
patches for suspend/resume, plus 1 more still to be submitted.
These fix hx4700 suspend/resume, which has never worked.
None of the patches touch the gpio-keys driver, however.

> 
> Would anyone have an idea what's happening or should I look
> for the issue myself ?

If you are using the hx4700 then I can point you towards the
pending patches.

Regards,
Paul

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18  1:04     ` Paul Parsons
@ 2012-04-18 10:58       ` Paul Parsons
  2012-04-18 18:21         ` Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-18 10:58 UTC (permalink / raw)
  To: linux-arm-kernel

--- On Wed, 18/4/12, Paul Parsons <lost.distance@yahoo.com> wrote:
> > I tried the v3.4-rc2 today, and it _seems_ gpio button
> > wakeups don't work
> > anymore (ie. wakeup set up by gpio-keys driver). More
> > specifically, the GPIO0
> > (power button) doesn't wakeup my board from "echo mem >
> > /proc/power/state".

...

> > I don't know it this is a recent or known issue, or if I'm
> > have missed a change in
> > pxa/gpio-keys driver.
> 
> I can only comment on the hx4700 platform, which has 4
> pending
> patches for suspend/resume, plus 1 more still to be
> submitted.
> These fix hx4700 suspend/resume, which has never worked.
> None of the patches touch the gpio-keys driver, however.

Just to clarify, the generic pxa/gpio suspend/resume support does
seem to work OK; the hx4700 patches are platform specific, apart
from this SKIP_SET_WAKE patch to fix the Unbalanced IRQ warnings.

Consequently it seems likely that your problem is also platform
specific.

Regards,
Paul

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18 10:58       ` Paul Parsons
@ 2012-04-18 18:21         ` Robert Jarzmik
  2012-04-18 19:34           ` Paul Parsons
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-18 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Parsons <lost.distance@yahoo.com> writes:

> --- On Wed, 18/4/12, Paul Parsons <lost.distance@yahoo.com> wrote:
> Just to clarify, the generic pxa/gpio suspend/resume support does
> seem to work OK; the hx4700 patches are platform specific, apart
> from this SKIP_SET_WAKE patch to fix the Unbalanced IRQ warnings.

OK, I'll check.

My platform is mioa701. In my case, the suspend/resume is working for RTC
wakeup, but not for GPIO0. This code was working before (that's vague, I know, I
suspect 3.0 was working), and is not working anymore. The gpio_keys_button
structure has still its 'wakeup' field ...

> Consequently it seems likely that your problem is also platform
> specific.
OK. So you confirm that on hx4700, pressing PowerButton while in suspend to ram
brings back to life your device ?

Cheers.

-- 
Robert

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18 18:21         ` Robert Jarzmik
@ 2012-04-18 19:34           ` Paul Parsons
  2012-04-18 20:59             ` Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-18 19:34 UTC (permalink / raw)
  To: linux-arm-kernel

--- On Wed, 18/4/12, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> > Just to clarify, the generic pxa/gpio suspend/resume
> support does
> > seem to work OK; the hx4700 patches are platform
> specific, apart
> > from this SKIP_SET_WAKE patch to fix the Unbalanced IRQ
> warnings.
> 
> OK, I'll check.
> 
> My platform is mioa701. In my case, the suspend/resume is
> working for RTC
> wakeup, but not for GPIO0. This code was working before
> (that's vague, I know, I
> suspect 3.0 was working), and is not working anymore. The
> gpio_keys_button
> structure has still its 'wakeup' field ...
> 
> > Consequently it seems likely that your problem is also
> platform
> > specific.
> OK. So you confirm that on hx4700, pressing PowerButton
> while in suspend to ram
> brings back to life your device ?

Yes.

I had a quick look at arch/arm/mach-pxa/mioa701.c and
noticed that it didn't call gpio_set_wake() for GPIO0.
Does this help:

diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 061d570..23190bf 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -726,6 +726,7 @@ static void __init mioa701_machine_init(void)
 
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
+	gpio_set_wake(GPIO0_KEY_POWER, 1);
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
 	pxa_set_stuart_info(NULL);

Regards,
Paul

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18 19:34           ` Paul Parsons
@ 2012-04-18 20:59             ` Robert Jarzmik
  2012-04-18 22:40               ` Paul Parsons
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-18 20:59 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Parsons <lost.distance@yahoo.com> writes:

> I had a quick look at arch/arm/mach-pxa/mioa701.c and
> noticed that it didn't call gpio_set_wake() for GPIO0.
> Does this help:
>
> diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
> index 061d570..23190bf 100644
> --- a/arch/arm/mach-pxa/mioa701.c
> +++ b/arch/arm/mach-pxa/mioa701.c
> @@ -726,6 +726,7 @@ static void __init mioa701_machine_init(void)
>  
>  
>  	pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
> +	gpio_set_wake(GPIO0_KEY_POWER, 1);
>  	pxa_set_ffuart_info(NULL);
>  	pxa_set_btuart_info(NULL);
>  	pxa_set_stuart_info(NULL);

Yes, the wakeup works again with the gpio_set_wake() call.
But that shouldn't be necessary. The legacy method that worked, if I remember
correctly, was :
 - suspend is triggered
 - gpio_keys.c: gpio_keys_suspend() is called
 - as mioa701 setup the platform data for gpio_keys_data as :
   MIO_KEY(KEY_EXIT, GPIO0_KEY_POWER, "Power button", 1),
     => implies struct gpio_keys_button has the button with .wakeup=1
   This triggers in gpio_keys_suspend():
                     -> enable_irq_wake(bdata->irq)

This enable_irq_wake() should in the end call gpio_set_wake(0, 1), but apparently
it doesn't for some reason. This the part I have to check.

Cheers.

-- 
Robert

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18 20:59             ` Robert Jarzmik
@ 2012-04-18 22:40               ` Paul Parsons
  2012-04-19 19:40                 ` Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Parsons @ 2012-04-18 22:40 UTC (permalink / raw)
  To: linux-arm-kernel

--- On Wed, 18/4/12, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> > I had a quick look at arch/arm/mach-pxa/mioa701.c and
> > noticed that it didn't call gpio_set_wake() for GPIO0.
> > Does this help:
> >
> > diff --git a/arch/arm/mach-pxa/mioa701.c
> b/arch/arm/mach-pxa/mioa701.c
> > index 061d570..23190bf 100644
> > --- a/arch/arm/mach-pxa/mioa701.c
> > +++ b/arch/arm/mach-pxa/mioa701.c
> > @@ -726,6 +726,7 @@ static void __init
> mioa701_machine_init(void)
> >? 
> >? 
> >? ???
> pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
> > +??? gpio_set_wake(GPIO0_KEY_POWER, 1);
> >? ??? pxa_set_ffuart_info(NULL);
> >? ??? pxa_set_btuart_info(NULL);
> >? ??? pxa_set_stuart_info(NULL);
> 
> Yes, the wakeup works again with the gpio_set_wake() call.
> But that shouldn't be necessary. The legacy method that
> worked, if I remember
> correctly, was :
>  - suspend is triggered
>  - gpio_keys.c: gpio_keys_suspend() is called
>  - as mioa701 setup the platform data for gpio_keys_data as
> :
> ???MIO_KEY(KEY_EXIT, GPIO0_KEY_POWER, "Power
> button", 1),
> ? ???=> implies struct
> gpio_keys_button has the button with .wakeup=1
> ???This triggers in gpio_keys_suspend():
> ? ? ? ? ? ? ? ?
> ? ???->
> enable_irq_wake(bdata->irq)
> 
> This enable_irq_wake() should in the end call
> gpio_set_wake(0, 1), but apparently
> it doesn't for some reason. This the part I have to check.

I posted a question about that 6 days ago: whether the irq_chip
irq_set_wake() handler (which is called from enable_irq_wake())
should call gpio_set_wake():

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-April/093953.html

Regards,
Paul

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-18 22:40               ` Paul Parsons
@ 2012-04-19 19:40                 ` Robert Jarzmik
  2012-04-20  0:55                   ` Haojian Zhuang
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-19 19:40 UTC (permalink / raw)
  To: linux-arm-kernel


Haojian,

I feel there's some change in PXA gpio wakeup handling that's weird.

The effect : gpio_keys driver can't wakeup from suspend to RAM on GPIO0
activation

A quick analysis (thanks Paul for direction) :
 - gpio_keys() calls irq_set_wake(96, 1) (ie. gpio0)
 - gpio-pxa driver doesn't care (as it doesn't have any irq_set_wake function)
   (see in [1])

Now if I'm directing the mail at is because you're the only one who commited
between v3.2 and v3.3 in gpio-pxa driver ([2]).

Could you tell me if removing irq_set_wake() was intentional ?

Cheers.

-- 
Robert

[1]
rj at beldin:~/mio_linux/kernel$ git show v3.2:drivers/gpio/gpio-pxa.c | grep set_wake
void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
	pxa_muxed_gpio_chip.irq_set_wake = fn;
rj at beldin:~/mio_linux/kernel$ git show v3.3:drivers/gpio/gpio-pxa.c | grep set_wake
rj at beldin:~/mio_linux/kernel$ 

[2]
rj at beldin:~/mio_linux/kernel$ git log v3.3 ^v3.2 --pretty=format:%an drivers/gpio/gpio-pxa.c | sort -u
Haojian Zhuang

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

* [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag
  2012-04-19 19:40                 ` Robert Jarzmik
@ 2012-04-20  0:55                   ` Haojian Zhuang
  2012-04-22 11:37                     ` [PATCH] arm/pxa: fix gpio wakeup setting Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Haojian Zhuang @ 2012-04-20  0:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 20, 2012 at 3:40 AM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>
> Haojian,
>
> I feel there's some change in PXA gpio wakeup handling that's weird.
>
> The effect : gpio_keys driver can't wakeup from suspend to RAM on GPIO0
> activation
>
> A quick analysis (thanks Paul for direction) :
> ?- gpio_keys() calls irq_set_wake(96, 1) (ie. gpio0)
> ?- gpio-pxa driver doesn't care (as it doesn't have any irq_set_wake function)
> ? (see in [1])
>
> Now if I'm directing the mail at is because you're the only one who commited
> between v3.2 and v3.3 in gpio-pxa driver ([2]).
>
> Could you tell me if removing irq_set_wake() was intentional ?
>
> Cheers.
>
> --
> Robert
>
> [1]
> rj at beldin:~/mio_linux/kernel$ git show v3.2:drivers/gpio/gpio-pxa.c | grep set_wake
> void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
> ? ? ? ?pxa_muxed_gpio_chip.irq_set_wake = fn;
> rj at beldin:~/mio_linux/kernel$ git show v3.3:drivers/gpio/gpio-pxa.c | grep set_wake
> rj at beldin:~/mio_linux/kernel$
>
> [2]
> rj at beldin:~/mio_linux/kernel$ git log v3.3 ^v3.2 --pretty=format:%an drivers/gpio/gpio-pxa.c | sort -u
> Haojian Zhuang

Yes, I need to fix this. The set_wake() function will be transfered to
gpio-pxa driver via platform data.

Thanks
Haojian

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

* [PATCH] arm/pxa: fix gpio wakeup setting
  2012-04-20  0:55                   ` Haojian Zhuang
@ 2012-04-22 11:37                     ` Robert Jarzmik
  2012-04-24 17:46                       ` Robert Jarzmik
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-22 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

In 3.3, gpio wakeup setting was broken. The call
enable_irq_wake() didn't set up the PXA gpio registers
(PWER, ...) anymore.

Fix it at least for pxa27x. The driver doesn't seem to be
used in pxa25x (weird ...), and the fix doesn't extend to
pxa3xx and pxa95x (which don't have a gpio_set_wake()
available).

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/mach-pxa/pxa27x.c |    6 +++++-
 drivers/gpio/gpio-pxa.c    |   21 +++++++++++++++++++--
 include/linux/gpio-pxa.h   |    4 ++++
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 6bce78e..4726c24 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -421,8 +421,11 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 	pxa_register_device(&pxa27x_device_i2c_power, info);
 }
 
+static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
+	.gpio_set_wake = gpio_set_wake,
+};
+
 static struct platform_device *devices[] __initdata = {
-	&pxa_device_gpio,
 	&pxa27x_device_udc,
 	&pxa_device_pmu,
 	&pxa_device_i2s,
@@ -458,6 +461,7 @@ static int __init pxa27x_init(void)
 		register_syscore_ops(&pxa2xx_mfp_syscore_ops);
 		register_syscore_ops(&pxa2xx_clock_syscore_ops);
 
+		pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info);
 		ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	}
 
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 5689ce6..fc3ace3 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -64,6 +64,7 @@ struct pxa_gpio_chip {
 	unsigned long	irq_mask;
 	unsigned long	irq_edge_rise;
 	unsigned long	irq_edge_fall;
+	int (*set_wake)(unsigned int gpio, unsigned int on);
 
 #ifdef CONFIG_PM
 	unsigned long	saved_gplr;
@@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 				(value ? GPSR_OFFSET : GPCR_OFFSET));
 }
 
-static int __devinit pxa_init_gpio_chip(int gpio_end)
+static int __devinit pxa_init_gpio_chip(int gpio_end,
+					int (*set_wake)(unsigned int, unsigned int))
 {
 	int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
 	struct pxa_gpio_chip *chips;
@@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end)
 
 		sprintf(chips[i].label, "gpio-%d", i);
 		chips[i].regbase = gpio_reg_base + BANK_OFF(i);
+		chips[i].set_wake = set_wake;
 
 		c->base  = gpio;
 		c->label = chips[i].label;
@@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d)
 	writel_relaxed(gfer, c->regbase + GFER_OFFSET);
 }
 
+static int pxa_gpio_set_wake(struct irq_data *d, unsigned int on)
+{
+	int gpio = pxa_irq_to_gpio(d->irq);
+	struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
+
+	if (c->set_wake)
+		return c->set_wake(gpio, on);
+	else
+		return 0;
+}
+
 static void pxa_unmask_muxed_gpio(struct irq_data *d)
 {
 	int gpio = pxa_irq_to_gpio(d->irq);
@@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = {
 	.irq_mask	= pxa_mask_muxed_gpio,
 	.irq_unmask	= pxa_unmask_muxed_gpio,
 	.irq_set_type	= pxa_gpio_irq_type,
+	.irq_set_wake	= pxa_gpio_set_wake,
 };
 
 static int pxa_gpio_nums(void)
@@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev)
 	struct pxa_gpio_chip *c;
 	struct resource *res;
 	struct clk *clk;
+	struct pxa_gpio_platform_data *info;
 	int gpio, irq, ret;
 	int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
 
@@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev)
 	}
 
 	/* Initialize GPIO chips */
-	pxa_init_gpio_chip(pxa_last_gpio);
+	info = dev_get_platdata(&pdev->dev);
+	pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL);
 
 	/* clear all GPIO edge detects */
 	for_each_gpio_chip(gpio, c) {
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
index 05071ee..d755b28 100644
--- a/include/linux/gpio-pxa.h
+++ b/include/linux/gpio-pxa.h
@@ -13,4 +13,8 @@ extern int pxa_last_gpio;
 
 extern int pxa_irq_to_gpio(int irq);
 
+struct pxa_gpio_platform_data {
+	int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
+};
+
 #endif /* __GPIO_PXA_H */
-- 
1.7.5.4

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

* [PATCH] arm/pxa: fix gpio wakeup setting
  2012-04-22 11:37                     ` [PATCH] arm/pxa: fix gpio wakeup setting Robert Jarzmik
@ 2012-04-24 17:46                       ` Robert Jarzmik
  2012-04-27  2:52                         ` Haojian Zhuang
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Jarzmik @ 2012-04-24 17:46 UTC (permalink / raw)
  To: linux-arm-kernel

Robert Jarzmik <robert.jarzmik@free.fr> writes:

> In 3.3, gpio wakeup setting was broken. The call
> enable_irq_wake() didn't set up the PXA gpio registers
> (PWER, ...) anymore.
>
> Fix it at least for pxa27x. The driver doesn't seem to be
> used in pxa25x (weird ...), and the fix doesn't extend to
> pxa3xx and pxa95x (which don't have a gpio_set_wake()
> available).

Haojian, ping.
I'd like this to be included in 3.4, are you available nowadays ?

Cheers.

--
Robert

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

* [PATCH] arm/pxa: fix gpio wakeup setting
  2012-04-24 17:46                       ` Robert Jarzmik
@ 2012-04-27  2:52                         ` Haojian Zhuang
  0 siblings, 0 replies; 14+ messages in thread
From: Haojian Zhuang @ 2012-04-27  2:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 25, 2012 at 1:46 AM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Robert Jarzmik <robert.jarzmik@free.fr> writes:
>
>> In 3.3, gpio wakeup setting was broken. The call
>> enable_irq_wake() didn't set up the PXA gpio registers
>> (PWER, ...) anymore.
>>
>> Fix it at least for pxa27x. The driver doesn't seem to be
>> used in pxa25x (weird ...), and the fix doesn't extend to
>> pxa3xx and pxa95x (which don't have a gpio_set_wake()
>> available).
>
> Haojian, ping.
> I'd like this to be included in 3.4, are you available nowadays ?
>
> Cheers.
>
> --
> Robert

Applied

Regards
Haojian

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

end of thread, other threads:[~2012-04-27  2:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 14:06 [PATCH] gpio: pxa: Set PXA GPIO irq_chip IRQCHIP_SKIP_SET_WAKE flag Paul Parsons
2012-04-12 18:07 ` Paul Parsons
2012-04-17 21:28   ` Robert Jarzmik
2012-04-18  1:04     ` Paul Parsons
2012-04-18 10:58       ` Paul Parsons
2012-04-18 18:21         ` Robert Jarzmik
2012-04-18 19:34           ` Paul Parsons
2012-04-18 20:59             ` Robert Jarzmik
2012-04-18 22:40               ` Paul Parsons
2012-04-19 19:40                 ` Robert Jarzmik
2012-04-20  0:55                   ` Haojian Zhuang
2012-04-22 11:37                     ` [PATCH] arm/pxa: fix gpio wakeup setting Robert Jarzmik
2012-04-24 17:46                       ` Robert Jarzmik
2012-04-27  2:52                         ` Haojian Zhuang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.