Re: [PATCH v2 03/13] iio: backend: add support for self sync
From: Nuno Sá
Date: Tue Apr 15 2025 - 05:03:01 EST
On Fri, 2025-04-11 at 15:36 +0300, Antoniu Miclaus wrote:
> Add iio backend support for self sync enable/disable.
> When disabled data capture synchronization is done
> through CNV signal, otherwise through bit-slip.
>
It is still not clear what API's will come out of this but you need to improve
the commit description (and the API docs). Note that the above is very focused
on your use case and you're just using the same names defined in the device docs
and hdl IP. While that might be ok for the device drivers commits, it is not
that nice for something that "tries" to be more generic.
This is true for all the new API's being introduced...
- Nuno Sá
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>
> ---
> no changes in v2.
> drivers/iio/industrialio-backend.c | 30 ++++++++++++++++++++++++++++++
> include/linux/iio/backend.h | 6 ++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-
> backend.c
> index 60578267643d..cb23433b22c6 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -830,6 +830,36 @@ int iio_backend_data_alignment_disable(struct iio_backend
> *back)
> }
> EXPORT_SYMBOL_NS_GPL(iio_backend_data_alignment_disable, "IIO_BACKEND");
>
> +/**
> + * iio_backend_self_sync_enable - Enable the self sync data capture.
> + * @back: Backend device
> + *
> + * Data capture synchronization is done through bit-slip.
> + *
> + * RETURNS:
> + * 0 on success, negative error number on failure.
> + */
> +int iio_backend_self_sync_enable(struct iio_backend *back)
> +{
> + return iio_backend_op_call(back, self_sync_enable);
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_self_sync_enable, "IIO_BACKEND");
> +
> +/**
> + * iio_backend_self_sync_disable - Disable the self sync data capture.
> + * @back: Backend device
> + *
> + * Data capture synchronization is done through CNV signal.
> + *
> + * RETURNS:
> + * 0 on success, negative error number on failure.
> + */
> +int iio_backend_self_sync_disable(struct iio_backend *back)
> +{
> + return iio_backend_op_call(back, self_sync_disable);
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_self_sync_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 beff66d18151..6d006cb0da5a 100644
> --- a/include/linux/iio/backend.h
> +++ b/include/linux/iio/backend.h
> @@ -104,6 +104,8 @@ enum iio_backend_interface_type {
> * @filter_disable: Disable filter.
> * @data_alignment_enable: Enable sync process.
> * @data_alignment_disable: Disable sync process.
> + * @self_sync_enable: Enable the self sync data capture.
> + * @self_sync_disable: Disable the self sync data capture.
> * @ddr_enable: Enable interface DDR (Double Data Rate) mode.
> * @ddr_disable: Disable interface DDR (Double Data Rate) mode.
> * @data_stream_enable: Enable data stream.
> @@ -158,6 +160,8 @@ struct iio_backend_ops {
> int (*filter_disable)(struct iio_backend *back);
> int (*data_alignment_enable)(struct iio_backend *back);
> int (*data_alignment_disable)(struct iio_backend *back);
> + int (*self_sync_enable)(struct iio_backend *back);
> + int (*self_sync_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);
> @@ -202,6 +206,8 @@ int iio_backend_filter_enable(struct iio_backend *back);
> int iio_backend_filter_disable(struct iio_backend *back);
> int iio_backend_data_alignment_enable(struct iio_backend *back);
> int iio_backend_data_alignment_disable(struct iio_backend *back);
> +int iio_backend_self_sync_enable(struct iio_backend *back);
> +int iio_backend_self_sync_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);