]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: dac: ad5686: fix powerdown control on dual-channel devices
authorRodrigo Alencar <rodrigo.alencar@analog.com>
Tue, 5 May 2026 12:35:05 +0000 (13:35 +0100)
committerJonathan Cameron <jic23@kernel.org>
Fri, 15 May 2026 11:05:35 +0000 (12:05 +0100)
commit8aeaf25a85263a7a43357e16ad78ab969f6f8aeb
treef1f57893e8d25c5b431e9288d14d4c4201f8da35
parent5237c3175cae5ab05f18878cec3301a04403859e
iio: dac: ad5686: fix powerdown control on dual-channel devices

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. Mask as 0x3U is used rather than 0x3, because shift can reach
value of 30 (last channel of a 16-channel device), which would mess with
the sign bit. 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@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/dac/ad5686.c