18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef BMI160_H_
38c2ecf20Sopenharmony_ci#define BMI160_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/iio/iio.h>
68c2ecf20Sopenharmony_ci#include <linux/regulator/consumer.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cistruct bmi160_data {
98c2ecf20Sopenharmony_ci	struct regmap *regmap;
108c2ecf20Sopenharmony_ci	struct iio_trigger *trig;
118c2ecf20Sopenharmony_ci	struct regulator_bulk_data supplies[2];
128c2ecf20Sopenharmony_ci	struct iio_mount_matrix orientation;
138c2ecf20Sopenharmony_ci	/*
148c2ecf20Sopenharmony_ci	 * Ensure natural alignment for timestamp if present.
158c2ecf20Sopenharmony_ci	 * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts.
168c2ecf20Sopenharmony_ci	 * If fewer channels are enabled, less space may be needed, as
178c2ecf20Sopenharmony_ci	 * long as the timestamp is still aligned to 8 bytes.
188c2ecf20Sopenharmony_ci	 */
198c2ecf20Sopenharmony_ci	__le16 buf[12] __aligned(8);
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciextern const struct regmap_config bmi160_regmap_config;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciint bmi160_core_probe(struct device *dev, struct regmap *regmap,
258c2ecf20Sopenharmony_ci		      const char *name, bool use_spi);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciint bmi160_enable_irq(struct regmap *regmap, bool enable);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciint bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#endif  /* BMI160_H_ */
32