All of lore.kernel.org
 help / color / mirror / Atom feed
* zaurus spitz suspend/resume issue
@ 2010-04-18 19:00 - Cortez -
  2010-04-19  5:17 ` [Zaurus-devel] " Pavel Machek
  2010-04-19 13:35 ` Pavel Machek
  0 siblings, 2 replies; 5+ messages in thread
From: - Cortez - @ 2010-04-18 19:00 UTC (permalink / raw)
  To: linux-arm-kernel

Since resuming my spitz from a suspended state doesn't work in 2.6.34-rc3 at
the moment, I've tried to find out what the problem is with suspend/resume.
Using CONFIG_PM_DEBUG I tried to test this by setting /sys/power/pm_test to
"core" and switching the device off with the power button. This indeed
suspends and resumes the device, but shows following in the system log:

apm-power: Requesting system suspend...
PM: Syncing filesystems ...
done.
Freezing user space processes ... (elapsed 0.02 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 95.695 msecs
PM: late suspend of devices complete after 1.460 msecs
suspend debug: Waiting for 5 seconds.
PM: early resume of devices complete after 722.103 msecs
------------[ cut here ]------------
WARNING: at kernel/irq/manage.c:361 set_irq_wake+0xa4/0x130()
Unbalanced IRQ 191 wake disable
Modules linked in:
Backtrace:
[<c0024118>] (dump_backtrace+0x0/0x110) from [<c028d7f8>]
(dump_stack+0x18/0x1c)
r7:c3d0de10 r6:c006177c r5:c0312002 r4:00000169
[<c028d7e0>] (dump_stack+0x0/0x1c) from [<c0033fa4>]
(warn_slowpath_common+0x50/0x80)
[<c0033f54>] (warn_slowpath_common+0x0/0x80) from [<c0034020>]
(warn_slowpath_fmt+0x30/0x38)
r7:00000000 r6:000000bf r5:c035e6a0 r4:00000000
[<c0033ff0>] (warn_slowpath_fmt+0x0/0x38) from [<c006177c>]
(set_irq_wake+0xa4/0x130)
r3:000000bf r2:c0312040
[<c00616d8>] (set_irq_wake+0x0/0x130) from [<c01f6814>]
(gpio_keys_resume+0x68/0xa0)
r8:00000034 r7:c03582d0 r6:c3e9ee40 r5:c0358708 r4:00000000
[<c01f67ac>] (gpio_keys_resume+0x0/0xa0) from [<c01bc68c>]
(platform_pm_resume+0x48/0x54)
r8:00000000 r7:c035830c r6:c03582d8 r5:c02ad58c r4:00000010
[<c01bc644>] (platform_pm_resume+0x0/0x54) from [<c01bed44>]
(pm_op+0x78/0xc4)
[<c01beccc>] (pm_op+0x0/0xc4) from [<c01bf218>] (device_resume+0x88/0x140)
r9:00000003 r8:00000010 r6:00000010 r5:c03582d8 r4:c03582d8
[<c01bf190>] (device_resume+0x0/0x140) from [<c01bf438>]
(dpm_resume_end+0x118/0x364)
r7:c036eff0 r6:00000000 r5:c0358330 r4:c03582d8
[<c01bf320>] (dpm_resume_end+0x0/0x364) from [<c005e54c>]
(suspend_devices_and_enter+0x194/0x1e4)
[<c005e3b8>] (suspend_devices_and_enter+0x0/0x1e4) from [<c005e688>]
(enter_state+0xec/0x144)
r6:00000003 r5:c030e820 r4:00000000
[<c005e59c>] (enter_state+0x0/0x144) from [<c005e704>]
(pm_suspend+0x24/0x28)
r6:c3d0c000 r5:c0389eb8 r4:c3c21500
[<c005e6e0>] (pm_suspend+0x0/0x28) from [<c01b38c8>] (kapmd+0x140/0x1a4)
[<c01b3788>] (kapmd+0x0/0x1a4) from [<c0048cd8>] (kthread+0x84/0x8c)
[<c0048c54>] (kthread+0x0/0x8c) from [<c00373f8>] (do_exit+0x0/0x5c0)
r7:00000000 r6:00000000 r5:00000000 r4:00000000
---[ end trace 08b84d7be31aecaf ]---
PM: resume of devices complete after 1359.861 msecs
Restarting tasks ... done.

I'll investigate further, but if any of you have any hints on how to fix
this, please let me know!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100418/05ade26c/attachment.htm>

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

* [Zaurus-devel] zaurus spitz suspend/resume issue
  2010-04-18 19:00 zaurus spitz suspend/resume issue - Cortez -
@ 2010-04-19  5:17 ` Pavel Machek
  2010-04-19 13:35 ` Pavel Machek
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2010-04-19  5:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi!

(please no html on lists)

On Sun 2010-04-18 21:00:13, - Cortez - wrote:
>    Since resuming my spitz from a suspended state doesn't work in 2.6.34-rc3
>    at the moment, I've tried to find out what the problem is with
>    suspend/resume. Using CONFIG_PM_DEBUG I tried to test this by setting
>    /sys/power/pm_test to "core" and switching the device off with the power
>    button. This indeed suspends and resumes the device, but shows following
>    in the system log:

Strange. Suspend works for me in 34-rc3. Config difference?

>    apm-power: Requesting system suspend...
>    PM: Syncing filesystems ...
>    done.
>    Freezing user space processes ... (elapsed 0.02 seconds) done.
>    Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
>    Suspending console(s) (use no_console_suspend to debug)
>    PM: suspend of devices complete after 95.695 msecs
>    PM: late suspend of devices complete after 1.460 msecs
>    suspend debug: Waiting for 5 seconds.
>    PM: early resume of devices complete after 722.103 msecs
>    ------------[ cut here ]------------
>    WARNING: at kernel/irq/manage.c:361 set_irq_wake+0xa4/0x130()
>    Unbalanced IRQ 191 wake disable

spitz has some crazy lets-link-irq-wakeups-together code, that
interacts badly with matrix kbd handler (but does not break
suspend). Try this.
								Pavel

--- ./arch/arm.ofic/mach-pxa/mfp-pxa2xx.c	2009-09-10 00:13:59.000000000 +0200
+++ ./arch/arm/mach-pxa/mfp-pxa2xx.c	2009-12-29 03:16:40.000000000 +0100
@@ -34,7 +34,6 @@
 struct gpio_desc {
 	unsigned	valid		: 1;
 	unsigned	can_wakeup	: 1;
-	unsigned	keypad_gpio	: 1;
 	unsigned	dir_inverted	: 1;
 	unsigned int	mask; /* bit mask in PWER or PKWR */
 	unsigned int	mux_mask; /* bit mask of muxed gpio bits, 0 if no mux */
@@ -178,9 +177,6 @@
 	if (!d->valid)
 		return -EINVAL;
 
-	if (d->keypad_gpio)
-		return -EINVAL;
-
 	mux_taken = (PWER & d->mux_mask) & (~d->mask);
 	if (on && mux_taken)
 		return -EBUSY;
@@ -231,32 +227,6 @@
 #endif /* CONFIG_PXA25x */
 
 #ifdef CONFIG_PXA27x
-static int pxa27x_pkwr_gpio[] = {
-	13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94,
-	95, 96, 97, 98, 99, 100, 101, 102
-};
-
-int keypad_set_wake(unsigned int on)
-{
-	unsigned int i, gpio, mask = 0;
-
-	if (!on) {
-		PKWR = 0;
-		return 0;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) {
-
-		gpio = pxa27x_pkwr_gpio[i];
-
-		if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP)
-			mask |= gpio_desc[gpio].mask;
-	}
-
-	PKWR = mask;
-	return 0;
-}
-
 #define PWER_WEMUX2_GPIO38	(1 << 16)
 #define PWER_WEMUX2_GPIO53	(2 << 16)
 #define PWER_WEMUX2_GPIO40	(3 << 16)
@@ -273,6 +243,12 @@
 	gpio_desc[(gpio)].mux_mask = PWER_ ## mux ## _MASK;	\
 } while (0)
 
