2 * Measurements Specialties common sensor driver
4 * Copyright (c) 2015 Measurement-Specialties
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #ifndef _MS_SENSORS_I2C_H
12 #define _MS_SENSORS_I2C_H
14 #include <linux/i2c.h>
15 #include <linux/mutex.h>
17 #define MS_SENSORS_TP_PROM_WORDS_NB 7
20 * struct ms_ht_dev - Humidity/Temperature sensor device structure
22 * @lock: lock protecting the i2c conversion
23 * @res_index: index to selected sensor resolution
26 struct i2c_client
*client
;
32 * struct ms_tp_dev - Temperature/Pressure sensor device structure
34 * @lock: lock protecting the i2c conversion
35 * @prom: array of PROM coefficients used for conversion. Added element
37 * @res_index: index to selected sensor resolution
40 struct i2c_client
*client
;
42 u16 prom
[MS_SENSORS_TP_PROM_WORDS_NB
+ 1];
46 int ms_sensors_reset(void *cli
, u8 cmd
, unsigned int delay
);
47 int ms_sensors_read_prom_word(void *cli
, int cmd
, u16
*word
);
48 int ms_sensors_convert_and_read(void *cli
, u8 conv
, u8 rd
,
49 unsigned int delay
, u32
*adc
);
50 int ms_sensors_read_serial(struct i2c_client
*client
, u64
*sn
);
51 ssize_t
ms_sensors_show_serial(struct ms_ht_dev
*dev_data
, char *buf
);
52 ssize_t
ms_sensors_write_resolution(struct ms_ht_dev
*dev_data
, u8 i
);
53 ssize_t
ms_sensors_show_battery_low(struct ms_ht_dev
*dev_data
, char *buf
);
54 ssize_t
ms_sensors_show_heater(struct ms_ht_dev
*dev_data
, char *buf
);
55 ssize_t
ms_sensors_write_heater(struct ms_ht_dev
*dev_data
,
56 const char *buf
, size_t len
);
57 int ms_sensors_ht_read_temperature(struct ms_ht_dev
*dev_data
,
59 int ms_sensors_ht_read_humidity(struct ms_ht_dev
*dev_data
,
61 int ms_sensors_tp_read_prom(struct ms_tp_dev
*dev_data
);
62 int ms_sensors_read_temp_and_pressure(struct ms_tp_dev
*dev_data
,
64 unsigned int *pressure
);
66 #endif /* _MS_SENSORS_I2C_H */