Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / iio / pressure / ms5611.h
bloba78acd3fb18f784081a987977768248c94313836
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * MS5611 pressure and temperature sensor driver
5 * Copyright (c) Tomasz Duszynski <tduszyns@gmail.com>
7 */
9 #ifndef _MS5611_H
10 #define _MS5611_H
12 #include <linux/device.h>
13 #include <linux/iio/iio.h>
14 #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_PROM_WORDS_NB 8
21 enum {
22 MS5611,
23 MS5607,
27 * OverSampling Rate descriptor.
28 * Warning: cmd MUST be kept aligned on a word boundary (see
29 * m5611_spi_read_adc_temp_and_pressure in ms5611_spi.c).
31 struct ms5611_osr {
32 unsigned long conv_usec;
33 u8 cmd;
34 unsigned short rate;
37 struct ms5611_state {
38 void *client;
39 struct mutex lock;
41 const struct ms5611_osr *pressure_osr;
42 const struct ms5611_osr *temp_osr;
44 u16 prom[MS5611_PROM_WORDS_NB];
46 int (*reset)(struct ms5611_state *st);
47 int (*read_prom_word)(struct ms5611_state *st, int index, u16 *word);
48 int (*read_adc_temp_and_pressure)(struct ms5611_state *st,
49 s32 *temp, s32 *pressure);
51 int (*compensate_temp_and_pressure)(struct ms5611_state *st, s32 *temp,
52 s32 *pressure);
55 int ms5611_probe(struct iio_dev *indio_dev, struct device *dev,
56 const char *name, int type);
58 #endif /* _MS5611_H */