summaryrefslogtreecommitdiff
path: root/chip/stm32/clock-f.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/clock-f.c')
-rw-r--r--chip/stm32/clock-f.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c
index 893e64bb86..51d3511e0e 100644
--- a/chip/stm32/clock-f.c
+++ b/chip/stm32/clock-f.c
@@ -72,6 +72,8 @@ static uint32_t sec_to_rtc_tr(uint32_t sec)
}
#ifdef CONFIG_HOSTCMD_RTC
+static uint8_t host_rtc_alarm_set;
+
static uint32_t rtc_dr_to_sec(uint32_t rtc_dr)
{
struct calendar_date time;
@@ -247,6 +249,13 @@ void __rtc_alarm_irq(void)
struct rtc_time_reg rtc;
reset_rtc_alarm(&rtc);
+#ifdef CONFIG_HOSTCMD_RTC
+ /* Do not wake up the host if the alarm was not set by the host */
+ if (host_rtc_alarm_set) {
+ host_set_events(EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC));
+ host_rtc_alarm_set = 0;
+ }
+#endif
}
DECLARE_IRQ(STM32_IRQ_RTC_ALARM, __rtc_alarm_irq, 1);
@@ -392,6 +401,7 @@ static int system_rtc_set_alarm(struct host_cmd_handler_args *args)
struct rtc_time_reg rtc;
const struct ec_params_rtc *p = args->params;
+ host_rtc_alarm_set = 1;
set_rtc_alarm(p->time, 0, &rtc);
return EC_RES_SUCCESS;
}