aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
authorEsben Haabendal <[email protected]>2025-05-16 07:23:39 +0000
committerAlexandre Belloni <[email protected]>2025-10-09 21:34:52 +0000
commit9db26d5855d0374d4652487bfb5aacf40821c469 (patch)
treeb9c0b139b6a361f8992536b61c0994b6e55b0eca /drivers/rtc/interface.c
parentrtc: tps6586x: Fix initial enable_irq/disable_irq balance (diff)
downloadkernel-9db26d5855d0374d4652487bfb5aacf40821c469.tar.gz
kernel-9db26d5855d0374d4652487bfb5aacf40821c469.zip
rtc: interface: Ensure alarm irq is enabled when UIE is enabled
When setting a normal alarm, user-space is responsible for using RTC_AIE_ON/RTC_AIE_OFF to control if alarm irq should be enabled. But when RTC_UIE_ON is used, interrupts must be enabled so that the requested irq events are generated. When RTC_UIE_OFF is used, alarm irq is disabled if there are no other alarms queued, so this commit brings symmetry to that. Signed-off-by: Esben Haabendal <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r--drivers/rtc/interface.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 6fafe2a4ae4f..b8b298efd9a9 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -617,6 +617,10 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
rtc->uie_rtctimer.node.expires = ktime_add(now, onesec);
rtc->uie_rtctimer.period = ktime_set(1, 0);
err = rtc_timer_enqueue(rtc, &rtc->uie_rtctimer);
+ if (!err && rtc->ops && rtc->ops->alarm_irq_enable)
+ err = rtc->ops->alarm_irq_enable(rtc->dev.parent, 1);
+ if (err)
+ goto out;
} else {
rtc_timer_remove(rtc, &rtc->uie_rtctimer);
}