Skip to content
Snippets Groups Projects
Commit 3769a375 authored by Sean Nyekjaer's avatar Sean Nyekjaer Committed by Alexandre Belloni
Browse files

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: default avatarSean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 34f54f57
No related branches found
No related tags found
No related merge requests found
...@@ -52,9 +52,20 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -52,9 +52,20 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm)
struct pcf2127 *pcf2127 = dev_get_drvdata(dev); struct pcf2127 *pcf2127 = dev_get_drvdata(dev);
unsigned char buf[10]; unsigned char buf[10];
int ret; int ret;
int i;
ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_CTRL1, buf, for (i = 0; i <= PCF2127_REG_CTRL3; i++) {
sizeof(buf)); 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) { if (ret) {
dev_err(dev, "%s: read error\n", __func__); dev_err(dev, "%s: read error\n", __func__);
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment