From: Jonathan Cameron <jic23@kernel.org>
To: Marilene Andrade Garcia <marilene.agarcia@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
"Kim Seer Paller" <kimseer.paller@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
"Marcelo Schmitt" <Marcelo.Schmitt@analog.com>,
"Ceclan Dumitru" <dumitru.ceclan@analog.com>,
"Jonathan Santos" <Jonathan.Santos@analog.com>,
"Dragos Bogdan" <dragos.bogdan@analog.com>
Subject: Re: [PATCH v12 2/3] iio: adc: max14001: New driver
Date: Sat, 4 Oct 2025 16:04:26 +0100 [thread overview]
Message-ID: <20251004160426.7876286b@jic23-huawei> (raw)
In-Reply-To: <476b75cff0c3e5ff23ba7c642924511f3ba09a3f.1759121938.git.marilene.agarcia@gmail.com>
On Mon, 29 Sep 2025 02:59:37 -0300
Marilene Andrade Garcia <marilene.agarcia@gmail.com> wrote:
> The MAX14001/MAX14002 is configurable, isolated 10-bit ADCs for multi-range
> binary inputs. In addition to ADC readings, the MAX14001/MAX14002 offers
> more features, like a binary comparator, a filtered reading that can
> provide the average of the last 2, 4, or 8 ADC readings, and an inrush
> comparator that triggers the inrush current. There is also a fault feature
> that can diagnose seven possible fault conditions. And an option to select
> an external or internal ADC voltage reference.
>
> MAX14001/MAX14002 features implemented so far:
> - Raw ADC reading.
> - Filtered ADC average reading with the default configuration.
> - MV fault disable.
> - Selection of external or internal ADC voltage reference, depending on
> whether it is declared in the device tree.
>
> Co-developed-by: Kim Seer Paller <kimseer.paller@analog.com>
> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
> Signed-off-by: Marilene Andrade Garcia <marilene.agarcia@gmail.com>
> ---
>
> Hello maintainers,
> Thank you for reviewing v11 and for your suggestions.
> I believe I have addressed most of the requested code changes in this v12.
> There were some discussions about a few of them, and I tried to follow the
> path that you seemed to agree with.
>
> I have one remaining question related to the max_register attribute of the
> regmap. The register regions that can be accessed are 0x00–0x0c and
> 0x13–0x1a. As suggested, I used max_register to set the upper limit of the
> register region that can be accessed (0x1a). Beyond this address, there is
> a reserved region that should not be used (0x1b–0x1f). However, there is
> also a reserved region that should not be used between addresses 0x0d–0x12.
> Should I use something to mark this region in the regmap?
regmap allows specification of which registers readable and which writeable.
If this is a concern then you could do that. I'd not worry too much though
as those regions are only accessed by the debugfs interface and that provides
many other foot guns!
Just one trivial comment to add to David's more detailed review and questions.
>
> Notes:
> As suggested by Andy, I have chosen to use the code "if (ret == -ENODEV)"
> rather than "if (ret < 0)" on line 312, because it produces a slightly smaller
> max14001.o file compared to the other approach (10640 bytes vs. 10648 bytes).
> Additionally, as mentioned, it is more explicit check.
>
> As suggested by David, I added support for SPI_LSB_FIRST, and I also used a
> union to avoid clang compiler warnings related to casts between __le16,
> __be16, and u16. Thank you for the code examples.
>
> I tested it on the Raspberry Pi modified kernel version rpi-6.12 with
> Raspberry Pi 5 hardware, using the MAX14001PMB evaluation board, and it
> seems to work fine.
>
> Main changes since v11:
> - I think I fixed the alphabetical order in the files pointed.
> - Fixed small issues in the include files.
> - Removed the mutex since regmap has a lock mechanism (also removed the
> mutex include).
> - Added support for SPI_LSB_FIRST in case it is used in a device tree file.
> diff --git a/drivers/iio/adc/max14001.c b/drivers/iio/adc/max14001.c
> new file mode 100644
> index 000000000000..52584c24fb08
> --- /dev/null
> +++ b/drivers/iio/adc/max14001.c
...
> +static int max14001_probe(struct spi_device *spi)
> +{
> + struct device *dev = &spi->dev;
> + struct iio_dev *indio_dev;
> + struct max14001_state *st;
> + int ret = 0;
Set before use I think in all paths below. So can drop init here.
> + bool use_ext_vrefin = false;
next prev parent reply other threads:[~2025-10-04 15:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 5:58 [PATCH v12 1/3] dt-bindings: iio: adc: add max14001 Marilene Andrade Garcia
2025-09-29 5:59 ` [PATCH v12 2/3] iio: adc: max14001: New driver Marilene Andrade Garcia
2025-10-01 14:03 ` David Lechner
2025-10-02 7:05 ` Andy Shevchenko
2025-10-05 23:25 ` Marilene Andrade Garcia
2025-10-06 15:48 ` David Lechner
2025-10-04 15:04 ` Jonathan Cameron [this message]
2025-10-06 1:52 ` Marcelo Schmitt
2025-09-29 17:40 ` [PATCH v12 1/3] dt-bindings: iio: adc: add max14001 Conor Dooley
2025-10-06 1:58 ` Marcelo Schmitt
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=20251004160426.7876286b@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Santos@analog.com \
--cc=Marcelo.Schmitt@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=dragos.bogdan@analog.com \
--cc=dumitru.ceclan@analog.com \
--cc=kimseer.paller@analog.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=marilene.agarcia@gmail.com \
--cc=nuno.sa@analog.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;
as well as URLs for NNTP newsgroup(s).