Re: [PATCH 08/10] iio: frequency: ad9910: support iio backend
From: Nuno Sá
Date: Fri Oct 16 2026 - 05:28:45 EST
On Thu, 15 Oct 2026 13:49:48 -0300, Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx> wrote:
> diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
> index 3d517879dee3..39d65dafd5a1 100644
> --- a/drivers/iio/frequency/ad9910.c
> +++ b/drivers/iio/frequency/ad9910.c
> @@ -568,6 +580,11 @@ static int ad9910_set_sysclk_freq(struct ad9910_state *st, u32 freq_hz,
>
> st->data.sysclk_freq_hz = sysclk_freq_hz;
>
> + if (st->back)
> + return iio_backend_set_sampling_freq(st->back,
> + AD9910_CHAN_IDX_PHY,
> + sysclk_freq_hz);
Here sashiko is right.
> @@ -2278,6 +2400,72 @@ static inline void ad9910_debugfs_init(struct ad9910_state *st,
> [ ... skip 31 lines ... ]
> +
> + return ad9910_reg32_update(st, AD9910_REG_CFR2,
> + AD9910_CFR2_PARALLEL_DATA_PORT_EN_MSK,
> + AD9910_CFR2_PARALLEL_DATA_PORT_EN_MSK,
> + true);
> +}
This one make sense but we tend to not care much in other devices.
Might make more sense to accept the out of sync for more complicated
things where having to take care all teardown state makes it hard to
deak with. Given this is a simple case, I would disable the channel on
error.
> +
> +static int ad9910_buffer_postdisable(struct iio_dev *indio_dev)
> +{
> + struct ad9910_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + guard(mutex)(&st->lock);
> +
> + st->scan_mask = 0;
> + ret = ad9910_reg32_update(st, AD9910_REG_CFR2,
> + AD9910_CFR2_PARALLEL_DATA_PORT_EN_MSK,
> + 0, true);
> + if (ret)
> + return ret;
In the same spirit, we could ignore the error in here (with some warnign
message perhaps?) and still try to disable the channel on the backend?
No strong feelings though!
--
Nuno Sá <nuno.sa@xxxxxxxxxx>