Commit 4dfe05bd authored by Ian Abbott's avatar Ian Abbott Committed by Alexandre Belloni

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: 147dae76 ("rtc: ds1347: handle century register")
Cc: <stable@vger.kernel.org> # v5.5+
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20221027163249.447416-1-abbotti@mev.co.ukSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent e59b3c73
...@@ -112,7 +112,7 @@ static int ds1347_set_time(struct device *dev, struct rtc_time *dt) ...@@ -112,7 +112,7 @@ static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
return err; return err;
century = (dt->tm_year / 100) + 19; century = (dt->tm_year / 100) + 19;
err = regmap_write(map, DS1347_CENTURY_REG, century); err = regmap_write(map, DS1347_CENTURY_REG, bin2bcd(century));
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment