On Thu, 18 Jun 2026 14:27:27 +0100
Rodrigo Alencar via B4 Relay <[email protected]> 
wrote:

> From: Rodrigo Alencar <[email protected]>
> 
> Add Digital Ramp Generator channels with destination selection (frequency,
> phase, or amplitude) based on attribute writes, dwell mode control,
> configurable upper/lower limits, step size controlled with rate of change
> config, and step rate controlled as sampling frequency.
> 
> Signed-off-by: Rodrigo Alencar <[email protected]>

End of day, so I'm running out of steam, but one case in here where
I think tweaking an earlier patch will make this one simpler without
costing anything much there.

> ---
>  drivers/iio/frequency/ad9910.c | 345 
> ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 340 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
> index 262702b62738..3fe97aa887c3 100644
> --- a/drivers/iio/frequency/ad9910.c
> +++ b/drivers/iio/frequency/ad9910.c
> @@ -831,22 +1108,62 @@ static int ad9910_write_raw(struct iio_dev *indio_dev,
>                       return -EINVAL;
>               }
>       case IIO_CHAN_INFO_RAW:
> -             if (val < 0)
> -                     return -EINVAL;
> -
>               switch (chan->channel) {
>               case AD9910_CHANNEL_PROFILE_0 ... AD9910_CHANNEL_PROFILE_7:
> +                     if (val < 0)
> +                             return -EINVAL;

Push it there in the earlier patch.  Which level it is at is a fairly
arbitrary decision in that earlier patch, so let's put it where it ends
up from the start.

> +
>                       tmp32 = chan->channel - AD9910_CHANNEL_PROFILE_0;
>                       tmp64 = FIELD_PREP(AD9910_PROFILE_ST_ASF_MSK,
>                                          min_t(u64, val, AD9910_ASF_MAX));
>                       return ad9910_reg64_update(st, 
> AD9910_REG_PROFILE(tmp32),
>                                                  AD9910_PROFILE_ST_ASF_MSK,
>                                                  tmp64, true);

Reply via email to