Skip to content

Commit efd597b

Browse files
larsclausenjic23
authored andcommitted
iio: ad5504: Fix setting power-down state
The power-down mask of the ad5504 is actually a power-up mask. Meaning if a bit is set the corresponding channel is powered up and if it is not set the channel is powered down. The driver currently has this the wrong way around, resulting in the channel being powered up when requested to be powered down and vice versa. Fixes: 3bbbf15 ("staging:iio:dac:ad5504: Use strtobool for boolean values") Signed-off-by: Lars-Peter Clausen <[email protected]> Acked-by: Alexandru Ardelean <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 49a9565 commit efd597b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/dac/ad5504.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
187187
return ret;
188188

189189
if (pwr_down)
190-
st->pwr_down_mask |= (1 << chan->channel);
191-
else
192190
st->pwr_down_mask &= ~(1 << chan->channel);
191+
else
192+
st->pwr_down_mask |= (1 << chan->channel);
193193

194194
ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
195195
AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |

0 commit comments

Comments
 (0)