]> git.baikalelectronics.ru Git - kernel.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>
Sun, 8 Nov 2015 13:12:31 +0000 (14:12 +0100)
commit34150a0daa8b94b2702739e77b06eaace2f00853
treeb297da641ef1fec5dfc3ef5f60c6e922d3d21b9c
parent684ae0da615e1aa1f35d28f24fed1fd5495535e6
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: dc7b21d0d012 ("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