Commit | Line | Data |
---|---|---|
fda8d26e | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
e4a70e3e LB |
2 | /* |
3 | * STMicroelectronics hts221 sensor driver | |
4 | * | |
5 | * Copyright 2016 STMicroelectronics Inc. | |
6 | * | |
7 | * Lorenzo Bianconi <lorenzo.bianconi@st.com> | |
e4a70e3e LB |
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 | ||
e4a70e3e LB |
17 | enum hts221_sensor_type { |
18 | HTS221_SENSOR_H, | |
19 | HTS221_SENSOR_T, | |
20 | HTS221_SENSOR_MAX, | |
21 | }; | |
22 | ||
23 | struct hts221_sensor { | |
24 | u8 cur_avg_idx; | |
25 | int slope, b_gen; | |
26 | }; | |
27 | ||
28 | struct hts221_hw { | |
29 | const char *name; | |
30 | struct device *dev; | |
62177922 | 31 | struct regmap *regmap; |
e4a70e3e | 32 | |
e4a70e3e LB |
33 | struct iio_trigger *trig; |
34 | int irq; | |
35 | ||
36 | struct hts221_sensor sensors[HTS221_SENSOR_MAX]; | |
37 | ||
b7079eea | 38 | bool enabled; |
e4a70e3e | 39 | u8 odr; |
5c49056a JC |
40 | /* Ensure natural alignment of timestamp */ |
41 | struct { | |
42 | __le16 channels[2]; | |
43 | s64 ts __aligned(8); | |
44 | } scan; | |
e4a70e3e LB |
45 | }; |
46 | ||
b7079eea LB |
47 | extern const struct dev_pm_ops hts221_pm_ops; |
48 | ||
e1ca1141 | 49 | int hts221_probe(struct device *dev, int irq, const char *name, |
62177922 | 50 | struct regmap *regmap); |
e3e25446 | 51 | int hts221_set_enable(struct hts221_hw *hw, bool enable); |
e4a70e3e LB |
52 | int hts221_allocate_buffers(struct hts221_hw *hw); |
53 | int hts221_allocate_trigger(struct hts221_hw *hw); | |
54 | ||
55 | #endif /* HTS221_H */ |