* [PATCH] mfd: tps6586x: implement irq_set_wake
@ 2013-09-06 23:17 Stephen Warren
2013-09-09 9:07 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2013-09-06 23:17 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones; +Cc: linux-kernel, ldewangan, Stephen Warren
From: Stephen Warren <swarren@nvidia.com>
rtc-tps6586x calls enable/disable_irq_wake() during suspend/resume. Since
the main tps6586x irq_chip doesn't implement .irq_set_wake, this causes
the RTC's enable_irq_wake() to fail, and the disable_irq_wake() to spew a
WARN about unbalanced wake disable. Solve this by implementing
.irq_set_wake.
Also, I assume that enable_irq_wake() shouldn't be called unconditionally
in tps6586x_irq_init(), since this is now triggered by IRQ children
setting up their cascaded IRQs for wake. So, remove that.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
I'm tempted to Cc stable here, since this bug is certainly present in
older kernel releases. However, the only user-visible aspect is the WARN
on resume, so I'm not sure if it's worth it?
---
drivers/mfd/tps6586x.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index f54fe4d..68906b1 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -124,6 +124,7 @@ struct tps6586x {
struct i2c_client *client;
struct regmap *regmap;
+ int irq;
struct irq_chip irq_chip;
struct mutex irq_lock;
int irq_base;
@@ -261,12 +262,23 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data)
mutex_unlock(&tps6586x->irq_lock);
}
+#ifdef CONFIG_PM_SLEEP
+static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on)
+{
+ struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
+ return irq_set_irq_wake(tps6586x->irq, on);
+}
+#else
+#define tps6586x_irq_set_wake NULL
+#endif
+
static struct irq_chip tps6586x_irq_chip = {
.name = "tps6586x",
.irq_bus_lock = tps6586x_irq_lock,
.irq_bus_sync_unlock = tps6586x_irq_sync_unlock,
.irq_disable = tps6586x_irq_disable,
.irq_enable = tps6586x_irq_enable,
+ .irq_set_wake = tps6586x_irq_set_wake,
};
static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq,
@@ -331,6 +343,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq,
int new_irq_base;
int irq_num = ARRAY_SIZE(tps6586x_irqs);
+ tps6586x->irq = irq;
+
mutex_init(&tps6586x->irq_lock);
for (i = 0; i < 5; i++) {
tps6586x->mask_reg[i] = 0xff;
@@ -360,10 +374,8 @@ static int tps6586x_irq_init(struct tps6586x *tps6586x, int irq,
ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT,
"tps6586x", tps6586x);
- if (!ret) {
+ if (!ret)
device_init_wakeup(tps6586x->dev, 1);
- enable_irq_wake(irq);
- }
return ret;
}
--
1.8.1.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: tps6586x: implement irq_set_wake
2013-09-06 23:17 [PATCH] mfd: tps6586x: implement irq_set_wake Stephen Warren
@ 2013-09-09 9:07 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2013-09-09 9:07 UTC (permalink / raw)
To: Stephen Warren; +Cc: Samuel Ortiz, linux-kernel, ldewangan, Stephen Warren
On Fri, 06 Sep 2013, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> rtc-tps6586x calls enable/disable_irq_wake() during suspend/resume. Since
> the main tps6586x irq_chip doesn't implement .irq_set_wake, this causes
> the RTC's enable_irq_wake() to fail, and the disable_irq_wake() to spew a
> WARN about unbalanced wake disable. Solve this by implementing
> .irq_set_wake.
>
> Also, I assume that enable_irq_wake() shouldn't be called unconditionally
> in tps6586x_irq_init(), since this is now triggered by IRQ children
> setting up their cascaded IRQs for wake. So, remove that.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> I'm tempted to Cc stable here, since this bug is certainly present in
> older kernel releases. However, the only user-visible aspect is the WARN
> on resume, so I'm not sure if it's worth it?
Can't do any harm?
> ---
> drivers/mfd/tps6586x.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
Patch applied.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-09 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 23:17 [PATCH] mfd: tps6586x: implement irq_set_wake Stephen Warren
2013-09-09 9:07 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®