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

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>

authored by

Ian Abbott and committed by
Alexandre Belloni
4dfe05bd e59b3c73

+1 -1
+1 -1
drivers/rtc/rtc-ds1347.c
··· 112 112 return err; 113 113 114 114 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)); 116 116 if (err) 117 117 return err; 118 118