diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 72bb002c88ec..b4eb3b3c6c2c 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -415,10 +415,14 @@ static int sprd_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) u32 val; /* - * If aie_timer is enabled, we should get the normal alarm time. + * Before RTC device is registered, it will check to see if there is an + * alarm already set in RTC hardware, and we always read the normal + * alarm at this time. + * + * Or if aie_timer is enabled, we should get the normal alarm time. * Otherwise we should get auxiliary alarm time. */ - if (rtc->rtc && rtc->rtc->aie_timer.enabled == 0) + if (rtc->rtc && rtc->rtc->registered && rtc->rtc->aie_timer.enabled == 0) return sprd_rtc_read_aux_alarm(dev, alrm); ret = sprd_rtc_get_secs(rtc, SPRD_RTC_ALARM, &secs);