.. | .. |
---|
32 | 32 | u16 sw_reset_ms; |
---|
33 | 33 | u16 self_test_ms; |
---|
34 | 34 | }; |
---|
| 35 | + |
---|
35 | 36 | /** |
---|
36 | 37 | * struct adis_data - ADIS chip variant specific data |
---|
37 | 38 | * @read_delay: SPI delay for read operations in us |
---|
.. | .. |
---|
45 | 46 | * @self_test_mask: Bitmask of supported self-test operations |
---|
46 | 47 | * @self_test_reg: Register address to request self test command |
---|
47 | 48 | * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg |
---|
48 | | - * @status_error_msgs: Array of error messgaes |
---|
| 49 | + * @status_error_msgs: Array of error messages |
---|
49 | 50 | * @status_error_mask: Bitmask of errors supported by the device |
---|
50 | 51 | * @timeouts: Chip specific delays |
---|
51 | 52 | * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable |
---|
| 53 | + * @unmasked_drdy: True for devices that cannot mask/unmask the data ready pin |
---|
52 | 54 | * @has_paging: True if ADIS device has paged registers |
---|
53 | 55 | * @burst_reg_cmd: Register command that triggers burst |
---|
54 | 56 | * @burst_len: Burst size in the SPI RX buffer. If @burst_max_len is defined, |
---|
.. | .. |
---|
77 | 79 | unsigned int status_error_mask; |
---|
78 | 80 | |
---|
79 | 81 | int (*enable_irq)(struct adis *adis, bool enable); |
---|
| 82 | + bool unmasked_drdy; |
---|
80 | 83 | |
---|
81 | 84 | bool has_paging; |
---|
82 | 85 | |
---|
.. | .. |
---|
126 | 129 | unsigned long irq_flag; |
---|
127 | 130 | void *buffer; |
---|
128 | 131 | |
---|
129 | | - uint8_t tx[10] ____cacheline_aligned; |
---|
130 | | - uint8_t rx[4]; |
---|
| 132 | + u8 tx[10] ____cacheline_aligned; |
---|
| 133 | + u8 rx[4]; |
---|
131 | 134 | }; |
---|
132 | 135 | |
---|
133 | 136 | int adis_init(struct adis *adis, struct iio_dev *indio_dev, |
---|
134 | | - struct spi_device *spi, const struct adis_data *data); |
---|
| 137 | + struct spi_device *spi, const struct adis_data *data); |
---|
135 | 138 | int __adis_reset(struct adis *adis); |
---|
136 | 139 | |
---|
137 | 140 | /** |
---|
.. | .. |
---|
152 | 155 | } |
---|
153 | 156 | |
---|
154 | 157 | int __adis_write_reg(struct adis *adis, unsigned int reg, |
---|
155 | | - unsigned int val, unsigned int size); |
---|
| 158 | + unsigned int val, unsigned int size); |
---|
156 | 159 | int __adis_read_reg(struct adis *adis, unsigned int reg, |
---|
157 | | - unsigned int *val, unsigned int size); |
---|
| 160 | + unsigned int *val, unsigned int size); |
---|
158 | 161 | |
---|
159 | 162 | /** |
---|
160 | 163 | * __adis_write_reg_8() - Write single byte to a register (unlocked) |
---|
.. | .. |
---|
163 | 166 | * @value: The value to write |
---|
164 | 167 | */ |
---|
165 | 168 | static inline int __adis_write_reg_8(struct adis *adis, unsigned int reg, |
---|
166 | | - uint8_t val) |
---|
| 169 | + u8 val) |
---|
167 | 170 | { |
---|
168 | 171 | return __adis_write_reg(adis, reg, val, 1); |
---|
169 | 172 | } |
---|
.. | .. |
---|
175 | 178 | * @value: Value to be written |
---|
176 | 179 | */ |
---|
177 | 180 | static inline int __adis_write_reg_16(struct adis *adis, unsigned int reg, |
---|
178 | | - uint16_t val) |
---|
| 181 | + u16 val) |
---|
179 | 182 | { |
---|
180 | 183 | return __adis_write_reg(adis, reg, val, 2); |
---|
181 | 184 | } |
---|
.. | .. |
---|
187 | 190 | * @value: Value to be written |
---|
188 | 191 | */ |
---|
189 | 192 | static inline int __adis_write_reg_32(struct adis *adis, unsigned int reg, |
---|
190 | | - uint32_t val) |
---|
| 193 | + u32 val) |
---|
191 | 194 | { |
---|
192 | 195 | return __adis_write_reg(adis, reg, val, 4); |
---|
193 | 196 | } |
---|
.. | .. |
---|
199 | 202 | * @val: The value read back from the device |
---|
200 | 203 | */ |
---|
201 | 204 | static inline int __adis_read_reg_16(struct adis *adis, unsigned int reg, |
---|
202 | | - uint16_t *val) |
---|
| 205 | + u16 *val) |
---|
203 | 206 | { |
---|
204 | 207 | unsigned int tmp; |
---|
205 | 208 | int ret; |
---|
.. | .. |
---|
218 | 221 | * @val: The value read back from the device |
---|
219 | 222 | */ |
---|
220 | 223 | static inline int __adis_read_reg_32(struct adis *adis, unsigned int reg, |
---|
221 | | - uint32_t *val) |
---|
| 224 | + u32 *val) |
---|
222 | 225 | { |
---|
223 | 226 | unsigned int tmp; |
---|
224 | 227 | int ret; |
---|
.. | .. |
---|
238 | 241 | * @size: The size of the @value (in bytes) |
---|
239 | 242 | */ |
---|
240 | 243 | static inline int adis_write_reg(struct adis *adis, unsigned int reg, |
---|
241 | | - unsigned int val, unsigned int size) |
---|
| 244 | + unsigned int val, unsigned int size) |
---|
242 | 245 | { |
---|
243 | 246 | int ret; |
---|
244 | 247 | |
---|
.. | .. |
---|
257 | 260 | * @size: The size of the @val buffer |
---|
258 | 261 | */ |
---|
259 | 262 | static int adis_read_reg(struct adis *adis, unsigned int reg, |
---|
260 | | - unsigned int *val, unsigned int size) |
---|
| 263 | + unsigned int *val, unsigned int size) |
---|
261 | 264 | { |
---|
262 | 265 | int ret; |
---|
263 | 266 | |
---|
.. | .. |
---|
275 | 278 | * @value: The value to write |
---|
276 | 279 | */ |
---|
277 | 280 | static inline int adis_write_reg_8(struct adis *adis, unsigned int reg, |
---|
278 | | - uint8_t val) |
---|
| 281 | + u8 val) |
---|
279 | 282 | { |
---|
280 | 283 | return adis_write_reg(adis, reg, val, 1); |
---|
281 | 284 | } |
---|
.. | .. |
---|
287 | 290 | * @value: Value to be written |
---|
288 | 291 | */ |
---|
289 | 292 | static inline int adis_write_reg_16(struct adis *adis, unsigned int reg, |
---|
290 | | - uint16_t val) |
---|
| 293 | + u16 val) |
---|
291 | 294 | { |
---|
292 | 295 | return adis_write_reg(adis, reg, val, 2); |
---|
293 | 296 | } |
---|
.. | .. |
---|
299 | 302 | * @value: Value to be written |
---|
300 | 303 | */ |
---|
301 | 304 | static inline int adis_write_reg_32(struct adis *adis, unsigned int reg, |
---|
302 | | - uint32_t val) |
---|
| 305 | + u32 val) |
---|
303 | 306 | { |
---|
304 | 307 | return adis_write_reg(adis, reg, val, 4); |
---|
305 | 308 | } |
---|
.. | .. |
---|
311 | 314 | * @val: The value read back from the device |
---|
312 | 315 | */ |
---|
313 | 316 | static inline int adis_read_reg_16(struct adis *adis, unsigned int reg, |
---|
314 | | - uint16_t *val) |
---|
| 317 | + u16 *val) |
---|
315 | 318 | { |
---|
316 | 319 | unsigned int tmp; |
---|
317 | 320 | int ret; |
---|
.. | .. |
---|
330 | 333 | * @val: The value read back from the device |
---|
331 | 334 | */ |
---|
332 | 335 | static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, |
---|
333 | | - uint32_t *val) |
---|
| 336 | + u32 *val) |
---|
334 | 337 | { |
---|
335 | 338 | unsigned int tmp; |
---|
336 | 339 | int ret; |
---|
.. | .. |
---|
401 | 404 | __adis_update_bits_base(adis, reg, mask, val, 2)); \ |
---|
402 | 405 | }) |
---|
403 | 406 | |
---|
404 | | -int adis_enable_irq(struct adis *adis, bool enable); |
---|
405 | 407 | int __adis_check_status(struct adis *adis); |
---|
406 | 408 | int __adis_initial_startup(struct adis *adis); |
---|
| 409 | +int __adis_enable_irq(struct adis *adis, bool enable); |
---|
| 410 | + |
---|
| 411 | +static inline int adis_enable_irq(struct adis *adis, bool enable) |
---|
| 412 | +{ |
---|
| 413 | + int ret; |
---|
| 414 | + |
---|
| 415 | + mutex_lock(&adis->state_lock); |
---|
| 416 | + ret = __adis_enable_irq(adis, enable); |
---|
| 417 | + mutex_unlock(&adis->state_lock); |
---|
| 418 | + |
---|
| 419 | + return ret; |
---|
| 420 | +} |
---|
407 | 421 | |
---|
408 | 422 | static inline int adis_check_status(struct adis *adis) |
---|
409 | 423 | { |
---|
.. | .. |
---|
429 | 443 | } |
---|
430 | 444 | |
---|
431 | 445 | int adis_single_conversion(struct iio_dev *indio_dev, |
---|
432 | | - const struct iio_chan_spec *chan, unsigned int error_mask, |
---|
433 | | - int *val); |
---|
| 446 | + const struct iio_chan_spec *chan, |
---|
| 447 | + unsigned int error_mask, int *val); |
---|
434 | 448 | |
---|
435 | 449 | #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \ |
---|
436 | 450 | .type = IIO_VOLTAGE, \ |
---|
.. | .. |
---|
479 | 493 | .modified = 1, \ |
---|
480 | 494 | .channel2 = IIO_MOD_ ## mod, \ |
---|
481 | 495 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
---|
482 | | - info_sep, \ |
---|
| 496 | + (info_sep), \ |
---|
483 | 497 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
---|
484 | 498 | .info_mask_shared_by_all = info_all, \ |
---|
485 | 499 | .address = (addr), \ |
---|
.. | .. |
---|
513 | 527 | int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev); |
---|
514 | 528 | |
---|
515 | 529 | int adis_update_scan_mode(struct iio_dev *indio_dev, |
---|
516 | | - const unsigned long *scan_mask); |
---|
| 530 | + const unsigned long *scan_mask); |
---|
517 | 531 | |
---|
518 | 532 | #else /* CONFIG_IIO_BUFFER */ |
---|
519 | 533 | |
---|
.. | .. |
---|
537 | 551 | #ifdef CONFIG_DEBUG_FS |
---|
538 | 552 | |
---|
539 | 553 | int adis_debugfs_reg_access(struct iio_dev *indio_dev, |
---|
540 | | - unsigned int reg, unsigned int writeval, unsigned int *readval); |
---|
| 554 | + unsigned int reg, unsigned int writeval, |
---|
| 555 | + unsigned int *readval); |
---|
541 | 556 | |
---|
542 | 557 | #else |
---|
543 | 558 | |
---|