Re: [PATCH v4 10/13] iio: dac: ds4424: support per-variant output range limits
From: Andy Shevchenko
Date: Tue Feb 03 2026 - 06:47:37 EST
On Tue, Feb 03, 2026 at 10:34:30AM +0100, Oleksij Rempel wrote:
> The DS4402/DS4404 variants operate with a 5-bit resolution (31 steps),
> whereas the DS4422/DS4424 support 7-bit (127 steps).
>
> Previously, the driver enforced a hardcoded 7-bit mask (DS4424_DAC_MASK)
> for all variants. This allowed users to write values exceeding the 5-bit
> range to DS4402/DS4404 devices, resulting in silent truncation or
> undefined behavior.
>
> Add a `result_mask` field to the chip_info structure to define the valid
> data range for each variant. Use this mask to:
> 1. Correctly mask register values in read_raw().
> 2. Return -EINVAL in write_raw() if the input value exceeds the
> variant's capabilities.
Makes sense.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko