blob: 7d6771f7cf473663b7607a0fc886fa2b4822d802 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * STMicroelectronics hts221 sensor driver
4 *
5 * Copyright 2016 STMicroelectronics Inc.
6 *
7 * Lorenzo Bianconi <lorenzo.bianconi@st.com>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008 */
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
19enum hts221_sensor_type {
20 HTS221_SENSOR_H,
21 HTS221_SENSOR_T,
22 HTS221_SENSOR_MAX,
23};
24
25struct hts221_sensor {
26 u8 cur_avg_idx;
27 int slope, b_gen;
28};
29
30struct 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
44extern const struct dev_pm_ops hts221_pm_ops;
45
46int hts221_probe(struct device *dev, int irq, const char *name,
47 struct regmap *regmap);
48int hts221_set_enable(struct hts221_hw *hw, bool enable);
49int hts221_allocate_buffers(struct hts221_hw *hw);
50int hts221_allocate_trigger(struct hts221_hw *hw);
51
52#endif /* HTS221_H */