xref: /linux/drivers/iio/humidity/hts221.h (revision e9f0878c4b2004ac19581274c1ae4c61ae3ca70e)
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 
11 #ifndef HTS221_H
12 #define HTS221_H
13 
14 #define HTS221_DEV_NAME		"hts221"
15 
16 #include <linux/iio/iio.h>
17 
18 #define HTS221_DATA_SIZE	2
19 
20 enum hts221_sensor_type {
21 	HTS221_SENSOR_H,
22 	HTS221_SENSOR_T,
23 	HTS221_SENSOR_MAX,
24 };
25 
26 struct hts221_sensor {
27 	u8 cur_avg_idx;
28 	int slope, b_gen;
29 };
30 
31 struct hts221_hw {
32 	const char *name;
33 	struct device *dev;
34 	struct regmap *regmap;
35 
36 	struct iio_trigger *trig;
37 	int irq;
38 
39 	struct hts221_sensor sensors[HTS221_SENSOR_MAX];
40 
41 	bool enabled;
42 	u8 odr;
43 };
44 
45 extern const struct dev_pm_ops hts221_pm_ops;
46 
47 int hts221_probe(struct device *dev, int irq, const char *name,
48 		 struct regmap *regmap);
49 int hts221_set_enable(struct hts221_hw *hw, bool enable);
50 int hts221_allocate_buffers(struct hts221_hw *hw);
51 int hts221_allocate_trigger(struct hts221_hw *hw);
52 
53 #endif /* HTS221_H */
54