Re: [PATCH v5 4/4] iio: adc: ad9467: check for backend capabilities

Nuno Sá
2026-02-03T09:51:01Z

On Mon, 2026-02-02 at 14:03 +0200, Tomas Melin wrote:
> Hi,
>
> On 02/02/2026 12:42, Nuno Sá wrote:
> > On Fri, 2026-01-30 at 09:17 +0000, 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.
> ...
> > >
> > > @@ -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",
> >
> > Change the permissions for in_voltage%u_test_mode so that is WO in case we can't
> > IIO_BACKEND_CAP_CALIBRATION. You can even reuse the above check to tweak the permissions
> > accordingly. Then no need to check for the capability in ad9467_chan_test_mode_read()
>
> This RO would be then only for cases PN9, PN23. For the other attributes

> RW would still be applicable. But basically I think the test modes in
> the device are still available even if the backend status does not exist?

Yeah, they are. The backend is only validating the pattern to make sure it is what's
expected. TBH, I'm not sure what's the utility without the backend but I guess one might
want to connect the interface somewhere and check the patterns.

> IMHO the current approach is slightly cleaner, as all the test modes the
> device supports are available and no need to think about which ones have
> RW/RO inside this function. Please let me know, in case you insist on
> this kind of approach.
>
>
Ok, I reviewed the code and I see we still print some running status for all the patterns.
Feel free to leave as-is then

- Nuno Sá