The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module
@ 2026-08-05 12:31 Giorgi Tchankvetadze
  2026-08-06  6:52 ` Joshua Crofts
  0 siblings, 1 reply; 2+ messages in thread
From: Giorgi Tchankvetadze @ 2026-08-05 12:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Giorgi Tchankvetadze, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Danilo Krummrich, Takashi Sakamoto, Dixit Parmar, Keerthy,
	Samuel Ortiz, linux-iio, linux-kernel

From: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>

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 <giorgi@tchankvetadze.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module
  2026-08-05 12:31 [PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module Giorgi Tchankvetadze
@ 2026-08-06  6:52 ` Joshua Crofts
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Crofts @ 2026-08-06  6:52 UTC (permalink / raw)
  To: Giorgi Tchankvetadze
  Cc: Jonathan Cameron, Giorgi Tchankvetadze, David Lechner,
	Nuno Sá, Andy Shevchenko,
	Uwe Kleine-König (The Capable Hub), Danilo Krummrich,
	Takashi Sakamoto, Dixit Parmar, Keerthy, Samuel Ortiz, linux-iio,
	linux-kernel

On Wed,  5 Aug 2026 16:31:59 +0400
Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com> wrote:

> From: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
> 
> 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 <giorgi@tchankvetadze.com>
> ---

This makes sense.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-06  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 12:31 [PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module Giorgi Tchankvetadze
2026-08-06  6:52 ` Joshua Crofts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox