inv_mpu_magn.h 931 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2019 TDK-InvenSense, Inc.
  4. */
  5. #ifndef INV_MPU_MAGN_H_
  6. #define INV_MPU_MAGN_H_
  7. #include <linux/kernel.h>
  8. #include "inv_mpu_iio.h"
  9. /* Magnetometer maximum frequency */
  10. #define INV_MPU_MAGN_FREQ_HZ_MAX 50
  11. int inv_mpu_magn_probe(struct inv_mpu6050_state *st);
  12. /**
  13. * inv_mpu_magn_get_scale() - get magnetometer scale value
  14. * @st: driver internal state
  15. *
  16. * Returns IIO data format.
  17. */
  18. static inline int inv_mpu_magn_get_scale(const struct inv_mpu6050_state *st,
  19. const struct iio_chan_spec *chan,
  20. int *val, int *val2)
  21. {
  22. *val = 0;
  23. *val2 = st->magn_raw_to_gauss[chan->address];
  24. return IIO_VAL_INT_PLUS_MICRO;
  25. }
  26. int inv_mpu_magn_set_rate(const struct inv_mpu6050_state *st, int fifo_rate);
  27. int inv_mpu_magn_set_orient(struct inv_mpu6050_state *st);
  28. int inv_mpu_magn_read(struct inv_mpu6050_state *st, int axis, int *val);
  29. #endif /* INV_MPU_MAGN_H_ */