Re: [PATCH v3 02/14] iio: backend: Add support for CRC

From: Jonathan Cameron

Date: Sun Aug 16 2026 - 14:33:34 EST


On Sun, 16 Aug 2026 19:27:25 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Thu, 13 Aug 2026 15:56:55 +0200
> Janani Sunil <janani.sunil@xxxxxxxxxx> wrote:
>
> > Add a backend operation to enable or disable Cyclic Redundancy Check
> > processing for data integrity verification. When enabled, the backend
> > will generate, verify, or process CRC information for data samples
> > transmitted over the interface, allowing the host to detect corrupted
> > samples.
>
> The backend is generating them? That seems odd. In my head at least
> backend is representing the host end of the data pipe. So what this is
> enabling is the front end (the ADC itself) generating the CRC and
> the backend either just passing it on, or potentially checking it
> for us (the verification part). So I think I'm either misunderstanding
> what this is, or it needs a rewrite.
>

Ah. It occurred to me what is going on here. You've written it to
allow for DAC usage as well. Rather than clumping in and out in one
statement can we have separate sentences to say what it enables
in each direction.

> Jonathan
>
>
> >
> > Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
> > ---
> > drivers/iio/industrialio-backend.c | 33 +++++++++++++++++++++++++++++++++
> > include/linux/iio/backend.h | 6 ++++++
> > 2 files changed, 39 insertions(+)
> >
> > diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> > index f7a4be8ec320..792c2333b057 100644
> > --- a/drivers/iio/industrialio-backend.c
> > +++ b/drivers/iio/industrialio-backend.c
> > @@ -886,6 +886,39 @@ int iio_backend_num_lanes_set(struct iio_backend *back, unsigned int num_lanes)
> > }
> > EXPORT_SYMBOL_NS_GPL(iio_backend_num_lanes_set, "IIO_BACKEND");
> >
> > +/**
> > + * iio_backend_crc_enable - Enable the CRC generation.
> > + * @back: Backend device
> > + *
> > + * Enable Cyclic Redundancy Check processing for data integrity verification.
> > + * When enabled, the backend will generate, verify, or process CRC information
> > + * for data samples transmitted over the interface.
> > + *
> > + * RETURNS:
> > + * 0 on success, negative error number on failure.
> > + */
> > +int iio_backend_crc_enable(struct iio_backend *back)
> > +{
> > + return iio_backend_op_call(back, crc_enable);
> > +}
> > +EXPORT_SYMBOL_NS_GPL(iio_backend_crc_enable, "IIO_BACKEND");
> > +
> > +/**
> > + * iio_backend_crc_disable - Disable the CRC generation.
> > + * @back: Backend device
> > + *
> > + * Disable Cyclic Redundancy Check processing. When disabled, the backend will
> > + * stop generating, verifying, or processing CRC information for data samples.
> > + *
> > + * RETURNS:
> > + * 0 on success, negative error number on failure.
> > + */
> > +int iio_backend_crc_disable(struct iio_backend *back)
> > +{
> > + return iio_backend_op_call(back, crc_disable);
> > +}
> > +EXPORT_SYMBOL_NS_GPL(iio_backend_crc_disable, "IIO_BACKEND");
> > +
> > /**
> > * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode
> > * @back: Backend device
> > diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
> > index 3f95ed1fdf9e..eddaddb47bea 100644
> > --- a/include/linux/iio/backend.h
> > +++ b/include/linux/iio/backend.h
> > @@ -133,6 +133,8 @@ enum iio_backend_capabilities {
> > * @filter_type_set: Set filter type.
> > * @interface_data_align: Perform the data alignment process.
> > * @num_lanes_set: Set the number of lanes enabled.
> > + * @crc_enable: Enable CRC generation and verification.
> > + * @crc_disable: Disable CRC generation and verification.
> > * @ddr_enable: Enable interface DDR (Double Data Rate) mode.
> > * @ddr_disable: Disable interface DDR (Double Data Rate) mode.
> > * @data_stream_enable: Enable data stream.
> > @@ -189,6 +191,8 @@ struct iio_backend_ops {
> > enum iio_backend_filter_type type);
> > int (*interface_data_align)(struct iio_backend *back, u32 timeout_us);
> > int (*num_lanes_set)(struct iio_backend *back, unsigned int num_lanes);
> > + int (*crc_enable)(struct iio_backend *back);
> > + int (*crc_disable)(struct iio_backend *back);
> > int (*ddr_enable)(struct iio_backend *back);
> > int (*ddr_disable)(struct iio_backend *back);
> > int (*data_stream_enable)(struct iio_backend *back);
> > @@ -237,6 +241,8 @@ int iio_backend_filter_type_set(struct iio_backend *back,
> > enum iio_backend_filter_type type);
> > int iio_backend_interface_data_align(struct iio_backend *back, u32 timeout_us);
> > int iio_backend_num_lanes_set(struct iio_backend *back, unsigned int num_lanes);
> > +int iio_backend_crc_enable(struct iio_backend *back);
> > +int iio_backend_crc_disable(struct iio_backend *back);
> > int iio_backend_ddr_enable(struct iio_backend *back);
> > int iio_backend_ddr_disable(struct iio_backend *back);
> > int iio_backend_data_stream_enable(struct iio_backend *back);
> >
>
>