hts221.h 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * STMicroelectronics hts221 sensor driver
  3. *
  4. * Copyright 2016 STMicroelectronics Inc.
  5. *
  6. * Lorenzo Bianconi <lorenzo.bianconi@st.com>
  7. *
  8. * Licensed under the GPL-2.
  9. */
  10. #ifndef HTS221_H
  11. #define HTS221_H
  12. #define HTS221_DEV_NAME "hts221"
  13. #include <linux/iio/iio.h>
  14. #define HTS221_DATA_SIZE 2
  15. enum hts221_sensor_type {
  16. HTS221_SENSOR_H,
  17. HTS221_SENSOR_T,
  18. HTS221_SENSOR_MAX,
  19. };
  20. struct hts221_sensor {
  21. u8 cur_avg_idx;
  22. int slope, b_gen;
  23. };
  24. struct hts221_hw {
  25. const char *name;
  26. struct device *dev;
  27. struct regmap *regmap;
  28. struct iio_trigger *trig;
  29. int irq;
  30. struct hts221_sensor sensors[HTS221_SENSOR_MAX];
  31. bool enabled;
  32. u8 odr;
  33. };
  34. extern const struct dev_pm_ops hts221_pm_ops;
  35. int hts221_probe(struct device *dev, int irq, const char *name,
  36. struct regmap *regmap);
  37. int hts221_set_enable(struct hts221_hw *hw, bool enable);
  38. int hts221_allocate_buffers(struct hts221_hw *hw);
  39. int hts221_allocate_trigger(struct hts221_hw *hw);
  40. #endif /* HTS221_H */