mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Roman Vivchar via B4 Relay <devnull+rva333.protonmail.com@kernel.org>
Cc: rva333@protonmail.com, "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"Chen-Yu Tsai" <wenst@chromium.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/3] iio: adc: mt6359-auxadc: mask conversion ready bit in mt6358_read_imp
Date: Tue, 3 Nov 2026 23:45:40 +0000	[thread overview]
Message-ID: <20261103234540.46cc8c1b@jic23-hlaptop> (raw)
In-Reply-To: <20261103-6768-6358-fixes-v1-2-2a868a33152b@protonmail.com>

On Tue, 03 Nov 2026 18:32:08 +0200
Roman Vivchar via B4 Relay <devnull+rva333.protonmail.com@kernel.org> wrote:

> From: Roman Vivchar <rva333@protonmail.com>
> 
> In mt6358_read_imp() the raw ADC value is returned directly without
> masking out ready bit, resulting in incorrect battery voltage reporting.

Can you add where the ready bit is.  That might help someone
looking at wrong values and wondering if this is what is causing them.

This one is pretty glaring as bugs go (given I think this means the
top bit is set?) so any reason it wasn't obvious to anyone testing
this device?

Jonathan


> 
> Apply the mask to strip the ready bit, matching the behavior in
> mt6359_auxadc_read_adc() function.
> 
> Fixes: 3587914bf61d ("iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC")
> Signed-off-by: Roman Vivchar <rva333@protonmail.com>
> ---
>  drivers/iio/adc/mt6359-auxadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/mt6359-auxadc.c b/drivers/iio/adc/mt6359-auxadc.c
> index 951d236f972b..09432d0974cf 100644
> --- a/drivers/iio/adc/mt6359-auxadc.c
> +++ b/drivers/iio/adc/mt6359-auxadc.c
> @@ -502,7 +502,7 @@ static int mt6358_read_imp(struct mt6359_auxadc *adc_dev,
>  	mt6358_stop_imp_conv(adc_dev);
>  
>  	if (vbat)
> -		*vbat = val_v;
> +		*vbat = val_v & GENMASK(chan->scan_type.realbits - 1, 0);
>  	if (ibat)
>  		*ibat = 0;
>  
> 


  reply	other threads:[~2026-11-03 23:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:32 [PATCH 0/3] iio: adc: mt6359-auxadc: various fixes Roman Vivchar via B4 Relay
2026-11-03 16:32 ` [PATCH 1/3] iio: adc: mt6359-auxadc: correct channel types to IIO_VOLTAGE Roman Vivchar via B4 Relay
2026-11-03 23:42   ` Jonathan Cameron
2026-11-04  0:10     ` Roman Vivchar
2026-11-10 20:39     ` Roman Vivchar
2026-11-03 16:32 ` [PATCH 2/3] iio: adc: mt6359-auxadc: mask conversion ready bit in mt6358_read_imp Roman Vivchar via B4 Relay
2026-11-03 23:45   ` Jonathan Cameron [this message]
2026-11-04  0:19     ` Roman Vivchar
2026-11-03 16:32 ` [PATCH 3/3] iio: adc: mt6359-auxadc: fix scale calculation Roman Vivchar via B4 Relay

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=20261103234540.46cc8c1b@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=devnull+rva333.protonmail.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=nuno.sa@analog.com \
    --cc=rva333@protonmail.com \
    --cc=wenst@chromium.org \
    /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®