iio: pressure: add support for MS5611 pressure and temperature sensor
[linux-2.6-block.git] / drivers / iio / pressure / ms5611.h
CommitLineData
c0644160
TD
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
12#ifndef _MS5611_H
13#define _MS5611_H
14
15#include <linux/device.h>
16#include <linux/iio/iio.h>
17#include <linux/mutex.h>
18
19#define MS5611_RESET 0x1e
20#define MS5611_READ_ADC 0x00
21#define MS5611_READ_PROM_WORD 0xA0
22#define MS5611_START_TEMP_CONV 0x58
23#define MS5611_START_PRESSURE_CONV 0x48
24
25#define MS5611_CONV_TIME_MIN 9040
26#define MS5611_CONV_TIME_MAX 10000
27
28#define MS5611_PROM_WORDS_NB 8
29
30struct ms5611_state {
31 void *client;
32 struct mutex lock;
33
34 int (*reset)(struct device *dev);
35 int (*read_prom_word)(struct device *dev, int index, u16 *word);
36 int (*read_adc_temp_and_pressure)(struct device *dev,
37 s32 *temp, s32 *pressure);
38
39 u16 prom[MS5611_PROM_WORDS_NB];
40};
41
42int ms5611_probe(struct iio_dev *indio_dev, struct device *dev);
43
44#endif /* _MS5611_H */