]> asedeno.scripts.mit.edu Git - linux.git/commit
rtc: pcf2127: bugfix: read rtc disables watchdog
authorBruno Thomsen <bruno.thomsen@gmail.com>
Thu, 22 Aug 2019 13:19:34 +0000 (15:19 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 23 Aug 2019 14:20:50 +0000 (16:20 +0200)
commit7f43020e3bdb63d65661ed377682702f8b34d3ea
treea869b9f42b4d8fe41ae68a6c8dd5a5dfe84d7bf1
parentbbfe3a7a1d411888d86d8ab322d14dc93bae42db
rtc: pcf2127: bugfix: read rtc disables watchdog

The previous fix listed bulk read of registers as root cause of
accendential disabling of watchdog, since the watchdog counter
register (WD_VAL) was zeroed.

Fixes: 3769a375ab83 rtc: pcf2127: bulk read only date and time registers.
Tested with the same PCF2127 chip as Sean reveled root cause
of WD_VAL register value zeroing was caused by reading CTRL2
register which is one of the watchdog feature control registers.

So the solution is to not read the first two control registers
(CTRL1 and CTRL2) in pcf2127_rtc_read_time as they are not
needed anyway. Size of local buf variable is kept to allow
easy usage of register defines to improve readability of code.

Debug trace line was updated after CTRL1 and CTRL2 are no longer
read from the chip. Also replaced magic numbers in buf access
with register defines.

Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Link: https://lore.kernel.org/r/20190822131936.18772-3-bruno.thomsen@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf2127.c