mmc: rtsx_pci: Enable MMC_CAP_ERASE to allow erase/discard/trim requests
[linux/fpc-iii.git] / drivers / iio / common / ms_sensors / ms_sensors_i2c.h
blob7b614adc5caefe4227914c9ab869d9b253ddd5bb
1 /*
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.
9 */
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
19 /**
20 * struct ms_ht_dev - Humidity/Temperature sensor device structure
21 * @client: i2c client
22 * @lock: lock protecting the i2c conversion
23 * @res_index: index to selected sensor resolution
25 struct ms_ht_dev {
26 struct i2c_client *client;
27 struct mutex lock;
28 u8 res_index;
31 /**
32 * struct ms_tp_dev - Temperature/Pressure sensor device structure
33 * @client: i2c client
34 * @lock: lock protecting the i2c conversion
35 * @prom: array of PROM coefficients used for conversion. Added element
36 * for CRC computation
37 * @res_index: index to selected sensor resolution
39 struct ms_tp_dev {
40 struct i2c_client *client;
41 struct mutex lock;
42 u16 prom[MS_SENSORS_TP_PROM_WORDS_NB + 1];
43 u8 res_index;
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,
58 s32 *temperature);
59 int ms_sensors_ht_read_humidity(struct ms_ht_dev *dev_data,
60 u32 *humidity);
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,
63 int *temperature,
64 unsigned int *pressure);
66 #endif /* _MS_SENSORS_I2C_H */