Re: [PATCH v3 04/11] iio: dac: ad5686: fix powerdown control on dual-channel devices

From: Rodrigo Alencar

Date: Wed Apr 29 2026 - 06:34:29 EST


On 26/04/29 11:07AM, Jonathan Cameron wrote:
> On Tue, 28 Apr 2026 18:02:19 +0100
> Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:
>
> > From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> >
> > Fix powerdown control by using a proper bit shift for the powerdown mask
> > values. During initialization, powerdown bits are initialized so that
> > unused bits are set to 1 and the correct bit shift is used. Dual-channel
> > devices use one-hot encoding in the address and that reflects on the
> > position of the powerdown bits, which are not channel-index based
> > for that case. Quad-channel devices also use one-hot encoding for the
> > channel address but the result of log2(address) coincides with the channel
> > index value. The issue was introduced when first adding support for
> > dual-channel devices, which overlooked powerdown control differences.
> >
> > Fixes: 7dc8faeab3e3 ("iio: dac: ad5686: add support for AD5338R")
> > Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> Backed this one out again for now. See sashiko review.
> https://sashiko.dev/#/patchset/20260428-ad5686-fixes-v3-0-9cff7bd67a15%40analog.com
>
> I took a look at the ad5310r (unhelpfully called ad5310 in the
> majority of the driver - something it would be nice to fix!)
> and there are some real oddities when comparing what we send
> to that device with the datasheet.
>
> Understanding not helped by the bit numbering changing on the
> datasheet between tables 10 and 11 :( Feel free to suggest they fix that!
>
> Anyhow, I think sashiko is correct and the stray 1111b will corrupt
> the command bits and maybe even the reset.

hmm that makes sense... that eventually only gets fixed when control_sync()
function is added as it masks out the 1's.
Those are needed for the dual-channel case, where "unused channel" bits
need to be set to one.
I guess I've broken down the cleanup commits the wrong way.

let me fix the fix!

> I haven't yet asked for sashiko reviews to just be sent to the mailing
> list, as I'm still personally getting comfortable with how accurate they
> are - but I'm thinking about it. In meantime please do take a look
> at them as they catch things like this (assuming it is real!)
>
> Jonathan

--
Kind regards,

Rodrigo Alencar