aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1347.c
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2022-10-27 17:32:49 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2022-11-15 21:01:51 +0100
commit4dfe05bdc1ade79b943d4979a2e2a8b5ef68fbb5 (patch)
treefad586ba8d243ba16fe745c9ad54d3d14914bbd5 /drivers/rtc/rtc-ds1347.c
parente59b3c730b44f042540319d62cba73054fd928c8 (diff)
downloadlinux-4dfe05bdc1ade79b943d4979a2e2a8b5ef68fbb5.tar.gz
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: 147dae76dbb9 ("rtc: ds1347: handle century register") Cc: <stable@vger.kernel.org> # v5.5+ Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20221027163249.447416-1-abbotti@mev.co.uk Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1347.c')
-rw-r--r--drivers/rtc/rtc-ds1347.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index 157bf5209ac40..a40c1a52df659 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -112,7 +112,7 @@ static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
return err;
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)
return err;