linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: max77686: Fix wake-ups for max77620
@ 2020-08-06 12:54 Jon Hunter
  2020-08-06 13:33 ` Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jon Hunter @ 2020-08-06 12:54 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Alessandro Zummo, Alexandre Belloni
  Cc: linux-kernel, linux-rtc, linux-tegra, Jon Hunter

Following commit d8f090dbeafd ("rtc: max77686: Do not allow interrupt to
fire before system resume"), RTC wake-ups stopped working on Jetson TX2
and Jetson Xavier platforms. The Jetson TX2 uses the max77620 PMIC and
the Jetson Xavier uses max20024 PMIC. Both of these PMICs have the same
max77620 RTC controller.

For the max77620 RTC, the variable 'rtc_irq_from_platform' is defined as
true in the max77686 driver and because of this the IRQ passed to the
max77686 driver for RTC is the PMIC IRQ and not the parent. Hence,
following commit d8f090dbeafd ("rtc: max77686: Do not allow interrupt to
fire before system resume"), for the max77620 the RTC IRQ within the
PMIC is now getting disabled on entry to suspend and unable to wake the
system up. Fix this by only disabling interrupts on entry to suspend
in the max77686 RTC driver, if the interrupt is the parent interrupt.

Fixes: d8f090dbeafd ("rtc: max77686: Do not allow interrupt to fire before system resume")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/rtc/rtc-max77686.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 645de5af707b..d51cc12114cb 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -815,13 +815,15 @@ static int max77686_rtc_suspend(struct device *dev)
 	}
 
 	/*
-	 * Main IRQ (not virtual) must be disabled during suspend because if it
-	 * happens while suspended it will be handled before resuming I2C.
+	 * If the main IRQ (not virtual) is the parent IRQ, then it must be
+	 * disabled during suspend because if it happens while suspended it
+	 * will be handled before resuming I2C.
 	 *
 	 * Since Main IRQ is shared, all its users should disable it to be sure
 	 * it won't fire while one of them is still suspended.
 	 */
-	disable_irq(info->rtc_irq);
+	if (!info->drv_data->rtc_irq_from_platform)
+		disable_irq(info->rtc_irq);
 
 	return ret;
 }
@@ -830,7 +832,8 @@ static int max77686_rtc_resume(struct device *dev)
 {
 	struct max77686_rtc_info *info = dev_get_drvdata(dev);
 
-	enable_irq(info->rtc_irq);
+	if (!info->drv_data->rtc_irq_from_platform)
+		enable_irq(info->rtc_irq);
 
 	if (device_may_wakeup(dev)) {
 		struct max77686_rtc_info *info = dev_get_drvdata(dev);
-- 
2.25.1


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

end of thread, other threads:[~2020-08-07 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 12:54 [PATCH] rtc: max77686: Fix wake-ups for max77620 Jon Hunter
2020-08-06 13:33 ` Krzysztof Kozlowski
2020-08-07  7:58 ` Thierry Reding
2020-08-07 21:30 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).