sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / iio / humidity / hts221.h
blobc7154665512eed1a98ac76dccbc763b77ad260a3
1 /*
2 * STMicroelectronics hts221 sensor driver
4 * Copyright 2016 STMicroelectronics Inc.
6 * Lorenzo Bianconi <lorenzo.bianconi@st.com>
8 * Licensed under the GPL-2.
9 */
11 #ifndef HTS221_H
12 #define HTS221_H
14 #define HTS221_DEV_NAME "hts221"
16 #include <linux/iio/iio.h>
18 #define HTS221_RX_MAX_LENGTH 8
19 #define HTS221_TX_MAX_LENGTH 8
21 #define HTS221_DATA_SIZE 2
23 struct hts221_transfer_buffer {
24 u8 rx_buf[HTS221_RX_MAX_LENGTH];
25 u8 tx_buf[HTS221_TX_MAX_LENGTH] ____cacheline_aligned;
28 struct hts221_transfer_function {
29 int (*read)(struct device *dev, u8 addr, int len, u8 *data);
30 int (*write)(struct device *dev, u8 addr, int len, u8 *data);
33 #define HTS221_AVG_DEPTH 8
34 struct hts221_avg_avl {
35 u16 avg;
36 u8 val;
39 enum hts221_sensor_type {
40 HTS221_SENSOR_H,
41 HTS221_SENSOR_T,
42 HTS221_SENSOR_MAX,
45 struct hts221_sensor {
46 u8 cur_avg_idx;
47 int slope, b_gen;
50 struct hts221_hw {
51 const char *name;
52 struct device *dev;
54 struct mutex lock;
55 struct iio_trigger *trig;
56 int irq;
58 struct hts221_sensor sensors[HTS221_SENSOR_MAX];
60 u8 odr;
62 const struct hts221_transfer_function *tf;
63 struct hts221_transfer_buffer tb;
66 int hts221_config_drdy(struct hts221_hw *hw, bool enable);
67 int hts221_probe(struct iio_dev *iio_dev);
68 int hts221_power_on(struct hts221_hw *hw);
69 int hts221_power_off(struct hts221_hw *hw);
70 int hts221_allocate_buffers(struct hts221_hw *hw);
71 int hts221_allocate_trigger(struct hts221_hw *hw);
73 #endif /* HTS221_H */