xref: /OK3568_Linux_fs/kernel/drivers/iio/imu/bmi160/bmi160.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef BMI160_H_
3*4882a593Smuzhiyun #define BMI160_H_
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <linux/iio/iio.h>
6*4882a593Smuzhiyun #include <linux/regulator/consumer.h>
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun struct bmi160_data {
9*4882a593Smuzhiyun 	struct regmap *regmap;
10*4882a593Smuzhiyun 	struct iio_trigger *trig;
11*4882a593Smuzhiyun 	struct regulator_bulk_data supplies[2];
12*4882a593Smuzhiyun 	struct iio_mount_matrix orientation;
13*4882a593Smuzhiyun 	/*
14*4882a593Smuzhiyun 	 * Ensure natural alignment for timestamp if present.
15*4882a593Smuzhiyun 	 * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts.
16*4882a593Smuzhiyun 	 * If fewer channels are enabled, less space may be needed, as
17*4882a593Smuzhiyun 	 * long as the timestamp is still aligned to 8 bytes.
18*4882a593Smuzhiyun 	 */
19*4882a593Smuzhiyun 	__le16 buf[12] __aligned(8);
20*4882a593Smuzhiyun };
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun extern const struct regmap_config bmi160_regmap_config;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun int bmi160_core_probe(struct device *dev, struct regmap *regmap,
25*4882a593Smuzhiyun 		      const char *name, bool use_spi);
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun int bmi160_enable_irq(struct regmap *regmap, bool enable);
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type);
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #endif  /* BMI160_H_ */
32