OSDN Git Service

rtc: pcf85363: set time accurately
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 24 Feb 2018 00:08:53 +0000 (01:08 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 17 Mar 2018 13:20:49 +0000 (14:20 +0100)
commit188306ac9536ec47674ffa9dd330f69927679aeb
tree1f236c578142e0f542d2226fc1d7eca733c1881e
parente5aac267a10a8fd571032ffba42ccb61ea16ca80
rtc: pcf85363: set time accurately

As per 8.2.6 Setting and reading the time in RTC mode, first stop the clok,
then reset it before setting the date and time registers. Finally, start
the clock.

This uses register address wrap around from 0x2f to 0x00 for efficiency.

This allows to set the clock with a millisecond accuracy (drift is not
corrected in this example):

RTC        System
1325388767 1325388767.000029180
1325388768 1325388768.000018362
1325388769 1325388769.000006544
1325388770 1325388769.999992725
1325388771 1325388770.999974544

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf85363.c