+
+static int pxa27x_pkwr_gpio[] = {
+	13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94,
+	95, 96, 97, 98, 99, 100, 101, 102
+};
+
 static void __init pxa27x_mfp_init(void)
 {
 	int i, gpio;
@@ -291,7 +267,6 @@
 	for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) {
 		gpio = pxa27x_pkwr_gpio[i];
 		gpio_desc[gpio].can_wakeup = 1;
-		gpio_desc[gpio].keypad_gpio = 1;
 		gpio_desc[gpio].mask = 1 << i;
 	}
 
--- ./arch/arm.ofic/mach-pxa/pxa27x.c	2009-09-10 00:13:59.000000000 +0200
+++ ./arch/arm/mach-pxa/pxa27x.c	2009-12-29 03:13:00.000000000 +0100
@@ -323,9 +323,6 @@
 	if (gpio >= 0 && gpio < 128)
 		return gpio_set_wake(gpio, on);
 
-	if (irq == IRQ_KEYPAD)
-		return keypad_set_wake(on);
-
 	switch (irq) {
 	case IRQ_RTCAlrm:
 		mask = PWER_RTC;


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* zaurus spitz suspend/resume issue
  2010-04-18 19:00 zaurus spitz suspend/resume issue - Cortez -
  2010-04-19  5:17 ` [Zaurus-devel] " Pavel Machek
@ 2010-04-19 13:35 ` Pavel Machek
  2010-04-20  6:58   ` Eric Miao
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2010-04-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi!

>    Since resuming my spitz from a suspended state doesn't work in 2.6.34-rc3
>    at the moment, I've tried to find out what the problem is with
>    suspend/resume. Using CONFIG_PM_DEBUG I tried to test this by setting
>    /sys/power/pm_test to "core" and switching the device off with the power
>    button. This indeed suspends and resumes the device, but shows following
>    in the system log:

It works here.

>    ------------[ cut here ]------------
>    WARNING: at kernel/irq/manage.c:361 set_irq_wake+0xa4/0x130()
>    Unbalanced IRQ 191 wake disable

--- ./arch/arm.ofic/mach-pxa/mfp-pxa2xx.c	2009-09-10 00:13:59.000000000 +0200
+++ ./arch/arm/mach-pxa/mfp-pxa2xx.c	2009-12-29 03:16:40.000000000 +0100
@@ -34,7 +34,6 @@
 struct gpio_desc {
 	unsigned	valid		: 1;
 	unsigned	can_wakeup	: 1;
-	unsigned	keypad_gpio	: 1;
 	unsigned	dir_inverted	: 1;
 	unsigned int	mask; /* bit mask in PWER or PKWR */
 	unsigned int	mux_mask; /* bit mask of muxed gpio bits, 0 if no mux */
@@ -178,9 +177,6 @@
 	if (!d->valid)
 		return -EINVAL;
 
-	if (d->keypad_gpio)
-		return -EINVAL;
-
 	mux_taken = (PWER & d->mux_mask) & (~d->mask);
 	if (on && mux_taken)
 		return -EBUSY;
@@ -231,32 +227,6 @@
 #endif /* CONFIG_PXA25x */
 
 #ifdef CONFIG_PXA27x
-static int pxa27x_pkwr_gpio[] = {
-	13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94,
-	95, 96, 97, 98, 99, 100, 101, 102
-};
-
-int keypad_set_wake(unsigned int on)
-{
-	unsigned int i, gpio, mask = 0;
-
-	if (!on) {
-		PKWR = 0;
-		return 0;
-	}
-
-	for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) {
-
-		gpio = pxa27x_pkwr_gpio[i];
-
-		if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP)
-			mask |= gpio_desc[gpio].mask;
-	}
-
-	PKWR = mask;
-	return 0;
-}
-
 #define PWER_WEMUX2_GPIO38	(1 << 16)
 #define PWER_WEMUX2_GPIO53	(2 << 16)
 #define PWER_WEMUX2_GPIO40	(3 << 16)
@@ -273,6 +243,12 @@
 	gpio_desc[(gpio)].mux_mask = PWER_ ## mux ## _MASK;	\
 } while (0)
 
+
+static int pxa27x_pkwr_gpio[] = {
+	13, 16, 17, 34, 36, 37, 38, 39, 90, 91, 93, 94,
+	95, 96, 97, 98, 99, 100, 101, 102
+};
+
 static void __init pxa27x_mfp_init(void)
 {
 	int i, gpio;
@@ -291,7 +267,6 @@
 	for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) {
 		gpio = pxa27x_pkwr_gpio[i];
 		gpio_desc[gpio].can_wakeup = 1;
-		gpio_desc[gpio].keypad_gpio = 1;
 		gpio_desc[gpio].mask = 1 << i;
 	}
 
--- ./arch/arm.ofic/mach-pxa/pxa27x.c	2009-09-10 00:13:59.000000000 +0200
+++ ./arch/arm/mach-pxa/pxa27x.c	2009-12-29 03:13:00.000000000 +0100
@@ -323,9 +323,6 @@
 	if (gpio >= 0 && gpio < 128)
 		return gpio_set_wake(gpio, on);
 
-	if (irq == IRQ_KEYPAD)
-		return keypad_set_wake(on);
-
 	switch (irq) {
 	case IRQ_RTCAlrm:
 		mask = PWER_RTC;


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* zaurus spitz suspend/resume issue
  2010-04-19 13:35 ` Pavel Machek
@ 2010-04-20  6:58   ` Eric Miao
  2010-04-20 13:36     ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Miao @ 2010-04-20  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 19, 2010 at 9:35 PM, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
>> ? ?Since resuming my spitz from a suspended state doesn't work in 2.6.34-rc3
>> ? ?at the moment, I've tried to find out what the problem is with
>> ? ?suspend/resume. Using CONFIG_PM_DEBUG I tried to test this by setting
>> ? ?/sys/power/pm_test to "core" and switching the device off with the power
>> ? ?button. This indeed suspends and resumes the device, but shows following
>> ? ?in the system log:
>
> It works here.
>

Or maybe we should allow these GPIOs to wakeup the system when either
configured as generic GPIOs or keypad GPIOs.

Cortez,

Could you give the following patch a try?

commit a510268069ed9ad0931339d6dc835ef4f1588876
Author: Eric Miao <eric.y.miao@gmail.com>
Date:   Tue Apr 20 14:52:50 2010 +0800

    [ARM] pxa: allow keypad GPIOs to wakeup when configured as generic

    Signed-off-by: Eric Miao <eric.y.miao@gmail.com>

diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index cf6b720..29301d2 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -178,8 +178,17 @@ int gpio_set_wake(unsigned int gpio, unsigned int on)
 	if (!d->valid)
 		return -EINVAL;

-	if (d->keypad_gpio)
-		return -EINVAL;
+	/* Allow keypad GPIOs to wakeup system when
+	 * configured as generic GPIOs.
+	 */
+	if (d->keypad_gpio && (MFP_AF(d->config) == 0) &&
+	    (d->config & MFP_LPM_CAN_WAKEUP)) {
+		if (on)
+			PKWR |= d->mask;
+		else
+			PKWR &= ~d->mask;
+		return 0;
+	}

 	mux_taken = (PWER & d->mux_mask) & (~d->mask);
 	if (on && mux_taken)
@@ -239,21 +248,25 @@ static int pxa27x_pkwr_gpio[] = {
 int keypad_set_wake(unsigned int on)
 {
 	unsigned int i, gpio, mask = 0;
-
-	if (!on) {
-		PKWR = 0;
-		return 0;
-	}
+	struct gpio_desc *d;

 	for (i = 0; i < ARRAY_SIZE(pxa27x_pkwr_gpio); i++) {

 		gpio = pxa27x_pkwr_gpio[i];
+		d = &gpio_desc[gpio];

-		if (gpio_desc[gpio].config & MFP_LPM_CAN_WAKEUP)
+		/* skip if configured as generic GPIO */
+		if (MFP_AF(d->config) == 0)
+			continue;
+
+		if (d->config & MFP_LPM_CAN_WAKEUP)
 			mask |= gpio_desc[gpio].mask;
 	}

-	PKWR = mask;
+	if (on)
+		PKWR |= mask;
+	else
+		PKWR &= ~mask;
 	return 0;
 }

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

* zaurus spitz suspend/resume issue
  2010-04-20  6:58   ` Eric Miao
@ 2010-04-20 13:36     ` Pavel Machek
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2010-04-20 13:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi!

> >> ? ?Since resuming my spitz from a suspended state doesn't work in 2.6.34-rc3
> >> ? ?at the moment, I've tried to find out what the problem is with
> >> ? ?suspend/resume. Using CONFIG_PM_DEBUG I tried to test this by setting
> >> ? ?/sys/power/pm_test to "core" and switching the device off with the power
> >> ? ?button. This indeed suspends and resumes the device, but shows following
> >> ? ?in the system log:
> >
> > It works here.
> 
> Or maybe we should allow these GPIOs to wakeup the system when either
> configured as generic GPIOs or keypad GPIOs.

So... there's a bug in pxa-keypad driver -- it enables wakeup on one
line when it needs wakeup on all.

So we invented a workaround, in mfp-pxa2xx.c, where we change wakeup
on many lines when pxa-keypad wants to toggle wakeup on one.

But that workaround causes problems, so we

> diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
> index cf6b720..29301d2 100644
> --- a/arch/arm/mach-pxa/mfp-pxa2xx.c
> +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
> @@ -178,8 +178,17 @@ int gpio_set_wake(unsigned int gpio, unsigned int on)
> -	if (d->keypad_gpio)
> -		return -EINVAL;
> +	/* Allow keypad GPIOs to wakeup system when
> +	 * configured as generic GPIOs.
> +	 */
> +	if (d->keypad_gpio && (MFP_AF(d->config) == 0) &&
> +	    (d->config & MFP_LPM_CAN_WAKEUP)) {
> +		if (on)
> +			PKWR |= d->mask;
> +		else
> +			PKWR &= ~d->mask;
> +		return 0;
> +	}

Add more hacks on top.

What about simply fixing pxa-keypad? Then we can git of workaround,
and spitz will be fixed.

Fix should be as simple as replacing enable_irq_wakeup() with more
enable_irq_wakeup()s. 
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2010-04-20 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-18 19:00 zaurus spitz suspend/resume issue - Cortez -
2010-04-19  5:17 ` [Zaurus-devel] " Pavel Machek
2010-04-19 13:35 ` Pavel Machek
2010-04-20  6:58   ` Eric Miao
2010-04-20 13:36     ` Pavel Machek

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.