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