Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45ef0458 authored by Jan Kardell's avatar Jan Kardell Committed by Linus Torvalds
Browse files

rtc: pcf8563: fix write of invalid bits to ST2 reg



The NXP datasheet says:
 "Bits labeled as N should always be written with logic 0."

At least one of those bits is sometime read as a 1, therfore violating
this rule.  To fix this we mask away those bits.

Signed-off-by: default avatarJan Kardell <jan.kardell@telliq.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Vincent Donnefort <vdonnefort@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 17a1e5e8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#define PCF8563_REG_ST2		0x01
#define PCF8563_BIT_AIE		(1 << 1)
#define PCF8563_BIT_AF		(1 << 3)
#define PCF8563_BITS_ST2_N	(7 << 5)

#define PCF8563_REG_SC		0x02 /* datetime */
#define PCF8563_REG_MN		0x03
@@ -130,7 +131,7 @@ static int pcf8563_set_alarm_mode(struct i2c_client *client, bool on)
	else
		buf &= ~PCF8563_BIT_AIE;

	buf &= ~PCF8563_BIT_AF;
	buf &= ~(PCF8563_BIT_AF | PCF8563_BITS_ST2_N);

	err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf);
	if (err < 0) {