RE: Unbalanced IRQ wake disable during resume from static suspend

Santosh Shilimkar
2010-12-02T11:10:31Z

[-- Attachment #1: Type: text/plain, Size: 5045 bytes --]

Thanks Govind for testing it.

> -----Original Message-----
> From: Govindraj [mailto:govindraj.ti@gmail.com]
> Sent: Thursday, December 02, 2010 4:05 PM
> To: Santosh Shilimkar
> Cc: Paul Walmsley; linux-omap@vger.kernel.org;
khilman@deeprootsystems.com
> Subject: Re: Unbalanced IRQ wake disable during resume from static
suspend
>
> On Thu, Dec 2, 2010 at 2:38 PM, Santosh Shilimkar
> <santosh.shilimkar@ti.com> wrote:
> > Paul,
> >> -----Original Message-----
> >> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> >> owner@vger.kernel.org] On Behalf Of Paul Walmsley
> >> Sent: Thursday, December 02, 2010 1:44 PM
> >> To: linux-omap@vger.kernel.org; Govindraj
> >> Cc: khilman@deeprootsystems.com
> >> Subject: Re: Unbalanced IRQ wake disable during resume from static
> > suspend
> >>
> >> On Thu, 2 Dec 2010, Paul Walmsley wrote:
> >>
> >> > On current linux-omap master (commit
> >> > 7fd1cffc56ca9944fec583eb2ecda5ce88b36bff "Linux-omap rebuilt:
Updated
> > to
> >> > -rc4"), when resuming from static suspend, several "Unbalanced IRQ
> >> > wake disable" warnings are generated, one for each of the serial
> > ports.
> >> > This is on Beagle 35xx rev C2.
> >>
> >> Just to follow up on this, these messages are not logged when
> >> /sys/devices/platform/omap/omap-hsuart.*/tty/ttyO*/power/wakeup are
set
> > to
> >> 'disabled'.
> >>
> >> Also this is with omap2plus_defconfig.
> >>
> > Just a wild guess here but is this because the 'set_wake' is
> > not setup and then fw might be returning some error whenever
> > driver invoke this API as part of enable_irq_wake() callback
> >
> > If that being the case, below patch might might help. Can
> > somebody try this out ?
> >
>
> Tested on 3630SDP.
> The below patch helps to avoid the warnings.
>

Here is the refreshed version with change log. Also
attached the patch in case google mails raps it up.

>From 0170159ae34957efb839d9143123f7ced795f62e Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Thu, 2 Dec 2010 14:36:17 +0530
Subject: [PATCH] omap: irq: Dummy handler for enable_irq_wake

With PM enabled, enable_irq_wake() has a callback for
interrupt controllers. But since omap INTC handler did not had this
call back associated, it was always returning -ENXIO, which was
breaking the existing drivers. This patch adds dummy handlers in
in order to avoid breaking of existing drivers.

Without this patch you get below warnings with wakeup enabled on devices

------------[ cut here ]------------
WARNING: at kernel/irq/manage.c:382 set_irq_wake+0x80/0xe4()
Unbalanced IRQ 72 wake disable
Modules linked in:
[<c0062a28>] (unwind_backtrace+0x0/0xec) from [<c0092260>]
(warn_slowpath_common+0x4c/0x64)
[<c0092260>] (warn_slowpath_common+0x4c/0x64) from [<c00922f8>]
(warn_slowpath_fmt+0x2c/0x3c

[<c00922f8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c00d3238>]
(set_irq_wake+0x80/0xe4)
[<c00d3238>] (set_irq_wake+0x80/0xe4) from [<c029dd60>]
(uart_resume_port+0x84/0x248)
[<c029dd60>] (uart_resume_port+0x84/0x248) from [<c02a2338>]
(serial_omap_resume+0x20/0x2c)
[<c02a2338>] (serial_omap_resume+0x20/0x2c) from [<c02a92d4>]
(platform_pm_resume+0x48/0x54)
[<c02a92d4>] (platform_pm_resume+0x48/0x54) from [<c02abd1c>]
(pm_op+0x6c/0xac)
[<c02abd1c>] (pm_op+0x6c/0xac) from [<c02ac0fc>]
(device_resume+0x58/0x10c)
[<c02ac0fc>] (device_resume+0x58/0x10c) from [<c02ac2ec>]
(dpm_resume_end+0xf4/0x360)
[<c02ac2ec>] (dpm_resume_end+0xf4/0x360) from [<c00cf58c>]
(suspend_devices_and_enter+0x1ac/
0x200)
[<c00cf58c>] (suspend_devices_and_enter+0x1ac/0x200) from [<c00cf6c0>]
(enter_state+0xe0/0x1
38)
[<c00cf6c0>] (enter_state+0xe0/0x138) from [<c00ced18>]
(state_store+0x90/0xb8)
[<c00ced18>] (state_store+0x90/0xb8) from [<c0243b98>]
(kobj_attr_store+0x18/0x1c)
[<c0243b98>] (kobj_attr_store+0x18/0x1c) from [<c0176128>]
(sysfs_write_file+0x10c/0x144)
[<c0176128>] (sysfs_write_file+0x10c/0x144) from [<c0125528>]
(vfs_write+0xac/0x134)
[<c0125528>] (vfs_write+0xac/0x134) from [<c012565c>]
(sys_write+0x3c/0x68)
[<c012565c>] (sys_write+0x3c/0x68) from [<c005bb00>]
(ret_fast_syscall+0x0/0x3c)
---[ end trace 19fe50b7b47ba94f ]---

Reported-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
arch/arm/mach-omap2/irq.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 32eeabe..6a964d3 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -143,11 +143,21 @@ static void omap_mask_ack_irq(unsigned int irq)
omap_ack_irq(irq);
}

+#ifdef CONFIG_PM
+static int omap_set_wake(unsigned int irq, unsigned int on)
+{
+ return 0;
+}
+#else
+#define omap_set_wake NULL
+#endif
+
static struct irq_chip omap_irq_chip = {
.name = "INTC",
.ack = omap_mask_ack_irq,
.mask = omap_mask_irq,
.unmask = omap_unmask_irq,
+ .set_wake = omap_set_wake,
};

static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
--
1.6.0.4

[-- Attachment #2: 0001-omap-irq-Dummy-handler-for-enable_irq_wake.patch --]
[-- Type: application/octet-stream, Size: 3172 bytes --]

From 0170159ae34957efb839d9143123f7ced795f62e Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Thu, 2 Dec 2010 14:36:17 +0530
Subject: [PATCH] omap: irq: Dummy handler for enable_irq_wake

With PM enabled, enable_irq_wake() has a callback for
interrupt controllers. But since omap INTC handler did not had this
call back associated, it was always returning -ENXIO, which was
breaking the existing drivers. This patch adds dummy handlers in
in order to avoid breaking of existing drivers.

Without this patch you get below warnings with wakeup enabled on devices

------------[ cut here ]------------
WARNING: at kernel/irq/manage.c:382 set_irq_wake+0x80/0xe4()
Unbalanced IRQ 72 wake disable
Modules linked in:
[<c0062a28>] (unwind_backtrace+0x0/0xec) from [<c0092260>] (warn_slowpath_common+0x4c/0x64)
[<c0092260>] (warn_slowpath_common+0x4c/0x64) from [<c00922f8>] (warn_slowpath_fmt+0x2c/0x3c

[<c00922f8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c00d3238>] (set_irq_wake+0x80/0xe4)
[<c00d3238>] (set_irq_wake+0x80/0xe4) from [<c029dd60>] (uart_resume_port+0x84/0x248)
[<c029dd60>] (uart_resume_port+0x84/0x248) from [<c02a2338>] (serial_omap_resume+0x20/0x2c)
[<c02a2338>] (serial_omap_resume+0x20/0x2c) from [<c02a92d4>] (platform_pm_resume+0x48/0x54)
[<c02a92d4>] (platform_pm_resume+0x48/0x54) from [<c02abd1c>] (pm_op+0x6c/0xac)
[<c02abd1c>] (pm_op+0x6c/0xac) from [<c02ac0fc>] (device_resume+0x58/0x10c)
[<c02ac0fc>] (device_resume+0x58/0x10c) from [<c02ac2ec>] (dpm_resume_end+0xf4/0x360)
[<c02ac2ec>] (dpm_resume_end+0xf4/0x360) from [<c00cf58c>] (suspend_devices_and_enter+0x1ac/
0x200)
[<c00cf58c>] (suspend_devices_and_enter+0x1ac/0x200) from [<c00cf6c0>] (enter_state+0xe0/0x1
38)
[<c00cf6c0>] (enter_state+0xe0/0x138) from [<c00ced18>] (state_store+0x90/0xb8)
[<c00ced18>] (state_store+0x90/0xb8) from [<c0243b98>] (kobj_attr_store+0x18/0x1c)
[<c0243b98>] (kobj_attr_store+0x18/0x1c) from [<c0176128>] (sysfs_write_file+0x10c/0x144)
[<c0176128>] (sysfs_write_file+0x10c/0x144) from [<c0125528>] (vfs_write+0xac/0x134)
[<c0125528>] (vfs_write+0xac/0x134) from [<c012565c>] (sys_write+0x3c/0x68)
[<c012565c>] (sys_write+0x3c/0x68) from [<c005bb00>] (ret_fast_syscall+0x0/0x3c)
---[ end trace 19fe50b7b47ba94f ]---

Reported-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
arch/arm/mach-omap2/irq.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 32eeabe..6a964d3 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -143,11 +143,21 @@ static void omap_mask_ack_irq(unsigned int irq)
omap_ack_irq(irq);
}

+#ifdef CONFIG_PM
+static int omap_set_wake(unsigned int irq, unsigned int on)
+{
+ return 0;
+}
+#else
+#define omap_set_wake NULL
+#endif
+
static struct irq_chip omap_irq_chip = {
.name = "INTC",
.ack = omap_mask_ack_irq,
.mask = omap_mask_irq,
.unmask = omap_unmask_irq,
+ .set_wake = omap_set_wake,
};

static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
--
1.6.0.4