Re: [PATCH] rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions
From: Alexandre Belloni
Date: Mon Nov 18 2019 - 09:19:14 EST
On 16/11/2019 12:46:20+0100, Kars de Jong wrote:
> The msm6242_set()/msm6242_clear() functions are used when writing to Control
> Register D to set or clear the HOLD bit when reading the current time from
> the RTC.
> Doing this with a read-modify-write cycle will potentially clear an
> interrupt condition which occurs between the read and the write.
> The datasheet states the following about this:
> When writing the HOLD or 30 second adjust bits of register D, it is
> necessary to write the IRQ FLAG bit to a "1".
> Since the only other bits in the register are the 30 second adjust bit
> (which is not used) and the BUSY bit (which is read-only), the
> read-modify-write cycle can be replaced by a simple write with the IRQ FLAG
> bit set to 1 and the other bits (except HOLD) set to 0.
> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Tested-by: Kars de Jong <jongk@xxxxxxxxxxxxxx>
> Signed-off-by: Kars de Jong <jongk@xxxxxxxxxxxxxx>
> drivers/rtc/rtc-msm6242.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering