Re: [PATCH 5/5] iio: potentiometer: mcp4018: Add Analog Devices AD5246
From: Jonathan Cameron
Date: Wed Nov 18 2026 - 22:53:52 EST
On Mon, 16 Nov 2026 17:59:54 -0500
Joseph Telaak <joseph@xxxxxxxxxx> wrote:
> The AD5246 is a 128-position digital rheostat with the same I2C
> interface as the MCP4017/18/19: a single data byte writes the 7-bit
> wiper and a single-byte read returns it, with no command byte. Add its
> four resistance options.
>
> Its resistance is D/128 of the end-to-end value, where the MCP401x's is
> D/127, so the scale divisor moves into the per-part config.
So which value can't we hit? 128 values gives 127 steps.
Sometimes with high bit rate things we ignore over that because it
makes no difference in practice given noise levels etc.
With only 7 bits it may be noticeable.
Ah, I checked the data sheet. Nominal Resistance +- 30% :)
Ah well, I don't really care if we resolve the rather theoretical
argument. So fine to follow the datasheet.
>
> The misc ad525x_dpot driver also knows the AD5246, by I2C id only and
> through its own sysfs files. It can't provide an IIO channel, which a
> consumer such as dpot-dac needs. The AD5272 is likewise in both drivers.
>
> Tested on an AD5246 at 0x2e that sets a fan's speed, described as
> adi,ad5246-010 with a vdd-supply. It probes, out_resistance0_raw_available
> reads [0 1 127] and out_resistance_scale reads 78.125000000. Raw writes
> of 0, 64, 100 and 127 read back the same value, and 128 is rejected.
> Writes through iio_write_channel_raw() from an in-kernel consumer of the
> channel read back as well (127, 38, 0 and 76).
>
> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5246.pdf
> Signed-off-by: Joseph Telaak <joseph@xxxxxxxxxx>
Otherwise, I didn't have anything to add to existing reviews
Thanks,
Jonathan