[PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module

Giorgi Tchankvetadze <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Giorgi Tchankvetadze <[email protected]>

twl4030_madc_set_power() does a read-modify-write on MADC_CTRL1 but
reads it from TWL_MODULE_MAIN_CHARGE while writing it back to
TWL4030_MODULE_MADC.

Fix it by reading MADC_CTRL1 from TWL4030_MODULE_MADC
so the read-modify-write operates on the register's actual
contents.

Fixes: f99c1d4f94f9 ("mfd: Add twl4030 madc driver")
Signed-off-by: Giorgi Tchankvetadze <[email protected]>
---
 drivers/iio/adc/twl4030-madc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 0ee7e16b5e24..1156e68ebd91 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -718,7 +718,7 @@ static int twl4030_madc_set_power(struct twl4030_madc_data *madc, int on)
 	u8 regval;
 	int ret;
 
-	ret = twl_i2c_read_u8(TWL_MODULE_MAIN_CHARGE,
+	ret = twl_i2c_read_u8(TWL4030_MODULE_MADC,
 			      &regval, TWL4030_MADC_CTRL1);
 	if (ret) {
 		dev_err(madc->dev, "unable to read madc ctrl1 reg 0x%X\n",
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.