]> git.baikalelectronics.ru Git - kernel.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)
commitbb490dc2172e136b34ae5060eb09f1cd701d6c2b
treea869b9f42b4d8fe41ae68a6c8dd5a5dfe84d7bf1
parent47673d0a839eff30ef84de675b27152d2648c1b8
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: 59b29c649722 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