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

Configure Feed

Select the types of activity you want to include in your feed.

rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe

In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the
kernel time as long as rtc_read_time() succeeds. In some power loss
situations, our supercapacitor-backed DS1342 RTC comes up with either an
unpredictable future time or the default 01/01/00 from the datasheet.
The oscillator stop flag (OSF) is set in these scenarios due to the
power loss and can be used to determine the validity of the RTC data.

Some chip types in the ds1307 driver already have OSF handling to
determine whether .read_time provides valid RTC data or returns -EINVAL.

This change removes the clear of the OSF in .probe as the OSF needs to
be preserved to expand the OSF handling to the ds1341 chip type (note
that DS1341 and DS1342 share a datasheet).

Signed-off-by: Meagan Lloyd <meaganlloyd@linux.microsoft.com>
Reviewed-by: Tyler Hicks <code@tyhicks.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://lore.kernel.org/r/1749665656-30108-2-git-send-email-meaganlloyd@linux.microsoft.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Meagan Lloyd and committed by
Alexandre Belloni
48458654 a3c7f7e1

+1 -3
+1 -3
drivers/rtc/rtc-ds1307.c
··· 1813 1813 regmap_write(ds1307->regmap, DS1337_REG_CONTROL, 1814 1814 regs[0]); 1815 1815 1816 - /* oscillator fault? clear flag, and warn */ 1816 + /* oscillator fault? warn */ 1817 1817 if (regs[1] & DS1337_BIT_OSF) { 1818 - regmap_write(ds1307->regmap, DS1337_REG_STATUS, 1819 - regs[1] & ~DS1337_BIT_OSF); 1820 1818 dev_warn(ds1307->dev, "SET TIME!\n"); 1821 1819 } 1822 1820 break;