xref: /linux/drivers/iio/imu/bmi160/bmi160.h (revision 7b6b51234df6cd8b04fe736b0b89c25612d896b8)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
277c4ad2dSDaniel Baluta #ifndef BMI160_H_
377c4ad2dSDaniel Baluta #define BMI160_H_
477c4ad2dSDaniel Baluta 
5895bf81eSMartin Kelly #include <linux/iio/iio.h>
65dea3fb0SJonathan Albrieux #include <linux/regulator/consumer.h>
7895bf81eSMartin Kelly 
8895bf81eSMartin Kelly struct bmi160_data {
9895bf81eSMartin Kelly 	struct regmap *regmap;
10895bf81eSMartin Kelly 	struct iio_trigger *trig;
115dea3fb0SJonathan Albrieux 	struct regulator_bulk_data supplies[2];
12812a46b7SJonathan Albrieux 	struct iio_mount_matrix orientation;
13*7b6b5123SJonathan Cameron 	/*
14*7b6b5123SJonathan Cameron 	 * Ensure natural alignment for timestamp if present.
15*7b6b5123SJonathan Cameron 	 * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts.
16*7b6b5123SJonathan Cameron 	 * If fewer channels are enabled, less space may be needed, as
17*7b6b5123SJonathan Cameron 	 * long as the timestamp is still aligned to 8 bytes.
18*7b6b5123SJonathan Cameron 	 */
19*7b6b5123SJonathan Cameron 	__le16 buf[12] __aligned(8);
20895bf81eSMartin Kelly };
21895bf81eSMartin Kelly 
2277c4ad2dSDaniel Baluta extern const struct regmap_config bmi160_regmap_config;
2377c4ad2dSDaniel Baluta 
2477c4ad2dSDaniel Baluta int bmi160_core_probe(struct device *dev, struct regmap *regmap,
2577c4ad2dSDaniel Baluta 		      const char *name, bool use_spi);
2677c4ad2dSDaniel Baluta 
27895bf81eSMartin Kelly int bmi160_enable_irq(struct regmap *regmap, bool enable);
28895bf81eSMartin Kelly 
29895bf81eSMartin Kelly int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type);
30895bf81eSMartin Kelly 
3177c4ad2dSDaniel Baluta #endif  /* BMI160_H_ */
32