From: Jonathan Cameron <jic23@kernel.org>
To: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Cc: "Giorgi Tchankvetadze" <giorgi@tchankvetadze.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Takashi Sakamoto" <o-takashi@sakamocchi.jp>,
"Dixit Parmar" <dixitparmar19@gmail.com>,
Keerthy <j-keerthy@ti.com>,
"Samuel Ortiz" <sameo@linux.intel.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
amitk@kernel.org
Subject: Re: [PATCH] iio: adc: twl4030-madc: read MADC_CTRL1 from the correct module
Date: Sun, 16 Aug 2026 02:06:07 +0100 [thread overview]
Message-ID: <20260816020607.1f35a5b2@jic23-huawei> (raw)
In-Reply-To: <20260805123201.219547-2-giorgitchankvetadze1997@gmail.com>
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>
Whilst I agree this looks likely to be correct, the register
map for this device is crazy, the defines not named in helpful
way and generally it is hard to be entirely sure what was intended.
So, can you provide some background. Is this a problem you ran into,
code inspection, or AI looking for possible problems?
Have you checked what is in the register that seems to be being
incorrectly read? Basically I'm looking for more detail.
Amit is listed in the original driver and is still about - so...
Amit any idea? Was at least 12 years ago (I got bored looking
beyond that) so feel free to say you have no idea :)
> ---
> 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,
> ®val, TWL4030_MADC_CTRL1);
> if (ret) {
> dev_err(madc->dev, "unable to read madc ctrl1 reg 0x%X\n",
prev parent reply other threads:[~2026-08-16 1:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 12:31 Giorgi Tchankvetadze
2026-08-06 6:52 ` Joshua Crofts
2026-08-16 1:06 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260816020607.1f35a5b2@jic23-huawei \
--to=jic23@kernel.org \
--cc=amitk@kernel.org \
--cc=andy@kernel.org \
--cc=dakr@kernel.org \
--cc=dixitparmar19@gmail.com \
--cc=dlechner@baylibre.com \
--cc=giorgi@tchankvetadze.com \
--cc=giorgitchankvetadze1997@gmail.com \
--cc=j-keerthy@ti.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=o-takashi@sakamocchi.jp \
--cc=sameo@linux.intel.com \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®