* [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source
@ 2014-04-22 13:59 Krzysztof Kozlowski
2014-04-22 14:00 ` [PATCH 2/2] mfd: sec-core: " Krzysztof Kozlowski
2014-04-28 12:10 ` [PATCH 1/2] mfd: max14577: " Lee Jones
0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-22 13:59 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones, Sangbeom Kim, linux-kernel
Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski
During suspend the IRQ should be disabled even if this is not a wakeup
source. This is a proper way of fixing the IRQ handling issue during
resume (IRQ handler fails because I2C bus did not resume yet).
When device is suspended and max14577 interrupt is signaled the irq chip
will try to handle it regardless of wakeup source. Device could be woken
up by different IRQ but still the IRQ handler will try to read the
registers over I2C bus and fail because I2C bus won't be ready yet:
max14577 2-0025: Failed to read IRQ status: -5
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/mfd/max14577.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 5f13cefe8def..a24c0ba24cdb 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -183,20 +183,18 @@ static int max14577_suspend(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max14577 *max14577 = i2c_get_clientdata(i2c);
- if (device_may_wakeup(dev)) {
+ if (device_may_wakeup(dev))
enable_irq_wake(max14577->irq);
- /*
- * MUIC IRQ must be disabled during suspend if this is
- * a wake up source because it will be handled before
- * resuming I2C.
- *
- * When device is woken up from suspend (e.g. by ADC change),
- * an interrupt occurs before resuming I2C bus controller.
- * Interrupt handler tries to read registers but this read
- * will fail because I2C is still suspended.
- */
- disable_irq(max14577->irq);
- }
+ /*
+ * MUIC IRQ must be disabled during suspend because if it happens
+ * while suspended it will be handled before resuming I2C.
+ *
+ * When device is woken up from suspend (e.g. by ADC change),
+ * an interrupt occurs before resuming I2C bus controller.
+ * Interrupt handler tries to read registers but this read
+ * will fail because I2C is still suspended.
+ */
+ disable_irq(max14577->irq);
return 0;
}
@@ -206,10 +204,9 @@ static int max14577_resume(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max14577 *max14577 = i2c_get_clientdata(i2c);
- if (device_may_wakeup(dev)) {
+ if (device_may_wakeup(dev))
disable_irq_wake(max14577->irq);
- enable_irq(max14577->irq);
- }
+ enable_irq(max14577->irq);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mfd: sec-core: Fix IRQ handling after resume if this is not a wakeup source
2014-04-22 13:59 [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source Krzysztof Kozlowski
@ 2014-04-22 14:00 ` Krzysztof Kozlowski
2014-04-28 12:11 ` Lee Jones
2014-04-28 12:10 ` [PATCH 1/2] mfd: max14577: " Lee Jones
1 sibling, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-22 14:00 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones, Sangbeom Kim, linux-kernel
Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski
During suspend the IRQ should be disabled even if this is not a wakeup
source. This is a proper way of fixing the IRQ handling issue during
resume (IRQ handler fails because I2C bus did not resume yet).
When device is suspended and sec-core interrupt is signaled the irq chip
will try to handle it regardless of wakeup source. Device could be woken
up by different IRQ but still the IRQ handler will try to read the
registers over I2C bus and fail because I2C bus won't be ready yet.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/mfd/sec-core.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 1cf27521fff4..d2fecb9b37d5 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -424,19 +424,18 @@ static int sec_pmic_suspend(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
- if (device_may_wakeup(dev)) {
+ if (device_may_wakeup(dev))
enable_irq_wake(sec_pmic->irq);
- /*
- * PMIC IRQ must be disabled during suspend for RTC alarm
- * to work properly.
- * When device is woken up from suspend by RTC Alarm, an
- * interrupt occurs before resuming I2C bus controller.
- * The interrupt is handled by regmap_irq_thread which tries
- * to read RTC registers. This read fails (I2C is still
- * suspended) and RTC Alarm interrupt is disabled.
- */
- disable_irq(sec_pmic->irq);
- }
+ /*
+ * PMIC IRQ must be disabled during suspend for RTC alarm
+ * to work properly.
+ * When device is woken up from suspend, an
+ * interrupt occurs before resuming I2C bus controller.
+ * The interrupt is handled by regmap_irq_thread which tries
+ * to read RTC registers. This read fails (I2C is still
+ * suspended) and RTC Alarm interrupt is disabled.
+ */
+ disable_irq(sec_pmic->irq);
return 0;
}
@@ -446,10 +445,9 @@ static int sec_pmic_resume(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
- if (device_may_wakeup(dev)) {
+ if (device_may_wakeup(dev))
disable_irq_wake(sec_pmic->irq);
- enable_irq(sec_pmic->irq);
- }
+ enable_irq(sec_pmic->irq);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source
2014-04-22 13:59 [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source Krzysztof Kozlowski
2014-04-22 14:00 ` [PATCH 2/2] mfd: sec-core: " Krzysztof Kozlowski
@ 2014-04-28 12:10 ` Lee Jones
2014-04-28 13:14 ` Krzysztof Kozlowski
1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2014-04-28 12:10 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Samuel Ortiz, Sangbeom Kim, linux-kernel, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
> During suspend the IRQ should be disabled even if this is not a wakeup
> source. This is a proper way of fixing the IRQ handling issue during
> resume (IRQ handler fails because I2C bus did not resume yet).
>
> When device is suspended and max14577 interrupt is signaled the irq chip
> will try to handle it regardless of wakeup source. Device could be woken
> up by different IRQ but still the IRQ handler will try to read the
> registers over I2C bus and fail because I2C bus won't be ready yet:
> max14577 2-0025: Failed to read IRQ status: -5
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
> drivers/mfd/max14577.c | 29 +++++++++++++----------------
> 1 file changed, 13 insertions(+), 16 deletions(-)
It's pretty worrying that these two patches are so alike and they
actually change different files. Is there any way we can unify more of
the code?
Patch applied, thanks.
--
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] 5+ messages in thread
* Re: [PATCH 2/2] mfd: sec-core: Fix IRQ handling after resume if this is not a wakeup source
2014-04-22 14:00 ` [PATCH 2/2] mfd: sec-core: " Krzysztof Kozlowski
@ 2014-04-28 12:11 ` Lee Jones
0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2014-04-28 12:11 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Samuel Ortiz, Sangbeom Kim, linux-kernel, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
On Tue, 22 Apr 2014, Krzysztof Kozlowski wrote:
> During suspend the IRQ should be disabled even if this is not a wakeup
> source. This is a proper way of fixing the IRQ handling issue during
> resume (IRQ handler fails because I2C bus did not resume yet).
>
> When device is suspended and sec-core interrupt is signaled the irq chip
> will try to handle it regardless of wakeup source. Device could be woken
> up by different IRQ but still the IRQ handler will try to read the
> registers over I2C bus and fail because I2C bus won't be ready yet.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
> drivers/mfd/sec-core.c | 28 +++++++++++++---------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
It's pretty worrying that these two patches are so alike and they
actually change different files. Is there any way we can unify more of
the code?
Patch applied, thanks.
--
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] 5+ messages in thread
* Re: [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source
2014-04-28 12:10 ` [PATCH 1/2] mfd: max14577: " Lee Jones
@ 2014-04-28 13:14 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-28 13:14 UTC (permalink / raw)
To: Lee Jones
Cc: Samuel Ortiz, Sangbeom Kim, linux-kernel, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
On pon, 2014-04-28 at 13:10 +0100, Lee Jones wrote:
> > During suspend the IRQ should be disabled even if this is not a wakeup
> > source. This is a proper way of fixing the IRQ handling issue during
> > resume (IRQ handler fails because I2C bus did not resume yet).
> >
> > When device is suspended and max14577 interrupt is signaled the irq chip
> > will try to handle it regardless of wakeup source. Device could be woken
> > up by different IRQ but still the IRQ handler will try to read the
> > registers over I2C bus and fail because I2C bus won't be ready yet:
> > max14577 2-0025: Failed to read IRQ status: -5
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > ---
> > drivers/mfd/max14577.c | 29 +++++++++++++----------------
> > 1 file changed, 13 insertions(+), 16 deletions(-)
>
> It's pretty worrying that these two patches are so alike and they
> actually change different files. Is there any way we can unify more of
> the code?
>
> Patch applied, thanks.
This whole problem happens also on other MAXIM devices on our boards so
actually the real issue could sit in I2C bus controller or S3C PM
suspend/resume code. This is however the easiest fix for now...
Thanks for applying the patches.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-28 13:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 13:59 [PATCH 1/2] mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source Krzysztof Kozlowski
2014-04-22 14:00 ` [PATCH 2/2] mfd: sec-core: " Krzysztof Kozlowski
2014-04-28 12:11 ` Lee Jones
2014-04-28 12:10 ` [PATCH 1/2] mfd: max14577: " Lee Jones
2014-04-28 13:14 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox