diff options
Diffstat (limited to 'drivers/iio/dac/ad5504.c')
-rw-r--r-- | drivers/iio/dac/ad5504.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c index 1e6449346b50..581ec141de3d 100644 --- a/drivers/iio/dac/ad5504.c +++ b/drivers/iio/dac/ad5504.c | |||
@@ -15,17 +15,16 @@ | |||
15 | #include <linux/sysfs.h> | 15 | #include <linux/sysfs.h> |
16 | #include <linux/regulator/consumer.h> | 16 | #include <linux/regulator/consumer.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/bitops.h> | ||
18 | 19 | ||
19 | #include <linux/iio/iio.h> | 20 | #include <linux/iio/iio.h> |
20 | #include <linux/iio/sysfs.h> | 21 | #include <linux/iio/sysfs.h> |
21 | #include <linux/iio/events.h> | 22 | #include <linux/iio/events.h> |
22 | #include <linux/iio/dac/ad5504.h> | 23 | #include <linux/iio/dac/ad5504.h> |
23 | 24 | ||
24 | #define AD5505_BITS 12 | 25 | #define AD5504_RES_MASK GENMASK(11, 0) |
25 | #define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) | 26 | #define AD5504_CMD_READ BIT(15) |
26 | 27 | #define AD5504_CMD_WRITE 0 | |
27 | #define AD5504_CMD_READ (1 << 15) | ||
28 | #define AD5504_CMD_WRITE (0 << 15) | ||
29 | #define AD5504_ADDR(addr) ((addr) << 12) | 28 | #define AD5504_ADDR(addr) ((addr) << 12) |
30 | 29 | ||
31 | /* Registers */ | 30 | /* Registers */ |
@@ -42,7 +41,7 @@ | |||
42 | 41 | ||
43 | /** | 42 | /** |
44 | * struct ad5446_state - driver instance specific data | 43 | * struct ad5446_state - driver instance specific data |
45 | * @us: spi_device | 44 | * @spi: spi_device |
46 | * @reg: supply regulator | 45 | * @reg: supply regulator |
47 | * @vref_mv: actual reference voltage used | 46 | * @vref_mv: actual reference voltage used |
48 | * @pwr_down_mask power down mask | 47 | * @pwr_down_mask power down mask |
@@ -126,7 +125,6 @@ static int ad5504_write_raw(struct iio_dev *indio_dev, | |||
126 | long mask) | 125 | long mask) |
127 | { | 126 | { |
128 | struct ad5504_state *st = iio_priv(indio_dev); | 127 | struct ad5504_state *st = iio_priv(indio_dev); |
129 | int ret; | ||
130 | 128 | ||
131 | switch (mask) { | 129 | switch (mask) { |
132 | case IIO_CHAN_INFO_RAW: | 130 | case IIO_CHAN_INFO_RAW: |
@@ -135,10 +133,8 @@ static int ad5504_write_raw(struct iio_dev *indio_dev, | |||
135 | 133 | ||
136 | return ad5504_spi_write(st, chan->address, val); | 134 | return ad5504_spi_write(st, chan->address, val); |
137 | default: | 135 | default: |
138 | ret = -EINVAL; | 136 | return -EINVAL; |
139 | } | 137 | } |
140 | |||
141 | return -EINVAL; | ||
142 | } | 138 | } |
143 | 139 | ||
144 | static const char * const ad5504_powerdown_modes[] = { | 140 | static const char * const ad5504_powerdown_modes[] = { |