Skip to content

Commit 63df0a2

Browse files
Liu Dalingregkh
authored andcommitted
rtc: loongson: Add missing alarm notifications for ACPI RTC events
[ Upstream commit 5af9f1f ] When an application sets and enables an alarm on Loongson RTC devices, the alarm notification fails to propagate to userspace because the ACPI event handler omits calling rtc_update_irq(). As a result, processes waiting via select() or poll() on RTC device files fail to receive alarm notifications. The ACPI interrupt is also triggered multiple times. In loongson_rtc_handler, we need to clear TOY_MATCH0_REG to resolve this issue. Fixes: 09471d8 ("rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr()") Fixes: 1b733a9 ("rtc: Add rtc driver for the Loongson family chips") Signed-off-by: Liu Dalin <[email protected]> Reviewed-by: Binbin Zhou <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 5603562 commit 63df0a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/rtc/rtc-loongson.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ static u32 loongson_rtc_handler(void *id)
129129
{
130130
struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id;
131131

132+
rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF);
133+
134+
/*
135+
* The TOY_MATCH0_REG should be cleared 0 here,
136+
* otherwise the interrupt cannot be cleared.
137+
*/
138+
regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
139+
132140
spin_lock(&priv->lock);
133141
/* Disable RTC alarm wakeup and interrupt */
134142
writel(readl(priv->pm_base + PM1_EN_REG) & ~RTC_EN,

0 commit comments

Comments
 (0)