Skip to content

Commit 6cb0d85

Browse files
Meagan Lloydgregkh
authored andcommitted
rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe
[ Upstream commit 4845865 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f0b2eee commit 6cb0d85

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/rtc/rtc-ds1307.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,10 +1824,8 @@ static int ds1307_probe(struct i2c_client *client)
18241824
regmap_write(ds1307->regmap, DS1337_REG_CONTROL,
18251825
regs[0]);
18261826

1827-
/* oscillator fault? clear flag, and warn */
1827+
/* oscillator fault? warn */
18281828
if (regs[1] & DS1337_BIT_OSF) {
1829-
regmap_write(ds1307->regmap, DS1337_REG_STATUS,
1830-
regs[1] & ~DS1337_BIT_OSF);
18311829
dev_warn(ds1307->dev, "SET TIME!\n");
18321830
}
18331831
break;

0 commit comments

Comments
 (0)