.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0+ */ |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 2 | /* |
---|
3 | 3 | * This file is part of AD5686 DAC driver |
---|
4 | 4 | * |
---|
.. | .. |
---|
13 | 13 | #include <linux/mutex.h> |
---|
14 | 14 | #include <linux/kernel.h> |
---|
15 | 15 | |
---|
| 16 | +#define AD5310_CMD(x) ((x) << 12) |
---|
| 17 | + |
---|
16 | 18 | #define AD5683_DATA(x) ((x) << 4) |
---|
| 19 | + |
---|
17 | 20 | #define AD5686_ADDR(x) ((x) << 16) |
---|
18 | 21 | #define AD5686_CMD(x) ((x) << 20) |
---|
19 | 22 | |
---|
.. | .. |
---|
38 | 41 | |
---|
39 | 42 | #define AD5686_CMD_CONTROL_REG 0x4 |
---|
40 | 43 | #define AD5686_CMD_READBACK_ENABLE_V2 0x5 |
---|
| 44 | + |
---|
| 45 | +#define AD5310_REF_BIT_MSK BIT(8) |
---|
41 | 46 | #define AD5683_REF_BIT_MSK BIT(12) |
---|
42 | 47 | #define AD5693_REF_BIT_MSK BIT(12) |
---|
43 | 48 | |
---|
.. | .. |
---|
45 | 50 | * ad5686_supported_device_ids: |
---|
46 | 51 | */ |
---|
47 | 52 | enum ad5686_supported_device_ids { |
---|
| 53 | + ID_AD5310R, |
---|
48 | 54 | ID_AD5311R, |
---|
49 | 55 | ID_AD5671R, |
---|
50 | 56 | ID_AD5672R, |
---|
| 57 | + ID_AD5674R, |
---|
51 | 58 | ID_AD5675R, |
---|
52 | 59 | ID_AD5676, |
---|
53 | 60 | ID_AD5676R, |
---|
| 61 | + ID_AD5679R, |
---|
54 | 62 | ID_AD5681R, |
---|
55 | 63 | ID_AD5682R, |
---|
56 | 64 | ID_AD5683, |
---|
.. | .. |
---|
72 | 80 | }; |
---|
73 | 81 | |
---|
74 | 82 | enum ad5686_regmap_type { |
---|
| 83 | + AD5310_REGMAP, |
---|
75 | 84 | AD5683_REGMAP, |
---|
76 | 85 | AD5686_REGMAP, |
---|
77 | 86 | AD5693_REGMAP |
---|
.. | .. |
---|
95 | 104 | struct ad5686_chip_info { |
---|
96 | 105 | u16 int_vref_mv; |
---|
97 | 106 | unsigned int num_channels; |
---|
98 | | - struct iio_chan_spec *channels; |
---|
| 107 | + const struct iio_chan_spec *channels; |
---|
99 | 108 | enum ad5686_regmap_type regmap_type; |
---|
100 | 109 | }; |
---|
101 | 110 | |
---|
.. | .. |
---|
108 | 117 | * @pwr_down_mask: power down mask |
---|
109 | 118 | * @pwr_down_mode: current power down mode |
---|
110 | 119 | * @use_internal_vref: set to true if the internal reference voltage is used |
---|
| 120 | + * @lock lock to protect the data buffer during regmap ops |
---|
111 | 121 | * @data: spi transfer buffers |
---|
112 | 122 | */ |
---|
113 | 123 | |
---|
.. | .. |
---|
121 | 131 | ad5686_write_func write; |
---|
122 | 132 | ad5686_read_func read; |
---|
123 | 133 | bool use_internal_vref; |
---|
| 134 | + struct mutex lock; |
---|
124 | 135 | |
---|
125 | 136 | /* |
---|
126 | 137 | * DMA (thus cache coherency maintenance) requires the |
---|