Skip to content

Commit 4dfe05b

Browse files
ian-abbottalexandrebelloni
authored andcommitted
rtc: ds1347: fix value written to century register
In `ds1347_set_time()`, the wrong value is being written to the `DS1347_CENTURY_REG` register. It needs to be converted to BCD. Fix it. Fixes: 147dae7 ("rtc: ds1347: handle century register") Cc: <[email protected]> # v5.5+ Signed-off-by: Ian Abbott <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent e59b3c7 commit 4dfe05b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/rtc/rtc-ds1347.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
112112
return err;
113113

114114
century = (dt->tm_year / 100) + 19;
115-
err = regmap_write(map, DS1347_CENTURY_REG, century);
115+
err = regmap_write(map, DS1347_CENTURY_REG, bin2bcd(century));
116116
if (err)
117117
return err;
118118

0 commit comments

Comments
 (0)