Re: [PATCH] iio: dac: mcp47a1: Allow full-scale output

From: Joshua Crofts

Date: Fri Sep 04 2026 - 11:25:25 EST


Hi Tuna,

Thanks for the patch!

On Fri, 4 Sep 2026 12:25:17 +0000 (UTC)
Tuna Kılıç <tuna@xxxxxxxxxxxxx> wrote:

> The MCP47A1 has 64 resistors but exposes 65 wiper positions. The valid
> DAC codes are 0 through 64, and code 64 selects VREF.
>
> The driver currently advertises 0 through 63 and uses 64 as the length
> argument to in_range(), which also rejects 64. Therefore userspace
> cannot select full-scale output.
>
> Advertise code 64 and make validation cover all 65 codes. Keep 64 as
> the scale denominator because the output voltage is VREF multiplied by
> the code and divided by 64.
>
> Fixes: 350d1fb9204b ("iio: dac: mcp47a1: add support for new device")
> Signed-off-by: Tuna Kılıç <tuna@xxxxxxxxxxxxx>
> ---

This makes sense, I must've misread the datasheet...

Can I ask how this was found? Manual code analysis or AI?

--
Kind regards,
Joshua Crofts