hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/include/linux/iio/imu/adis.h
....@@ -32,6 +32,7 @@
3232 u16 sw_reset_ms;
3333 u16 self_test_ms;
3434 };
35
+
3536 /**
3637 * struct adis_data - ADIS chip variant specific data
3738 * @read_delay: SPI delay for read operations in us
....@@ -45,10 +46,11 @@
4546 * @self_test_mask: Bitmask of supported self-test operations
4647 * @self_test_reg: Register address to request self test command
4748 * @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
4950 * @status_error_mask: Bitmask of errors supported by the device
5051 * @timeouts: Chip specific delays
5152 * @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
5254 * @has_paging: True if ADIS device has paged registers
5355 * @burst_reg_cmd: Register command that triggers burst
5456 * @burst_len: Burst size in the SPI RX buffer. If @burst_max_len is defined,
....@@ -77,6 +79,7 @@
7779 unsigned int status_error_mask;
7880
7981 int (*enable_irq)(struct adis *adis, bool enable);
82
+ bool unmasked_drdy;
8083
8184 bool has_paging;
8285
....@@ -126,12 +129,12 @@
126129 unsigned long irq_flag;
127130 void *buffer;
128131
129
- uint8_t tx[10] ____cacheline_aligned;
130
- uint8_t rx[4];
132
+ u8 tx[10] ____cacheline_aligned;
133
+ u8 rx[4];
131134 };
132135
133136 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);
135138 int __adis_reset(struct adis *adis);
136139
137140 /**
....@@ -152,9 +155,9 @@
152155 }
153156
154157 int __adis_write_reg(struct adis *adis, unsigned int reg,
155
- unsigned int val, unsigned int size);
158
+ unsigned int val, unsigned int size);
156159 int __adis_read_reg(struct adis *adis, unsigned int reg,
157
- unsigned int *val, unsigned int size);
160
+ unsigned int *val, unsigned int size);
158161
159162 /**
160163 * __adis_write_reg_8() - Write single byte to a register (unlocked)
....@@ -163,7 +166,7 @@
163166 * @value: The value to write
164167 */
165168 static inline int __adis_write_reg_8(struct adis *adis, unsigned int reg,
166
- uint8_t val)
169
+ u8 val)
167170 {
168171 return __adis_write_reg(adis, reg, val, 1);
169172 }
....@@ -175,7 +178,7 @@
175178 * @value: Value to be written
176179 */
177180 static inline int __adis_write_reg_16(struct adis *adis, unsigned int reg,
178
- uint16_t val)
181
+ u16 val)
179182 {
180183 return __adis_write_reg(adis, reg, val, 2);
181184 }
....@@ -187,7 +190,7 @@
187190 * @value: Value to be written
188191 */
189192 static inline int __adis_write_reg_32(struct adis *adis, unsigned int reg,
190
- uint32_t val)
193
+ u32 val)
191194 {
192195 return __adis_write_reg(adis, reg, val, 4);
193196 }
....@@ -199,7 +202,7 @@
199202 * @val: The value read back from the device
200203 */
201204 static inline int __adis_read_reg_16(struct adis *adis, unsigned int reg,
202
- uint16_t *val)
205
+ u16 *val)
203206 {
204207 unsigned int tmp;
205208 int ret;
....@@ -218,7 +221,7 @@
218221 * @val: The value read back from the device
219222 */
220223 static inline int __adis_read_reg_32(struct adis *adis, unsigned int reg,
221
- uint32_t *val)
224
+ u32 *val)
222225 {
223226 unsigned int tmp;
224227 int ret;
....@@ -238,7 +241,7 @@
238241 * @size: The size of the @value (in bytes)
239242 */
240243 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)
242245 {
243246 int ret;
244247
....@@ -257,7 +260,7 @@
257260 * @size: The size of the @val buffer
258261 */
259262 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)
261264 {
262265 int ret;
263266
....@@ -275,7 +278,7 @@
275278 * @value: The value to write
276279 */
277280 static inline int adis_write_reg_8(struct adis *adis, unsigned int reg,
278
- uint8_t val)
281
+ u8 val)
279282 {
280283 return adis_write_reg(adis, reg, val, 1);
281284 }
....@@ -287,7 +290,7 @@
287290 * @value: Value to be written
288291 */
289292 static inline int adis_write_reg_16(struct adis *adis, unsigned int reg,
290
- uint16_t val)
293
+ u16 val)
291294 {
292295 return adis_write_reg(adis, reg, val, 2);
293296 }
....@@ -299,7 +302,7 @@
299302 * @value: Value to be written
300303 */
301304 static inline int adis_write_reg_32(struct adis *adis, unsigned int reg,
302
- uint32_t val)
305
+ u32 val)
303306 {
304307 return adis_write_reg(adis, reg, val, 4);
305308 }
....@@ -311,7 +314,7 @@
311314 * @val: The value read back from the device
312315 */
313316 static inline int adis_read_reg_16(struct adis *adis, unsigned int reg,
314
- uint16_t *val)
317
+ u16 *val)
315318 {
316319 unsigned int tmp;
317320 int ret;
....@@ -330,7 +333,7 @@
330333 * @val: The value read back from the device
331334 */
332335 static inline int adis_read_reg_32(struct adis *adis, unsigned int reg,
333
- uint32_t *val)
336
+ u32 *val)
334337 {
335338 unsigned int tmp;
336339 int ret;
....@@ -401,9 +404,20 @@
401404 __adis_update_bits_base(adis, reg, mask, val, 2)); \
402405 })
403406
404
-int adis_enable_irq(struct adis *adis, bool enable);
405407 int __adis_check_status(struct adis *adis);
406408 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
+}
407421
408422 static inline int adis_check_status(struct adis *adis)
409423 {
....@@ -429,8 +443,8 @@
429443 }
430444
431445 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);
434448
435449 #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \
436450 .type = IIO_VOLTAGE, \
....@@ -479,7 +493,7 @@
479493 .modified = 1, \
480494 .channel2 = IIO_MOD_ ## mod, \
481495 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
482
- info_sep, \
496
+ (info_sep), \
483497 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
484498 .info_mask_shared_by_all = info_all, \
485499 .address = (addr), \
....@@ -513,7 +527,7 @@
513527 int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev);
514528
515529 int adis_update_scan_mode(struct iio_dev *indio_dev,
516
- const unsigned long *scan_mask);
530
+ const unsigned long *scan_mask);
517531
518532 #else /* CONFIG_IIO_BUFFER */
519533
....@@ -537,7 +551,8 @@
537551 #ifdef CONFIG_DEBUG_FS
538552
539553 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);
541556
542557 #else
543558