]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
rtc: ds1307: Fix alarm programming for mcp794xx
authorTero Kristo <t-kristo@ti.com>
Fri, 23 Oct 2015 06:29:57 +0000 (09:29 +0300)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Tue, 27 Oct 2015 22:52:18 +0000 (23:52 +0100)
commit5078160c175f99f4ee3504d8af50e16373b6dae8
tree41c183582d6233dd06dbbdee04ac9aa015c32948
parente435811faba73987dcd73fa255ddc268dd7f8b13
rtc: ds1307: Fix alarm programming for mcp794xx

mcp794xx alarm registers must be written in BCD format. However, the
alarm programming logic neglected this by adding one to the value
after bin2bcd conversion has been already done, writing bad values
to month register in case the alarm being set is in October. In this
case, the alarm month value becomes 0x0a instead of the expected 0x10.

Fix by moving the +1 addition within the bin2bcd call also.

Fixes: 1d1945d261a2 ("drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1307.c