Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: sc27xx: Always read normal alarm when registering RTC device

When registering one RTC device, it will check to see if there is an
alarm already set in RTC hardware by reading RTC alarm, at this time
we should always read the normal alarm put in always-on region by
checking the rtc->registered flag.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Baolin Wang and committed by
Alexandre Belloni
3822d1bb bf2c532b

+6 -2
+6 -2
drivers/rtc/rtc-sc27xx.c
··· 415 415 u32 val; 416 416 417 417 /* 418 - * If aie_timer is enabled, we should get the normal alarm time. 418 + * Before RTC device is registered, it will check to see if there is an 419 + * alarm already set in RTC hardware, and we always read the normal 420 + * alarm at this time. 421 + * 422 + * Or if aie_timer is enabled, we should get the normal alarm time. 419 423 * Otherwise we should get auxiliary alarm time. 420 424 */ 421 - if (rtc->rtc && rtc->rtc->aie_timer.enabled == 0) 425 + if (rtc->rtc && rtc->rtc->registered && rtc->rtc->aie_timer.enabled == 0) 422 426 return sprd_rtc_read_aux_alarm(dev, alrm); 423 427 424 428 ret = sprd_rtc_get_secs(rtc, SPRD_RTC_ALARM, &secs);