From: Tomas Melin <tomas.melin@vaisala.com>
To: David Lechner <dlechner@baylibre.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Nuno Sa <nuno.sa@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
Olivier Moysan <olivier.moysan@foss.st.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/4] iio: adc: ad9467: check for backend capabilities
Date: Mon, 2 Feb 2026 13:18:23 +0200 [thread overview]
Message-ID: <885ddf2c-73e8-43f2-8b93-5a0a8a92d19d@vaisala.com> (raw)
In-Reply-To: <9c674c11-56fd-4b49-96d6-01d8cd433003@baylibre.com>
Hi,
On 31/01/2026 22:40, David Lechner wrote:
> On 1/30/26 3:17 AM, Tomas Melin wrote:
>> Add capability checks for operation with backends that do not necessarily
>> support full set of features, but are otherwise compatible with the device.
>> This ensures a fully functional device, but with limited capabilities.
>>
>> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
>> ---
>> drivers/iio/adc/ad9467.c | 69 ++++++++++++++++++++++++++++++------------------
>> 1 file changed, 43 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
>> index 59c3fa3bcc9b..d768f7bf2a1c 100644
>> --- a/drivers/iio/adc/ad9467.c
>> +++ b/drivers/iio/adc/ad9467.c
>> @@ -913,7 +913,9 @@ static int __ad9467_update_clock(struct ad9467_state *st, long r_clk)
>> return ret;
>>
>> guard(mutex)(&st->lock);
>
> I saw in the changelog that leaving the guard here was intentional, but I
> don't see why.
This was discussed here:
https://marc.info/?l=linux-iio&m=176900394618857&w=4
>
>> - return ad9467_calibrate(st);
>> + if (iio_backend_has_caps(st->back, IIO_BACKEND_CAP_CALIBRATION))
>> + return ad9467_calibrate(st);
>> + return 0;
>> }
>>
>
> ...
>
>> static int ad9467_write_raw(struct iio_dev *indio_dev,
>> @@ -1119,12 +1121,15 @@ static ssize_t ad9467_chan_test_mode_read(struct file *file,
>> len = scnprintf(buf, sizeof(buf), "Running \"%s\" Test:\n\t",
>> ad9467_test_modes[chan->mode]);
>>
>> - ret = iio_backend_debugfs_print_chan_status(st->back, chan->idx,
>> - buf + len,
>> - sizeof(buf) - len);
>> - if (ret < 0)
>> - return ret;
>> - len += ret;
>> + if (iio_backend_has_caps(st->back, IIO_BACKEND_CAP_CALIBRATION)) {
>> + ret = iio_backend_debugfs_print_chan_status(st->back,
>> + chan->idx,
>> + buf + len,
>> + sizeof(buf) - len);
>> + if (ret < 0)
>> + return ret;
>> + len += ret;
>> + }
>> } else if (chan->mode == AN877_ADC_TESTMODE_OFF) {
>> len = scnprintf(buf, sizeof(buf), "No test Running...\n");
>> } else {
>> @@ -1188,16 +1193,19 @@ static ssize_t ad9467_chan_test_mode_write(struct file *file,
>> return ret;
>>
>> /* some patterns have a backend matching monitoring block */
>> - if (mode == AN877_ADC_TESTMODE_PN9_SEQ) {
>> - ret = ad9467_backend_testmode_on(st, chan->idx,
>> + if (iio_backend_has_caps(st->back,
>> + IIO_BACKEND_CAP_CALIBRATION)) {
>> + if (mode == AN877_ADC_TESTMODE_PN9_SEQ) {
>> + ret = ad9467_backend_testmode_on(st, chan->idx,
>> IIO_BACKEND_ADI_PRBS_9A);
>> - if (ret)
>> - return ret;
>> - } else if (mode == AN877_ADC_TESTMODE_PN23_SEQ) {
>> - ret = ad9467_backend_testmode_on(st, chan->idx,
>> + if (ret)
>> + return ret;
>> + } else if (mode == AN877_ADC_TESTMODE_PN23_SEQ) {
>> + ret = ad9467_backend_testmode_on(st, chan->idx,
>> IIO_BACKEND_ADI_PRBS_23A);
>> - if (ret)
>> - return ret;
>> + if (ret)
>> + return ret;
>> + }
>> }
>> }
>>
>> @@ -1263,8 +1271,10 @@ static void ad9467_debugfs_init(struct iio_dev *indio_dev)
>> if (!st->chan_test)
>> return;
>>
>> - debugfs_create_file("calibration_table_dump", 0400, d, st,
>> - &ad9467_calib_table_fops);
>> + if (iio_backend_has_caps(st->back, IIO_BACKEND_CAP_CALIBRATION)) {
>> + debugfs_create_file("calibration_table_dump", 0400, d, st,
>> + &ad9467_calib_table_fops);
>> + }
>>
>> for (chan = 0; chan < st->info->num_channels; chan++) {
>> snprintf(attr_name, sizeof(attr_name), "in_voltage%u_test_mode",
>
>
> Do we actually need to change these test mode/debugfs functions since
> debugfs_create_file() is only callded if IIO_BACKEND_CAP_CALIBRATION
> already?
The set of available test modes as such are part of the device, not the
backend. Based on that I have concluded that they should remain intact.
Thanks,
Tomas
>
>
next prev parent reply other threads:[~2026-02-02 11:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 9:16 [PATCH v5 0/4] iio: adc: ad9467: Support alternative backends Tomas Melin
2026-01-30 9:16 ` [PATCH v5 1/4] iio: industrialio-backend: support backend capabilities Tomas Melin
2026-01-31 20:30 ` David Lechner
2026-02-02 10:28 ` Nuno Sá
2026-02-02 11:08 ` Tomas Melin
2026-02-02 12:40 ` Nuno Sá
2026-02-02 13:04 ` Tomas Melin
2026-02-02 15:50 ` David Lechner
2026-02-03 9:50 ` Tomas Melin
2026-02-04 1:07 ` David Lechner
2026-02-04 11:15 ` Tomas Melin
2026-02-03 10:01 ` Nuno Sá
2026-02-03 10:45 ` Tomas Melin
2026-02-02 10:58 ` Tomas Melin
2026-02-02 15:17 ` David Lechner
2026-01-30 9:17 ` [PATCH v5 2/4] iio: adc: adi-axi-adc: define supported iio-backend capabilities Tomas Melin
2026-02-02 10:33 ` Nuno Sá
2026-01-30 9:17 ` [PATCH v5 3/4] iio: dac: adi-axi-dac: " Tomas Melin
2026-02-02 10:33 ` Nuno Sá
2026-01-30 9:17 ` [PATCH v5 4/4] iio: adc: ad9467: check for backend capabilities Tomas Melin
2026-01-31 20:40 ` David Lechner
2026-02-02 11:18 ` Tomas Melin [this message]
2026-02-02 10:42 ` Nuno Sá
2026-02-02 12:03 ` Tomas Melin
2026-02-03 9:51 ` Nuno Sá
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=885ddf2c-73e8-43f2-8b93-5a0a8a92d19d@vaisala.com \
--to=tomas.melin@vaisala.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.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®