From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>,
robh@kernel.org, conor+dt@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 1/6] iio: adc: ad4080: fix chip identification
Date: Sun, 12 Oct 2025 19:10:17 +0100 [thread overview]
Message-ID: <20251012191017.1ad05768@jic23-huawei> (raw)
In-Reply-To: <ba68afe4fbe5c895de8a2ce506a69e0c0884eb4e.camel@gmail.com>
On Tue, 07 Oct 2025 15:41:02 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Tue, 2025-10-07 at 11:15 +0000, Antoniu Miclaus wrote:
> > Fix AD4080 chip identification by using the correct 16-bit product ID
> > (0x0050) instead of GENMASK(2, 0). Update the chip reading logic to
> > use regmap_bulk_read to read both PRODUCT_ID_L and PRODUCT_ID_H
> > registers and combine them into a 16-bit value.
> >
> > The original implementation was incorrectly reading only 3 bits,
> > which would not correctly identify the AD4080 chip.
> >
> > Fixes: 6b31ba1811b6 ("iio: adc: ad4080: add driver support")
> > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> > ---
>
> Small nitpick below that Jonathan might tweak if he thinks it's worth it.
> Anyways,
>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
I'll tidy that up.
I'm currently taking a possibly controversial route with this patch.
Given I think we just get a false warning message without it, I'm going
to assume this isn't critical and queue it up for next merge window.
The advantage is I don't have to deal with tracking this patch going upstream
before I can apply the others in the series...
Shout if you'd prefer the harder route that gets this upstream faster.
Jonathan
>
> > changes in v3:
> > - use le16_to_cpu to convert the read little-endian value to CPU endianness
> > drivers/iio/adc/ad4080.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ad4080.c b/drivers/iio/adc/ad4080.c
> > index 6e61787ed321..ae5a975a47a5 100644
> > --- a/drivers/iio/adc/ad4080.c
> > +++ b/drivers/iio/adc/ad4080.c
> > @@ -125,7 +125,7 @@
> >
> > /* Miscellaneous Definitions */
> > #define
> > AD4080_SPI_READ BIT(7)
> > -#define AD4080_CHIP_ID GENMASK(2, 0)
> > +#define AD4080_CHIP_ID 0x0050
> >
> > #define AD4080_LVDS_CNV_CLK_CNT_MAX 7
> >
> > @@ -445,7 +445,8 @@ static int ad4080_setup(struct iio_dev *indio_dev)
> > {
> > struct ad4080_state *st = iio_priv(indio_dev);
> > struct device *dev = regmap_get_device(st->regmap);
> > - unsigned int id;
> > + __le16 id_le;
> > + u16 id;
> > int ret;
> >
> > ret = regmap_write(st->regmap, AD4080_REG_INTERFACE_CONFIG_A,
> > @@ -458,10 +459,11 @@ static int ad4080_setup(struct iio_dev *indio_dev)
> > if (ret)
> > return ret;
> >
> > - ret = regmap_read(st->regmap, AD4080_REG_CHIP_TYPE, &id);
> > + ret = regmap_bulk_read(st->regmap, AD4080_REG_PRODUCT_ID_L, &id_le,
> > 2);
>
> sizeof(id_le)
>
> > if (ret)
> > return ret;
> >
> > + id = le16_to_cpu(id_le);
> > if (id != AD4080_CHIP_ID)
> > dev_info(dev, "Unrecognized CHIP_ID 0x%X\n", id);
> >
next prev parent reply other threads:[~2025-10-12 18:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 11:15 [PATCH v3 0/6] iio: adc: ad4080: add support for AD4081 and AD4084 Antoniu Miclaus
2025-10-07 11:15 ` [PATCH v3 1/6] iio: adc: ad4080: fix chip identification Antoniu Miclaus
2025-10-07 14:41 ` Nuno Sá
2025-10-12 18:10 ` Jonathan Cameron [this message]
2025-10-07 11:15 ` [PATCH v3 2/6] iio: adc: ad4080: prepare driver for multi-part support Antoniu Miclaus
2025-10-07 11:15 ` [PATCH v3 3/6] dt-bindings: iio: adc: adi,ad4080: add support for AD4084 Antoniu Miclaus
2025-10-07 11:15 ` [PATCH v3 4/6] iio: adc: ad4080: " Antoniu Miclaus
2025-10-07 11:15 ` [PATCH v3 5/6] dt-bindings: iio: adc: adi,ad4080: add support for AD4081 Antoniu Miclaus
2025-10-07 11:15 ` [PATCH v3 6/6] iio: adc: ad4080: " Antoniu Miclaus
2025-10-12 18:11 ` [PATCH v3 0/6] iio: adc: ad4080: add support for AD4081 and AD4084 Jonathan Cameron
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=20251012191017.1ad05768@jic23-huawei \
--to=jic23@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=robh@kernel.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