diff options
author | Sean Nyekjaer <sean.nyekjaer@prevas.dk> | 2017-02-23 15:01:24 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-02-23 18:38:54 +0100 |
commit | 3769a375ab8380ebecc78d0a3fe6e9079f9d6988 (patch) | |
tree | cb7fd21fee3b4f690415f20102a30606a448c10f | |
parent | 34f54f579a9988e96e85e22fc151c15955ae40f0 (diff) | |
download | linux-3769a375ab8380ebecc78d0a3fe6e9079f9d6988.tar.bz2 |
rtc: pcf2127: bulk read only date and time registers.
Read control registers one by one and bulk read time registers.
This fixes when the clock is read, the watchdog counter register is zeroed.
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | drivers/rtc/rtc-pcf2127.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 2bfdf638b673..f33447c5db85 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -52,9 +52,20 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) struct pcf2127 *pcf2127 = dev_get_drvdata(dev); unsigned char buf[10]; int ret; + int i; - ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_CTRL1, buf, - sizeof(buf)); + for (i = 0; i <= PCF2127_REG_CTRL3; i++) { + ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL1 + i, + (unsigned int *)(buf + i)); + if (ret) { + dev_err(dev, "%s: read error\n", __func__); + return ret; + } + } + + ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_SC, + (buf + PCF2127_REG_SC), + ARRAY_SIZE(buf) - PCF2127_REG_SC); if (ret) { dev_err(dev, "%s: read error\n", __func__); return ret; |