]> git.itanic.dy.fi Git - linux-stable/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:46:44 +0000 (14:46 +0100)
commit6698015a135887a55621e35f65f6b4a448f19e1f
treed446bb7540db0ca3f1f7c00fc7dbb340baa7c542
parent4cd97e29c3dd3ef05c92dbae84bb45bceb9ea14b
rtc: pcf2127: bugfix: read rtc disables watchdog

[ Upstream commit 7f43020e3bdb63d65661ed377682702f8b34d3ea ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-pcf2127.c