diff options
author | Keerthy <j-keerthy@ti.com> | 2016-06-01 12:49:07 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-07-09 10:24:44 +0200 |
commit | e29385fab0bf94017fac130ee32f5bb2daf74417 (patch) | |
tree | 8541a455ce5697bfc01ec92580995d06dda808c8 /drivers/rtc/rtc-rs5c372.c | |
parent | rtc: v3020: move rtc-v3020.h to platform_data (diff) | |
download | linux-e29385fab0bf94017fac130ee32f5bb2daf74417.tar.xz linux-e29385fab0bf94017fac130ee32f5bb2daf74417.zip |
rtc: ds1307: Fix relying on reset value for weekday
The reset value of weekday is 0x1. This is wrong since
the reset values of the day/month/year make up to Jan 1 2001.
When computed weekday comes out to be Monday. On a scale
of 1-7(Sunday - Saturday) it should be 0x2. So we should not
be relying on the reset value.
Hence compute the wday using the current date/month/year values.
Check if reset wday is any different from the computed wday,
If different then set the wday which we computed using
date/month/year values.
Document Referred:
http://ww1.microchip.com/downloads/en/DeviceDoc/20002266F.pdf
Fixes: 1d1945d261a2af "drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips"
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
0 files changed, 0 insertions, 0 deletions