Skip to content

Commit 09471d8

Browse files
Ming Wangalexandrebelloni
authored andcommitted
rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr()
The TOY_MATCH0_REG should be cleared to 0 in the RTC interrupt handler, otherwise the interrupt cannot be cleared, which will cause the loongson_rtc_isr() to be triggered multiple times. The previous code cleared TOY_MATCH0_REG in the loongson_rtc_handler(), which is an ACPI interrupt. This did not prevent loongson_rtc_isr() from being triggered multiple times. This commit moves the clearing of TOY_MATCH0_REG to the loongson_rtc_isr() to ensure that the interrupt is properly cleared. Fixes: 1b733a9 ("rtc: Add rtc driver for the Loongson family chips") Signed-off-by: Ming Wang <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Reviewed-by: Keguang Zhang <[email protected]> # on LS1B Tested-by: Keguang Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 3ab8c5e commit 09471d8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/rtc/rtc-loongson.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ static irqreturn_t loongson_rtc_isr(int irq, void *id)
114114
struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id;
115115

116116
rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF);
117+
118+
/*
119+
* The TOY_MATCH0_REG should be cleared 0 here,
120+
* otherwise the interrupt cannot be cleared.
121+
*/
122+
regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
123+
117124
return IRQ_HANDLED;
118125
}
119126

@@ -131,11 +138,7 @@ static u32 loongson_rtc_handler(void *id)
131138
writel(RTC_STS, priv->pm_base + PM1_STS_REG);
132139
spin_unlock(&priv->lock);
133140

134-
/*
135-
* The TOY_MATCH0_REG should be cleared 0 here,
136-
* otherwise the interrupt cannot be cleared.
137-
*/
138-
return regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
141+
return ACPI_INTERRUPT_HANDLED;
139142
}
140143

141144
static int loongson_rtc_set_enabled(struct device *dev)

0 commit comments

Comments
 (0)