[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYHgEXRd76F8AnMU@smile.fi.intel.com>
Date: Tue, 3 Feb 2026 13:46:25 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Jonathan Cameron <jic23@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, Andy Shevchenko <andy@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
David Jander <david@...tonic.nl>
Subject: Re: [PATCH v4 10/13] iio: dac: ds4424: support per-variant output
range limits
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@...el.com>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists