提交 a45186c0 编写于 作者: L Lars-Peter Clausen 提交者: Greg Kroah-Hartman

staging:iio:dac:ad5638: Fix channel address

Commit c6fc8062 ("staging:iio: ABI rework - add in_ or out_ prefix to
channnels") added the AD5868_CHANNEL macro to simplify channel initialization.
Unfortunately the macro hardcodes the channel's address to AD5686_ADDR_DAC0. As
a result writing to any of the channels will change the value of the first
channel.

This patch fixes the issue by calculating the channel address based on the
channel number.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Acked-by: NJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 638e59fc
......@@ -26,10 +26,7 @@
#define AD5686_ADDR(x) ((x) << 16)
#define AD5686_CMD(x) ((x) << 20)
#define AD5686_ADDR_DAC0 0x1
#define AD5686_ADDR_DAC1 0x2
#define AD5686_ADDR_DAC2 0x4
#define AD5686_ADDR_DAC3 0x8
#define AD5686_ADDR_DAC(chan) (0x1 << (chan))
#define AD5686_ADDR_ALL_DAC 0xF
#define AD5686_CMD_NOOP 0x0
......@@ -103,7 +100,7 @@ enum ad5686_supported_device_ids {
.output = 1, \
.channel = chan, \
.info_mask = (1 << IIO_CHAN_INFO_SCALE_SHARED), \
.address = AD5686_ADDR_DAC0, \
.address = AD5686_ADDR_DAC(chan), \
.scan_type = IIO_ST('u', bits, 16, shift) \
}
static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册