Re: [PATCH v1 1/5] iio: backend: Add calibration source interface

From: Marcelo Schmitt

Date: Thu Nov 19 2026 - 15:32:44 EST


On 11/19, Jonathan Cameron wrote:
> On Wed, 18 Nov 2026 10:03:17 -0300
> Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> wrote:
>
> > Some ADC front-ends send data over a configurable number of LVDS serial
> > lanes and may also need to have the data frame calibrated before capture
> > can start.
> >
> > Add a backend operation for selecting the calibration source (data lane or
> > data frame) so that device drivers can perform the calibration of both the
> > data frame and data lanes.
> >
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> > ---
> > drivers/iio/industrialio-backend.c | 23 +++++++++++++++++++++++
> > include/linux/iio/backend.h | 22 ++++++++++++++++++++++
> > 2 files changed, 45 insertions(+)
> >
> > diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> > index fbf5c39d7655..682d5f735071 100644
> > --- a/drivers/iio/industrialio-backend.c
> > +++ b/drivers/iio/industrialio-backend.c
> > @@ -869,6 +869,29 @@ int iio_backend_interface_data_align(struct iio_backend *back, u32 timeout_us)
> > }
> > EXPORT_SYMBOL_NS_GPL(iio_backend_interface_data_align, "IIO_BACKEND");
> >
> > +/**
> > + * iio_backend_calibration_source_set - Select the monitored error source
> > + * @back: Backend device
> > + * @source: Error source to monitor.
> > + * @lane: Data lane to monitor. Only meaningful for
> > + * %IIO_BACKEND_CALIB_SOURCE_DATA_LANE.
> > + *
> > + * Restrict the error reported through iio_backend_chan_status() to a single
> > + * source of the digital interface so that each lane can be calibrated
> > + * independently. Backends are expected to report every error source again
> > + * once %IIO_BACKEND_CALIB_SOURCE_NONE is selected.
>
> I don't follow this description at all. If there is more than one how
> does it report 'every' error source?
>
> Add some explanation, probably to the commit message on how the
> flow using this works. We might need more info here as well.

I've complemented the explanation about this new backend operation. I'll try
to further improve for v2 if the description below is still sounding confusing.


Some ADC front-ends group and send data from a single channel over a
configurable number of LVDS serial lanes and may also need to perform a
data frame calibration before capture can start. During a channel interface
calibration, the front-end device driver usually requests the channel
status multiple times to find out the optimal calibration point.

However, the backend channel status interface doesn't provide which
specific serial lane or data frame flagged errors when they occur. The lack
of error source information prevents proper calibration of channels
comprised of multiple serial lanes.

Instead, the backend may have a separate error source mask configuration to
restrict which digital interface source will have its errors reported
through iio_backend_chan_status(). With that, each serial lane can be
calibrated independently, enabling multiple lane LVDS channels to be
properly calibrated and supported.

Add a backend operation for selecting the calibration source (data lane or
data frame) so that device drivers can perform the calibration of both the
data frame and data lanes. Backends are expected to report every error source
when IIO_BACKEND_CALIB_SOURCE_NONE is selected.


sashiko comments seem to apply. Will, fix those for v2.


Thanks,
Marcelo