ms5611.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * MS5611 pressure and temperature sensor driver
  3. *
  4. * Copyright (c) Tomasz Duszynski <tduszyns@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #ifndef _MS5611_H
  12. #define _MS5611_H
  13. #include <linux/device.h>
  14. #include <linux/iio/iio.h>
  15. #include <linux/mutex.h>
  16. #define MS5611_RESET 0x1e
  17. #define MS5611_READ_ADC 0x00
  18. #define MS5611_READ_PROM_WORD 0xA0
  19. #define MS5611_START_TEMP_CONV 0x58
  20. #define MS5611_START_PRESSURE_CONV 0x48
  21. #define MS5611_CONV_TIME_MIN 9040
  22. #define MS5611_CONV_TIME_MAX 10000
  23. #define MS5611_PROM_WORDS_NB 8
  24. struct ms5611_state {
  25. void *client;
  26. struct mutex lock;
  27. int (*reset)(struct device *dev);
  28. int (*read_prom_word)(struct device *dev, int index, u16 *word);
  29. int (*read_adc_temp_and_pressure)(struct device *dev,
  30. s32 *temp, s32 *pressure);
  31. u16 prom[MS5611_PROM_WORDS_NB];
  32. };
  33. int ms5611_probe(struct iio_dev *indio_dev, struct device *dev);
  34. #endif /* _MS5611_H */