rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Fri, 13 Oct 2023 14:34:21 +0000 (16:34 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 15 Oct 2023 20:37:57 +0000 (22:37 +0200)
The current implementation passes PIN_IO_INTA_OUT (2) as a mask and
PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
Swap the variables to assign mask and value the right way.

This error was first introduced with the alarm support. For better or
worse it worked as expected because 0x02 was applied as a mask to 0x03,
resulting 0x02 anyway. This will of course not work for any other value.

Fixes: e5aac267a10a ("rtc: pcf85363: add alarm support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231013-topic-pcf85363_regmap_update_bits-v1-1-c454f016f71f@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf85363.c

index 06194674d71c57510cf1747e8fae45c32e14f84c..540042b9eec8f53fd4bdbd3db0f58ddae1a6df78 100644 (file)
@@ -438,7 +438,7 @@ static int pcf85363_probe(struct i2c_client *client)
        if (client->irq > 0 || wakeup_source) {
                regmap_write(pcf85363->regmap, CTRL_FLAGS, 0);
                regmap_update_bits(pcf85363->regmap, CTRL_PIN_IO,
-                                  PIN_IO_INTA_OUT, PIN_IO_INTAPM);
+                                  PIN_IO_INTAPM, PIN_IO_INTA_OUT);
        }
 
        if (client->irq > 0) {