From: Jonathan Cameron <jic23@kernel.org>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"David Jander" <david@protonic.nl>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
"Andy Shevchenko" <andy@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>
Subject: Re: [PATCH v4 2/2] iio: adc: Add TI ADS131M0x ADC driver
Date: Sun, 7 Dec 2025 19:33:13 +0000 [thread overview]
Message-ID: <20251207193313.794ea339@jic23-huawei> (raw)
In-Reply-To: <20251118141821.907364-3-o.rempel@pengutronix.de>
On Tue, 18 Nov 2025 15:18:21 +0100
Oleksij Rempel <o.rempel@pengutronix.de> wrote:
> From: David Jander <david@protonic.nl>
>
> Add a new IIO ADC driver for Texas Instruments ADS131M0x devices
> (ADS131M02/03/04/06/08). These are 24-bit, up to 64 kSPS, simultaneous-
> sampling delta-sigma ADCs accessed via SPI.
>
> Highlights:
> - Supports 2/3/4/6/8-channel variants with per-channel RAW and SCALE.
> - Implements device-required full-duplex fixed-frame transfers.
> - Handles both input and output CRC
>
> Note: Despite the almost identical name, this hardware is not
> compatible with the ADS131E0x series handled by
> drivers/iio/adc/ti-ads131e08.c.
>
> Signed-off-by: David Jander <david@protonic.nl>
> Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Hi Oleksij,
Series applied, but one comment inline on some code that surprised
me. I'm curious whether anyone else agrees the devm_clk_get_enabled()
stub returning NULL is an odd choice?
For now applied to my local branch. I will push it out only as testing until
I can rebase on rc1.
> +/**
> + * ads131m_parse_clock - enable clock and detect "xtal" selection
> + * @priv: Device private data structure.
> + * @is_xtal: result flag (true if "xtal", false if default "clkin")
> + *
> + * Return: 0 on success, or a negative error code.
> + */
> +static int ads131m_parse_clock(struct ads131m_priv *priv, bool *is_xtal)
> +{
> + struct device *dev = &priv->spi->dev;
> + struct clk *clk;
> + int ret;
> +
> + clk = devm_clk_get_enabled(dev, NULL);
This surprised me, so I went digging. Anyone know why
the stub returns NULL? Given that the normal function doesn't have
that as an allowed return value that seems really odd.
Still, it does, so this code is fine if odd.
> + if (IS_ERR_OR_NULL(clk)) {
> + if (IS_ERR(clk))
> + ret = PTR_ERR(clk);
> + else
> + ret = -ENODEV;
> +
> + return dev_err_probe(dev, ret, "clk get enabled failed\n");
> + }
> +
> + ret = device_property_match_string(dev, "clock-names", "xtal");
> + if (ret > 0)
> + return dev_err_probe(dev, -EINVAL,
> + "'xtal' must be the only or first clock name");
> +
> + if (ret < 0 && ret != -ENODATA)
> + return dev_err_probe(dev, ret,
> + "failed to read 'clock-names' property");
> +
> + if (ret == 0 && !priv->config->supports_xtal)
> + return dev_err_probe(dev, -EINVAL,
> + "'xtal' clock not supported on this device");
> +
> + *is_xtal = !ret;
> +
> + return 0;
> +}
next prev parent reply other threads:[~2025-12-07 19:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 14:18 [PATCH v4 0/2] iio: adc: Add support for TI ADS131M0x ADCs Oleksij Rempel
2025-11-18 14:18 ` [PATCH v4 1/2] bindings: iio: adc: Add bindings " Oleksij Rempel
2025-11-18 14:18 ` [PATCH v4 2/2] iio: adc: Add TI ADS131M0x ADC driver Oleksij Rempel
2025-12-07 19:33 ` Jonathan Cameron [this message]
2025-12-07 22:59 ` Andy Shevchenko
2025-12-08 17:08 ` Jonathan Cameron
2025-11-18 15:14 ` [PATCH v4 0/2] iio: adc: Add support for TI ADS131M0x ADCs David Lechner
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=20251207193313.794ea339@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=o.rempel@pengutronix.de \
--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).