diff options
Diffstat (limited to 'include/linux/iio')
| -rw-r--r-- | include/linux/iio/accel/kxcjk_1013.h | 22 | ||||
| -rw-r--r-- | include/linux/iio/common/st_sensors.h | 12 | ||||
| -rw-r--r-- | include/linux/iio/common/st_sensors_i2c.h | 11 | ||||
| -rw-r--r-- | include/linux/iio/iio.h | 9 | ||||
| -rw-r--r-- | include/linux/iio/imu/adis.h | 33 | ||||
| -rw-r--r-- | include/linux/iio/trigger.h | 5 | ||||
| -rw-r--r-- | include/linux/iio/types.h | 5 |
7 files changed, 60 insertions, 37 deletions
diff --git a/include/linux/iio/accel/kxcjk_1013.h b/include/linux/iio/accel/kxcjk_1013.h new file mode 100644 index 000000000000..fd1d540ea62d --- /dev/null +++ b/include/linux/iio/accel/kxcjk_1013.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* | ||
| 2 | * KXCJK-1013 3-axis accelerometer Interface | ||
| 3 | * Copyright (c) 2014, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __IIO_KXCJK_1013_H__ | ||
| 16 | #define __IIO_KXCJK_1013_H__ | ||
| 17 | |||
| 18 | struct kxcjk_1013_platform_data { | ||
| 19 | bool active_high_intr; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #endif | ||
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 96f51f0e0096..d8257ab60bac 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | .type = device_type, \ | 47 | .type = device_type, \ |
| 48 | .modified = mod, \ | 48 | .modified = mod, \ |
| 49 | .info_mask_separate = mask, \ | 49 | .info_mask_separate = mask, \ |
| 50 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ | ||
| 50 | .scan_index = index, \ | 51 | .scan_index = index, \ |
| 51 | .channel2 = ch2, \ | 52 | .channel2 = ch2, \ |
| 52 | .address = addr, \ | 53 | .address = addr, \ |
| @@ -59,11 +60,6 @@ | |||
| 59 | }, \ | 60 | }, \ |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | #define ST_SENSOR_DEV_ATTR_SAMP_FREQ() \ | ||
| 63 | IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, \ | ||
| 64 | st_sensors_sysfs_get_sampling_frequency, \ | ||
| 65 | st_sensors_sysfs_set_sampling_frequency) | ||
| 66 | |||
| 67 | #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ | 63 | #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ |
| 68 | IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ | 64 | IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ |
| 69 | st_sensors_sysfs_sampling_frequency_avail) | 65 | st_sensors_sysfs_sampling_frequency_avail) |
| @@ -285,12 +281,6 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev, | |||
| 285 | int st_sensors_check_device_support(struct iio_dev *indio_dev, | 281 | int st_sensors_check_device_support(struct iio_dev *indio_dev, |
| 286 | int num_sensors_list, const struct st_sensors *sensors); | 282 | int num_sensors_list, const struct st_sensors *sensors); |
| 287 | 283 | ||
| 288 | ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev, | ||
| 289 | struct device_attribute *attr, char *buf); | ||
| 290 | |||
| 291 | ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev, | ||
| 292 | struct device_attribute *attr, const char *buf, size_t size); | ||
| 293 | |||
| 294 | ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, | 284 | ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, |
| 295 | struct device_attribute *attr, char *buf); | 285 | struct device_attribute *attr, char *buf); |
| 296 | 286 | ||
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h index 67d845385ae2..1796af093368 100644 --- a/include/linux/iio/common/st_sensors_i2c.h +++ b/include/linux/iio/common/st_sensors_i2c.h | |||
| @@ -13,8 +13,19 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
| 15 | #include <linux/iio/common/st_sensors.h> | 15 | #include <linux/iio/common/st_sensors.h> |
| 16 | #include <linux/of.h> | ||
| 16 | 17 | ||
| 17 | void st_sensors_i2c_configure(struct iio_dev *indio_dev, | 18 | void st_sensors_i2c_configure(struct iio_dev *indio_dev, |
| 18 | struct i2c_client *client, struct st_sensor_data *sdata); | 19 | struct i2c_client *client, struct st_sensor_data *sdata); |
| 19 | 20 | ||
| 21 | #ifdef CONFIG_OF | ||
| 22 | void st_sensors_of_i2c_probe(struct i2c_client *client, | ||
| 23 | const struct of_device_id *match); | ||
| 24 | #else | ||
| 25 | static inline void st_sensors_of_i2c_probe(struct i2c_client *client, | ||
| 26 | const struct of_device_id *match) | ||
| 27 | { | ||
| 28 | } | ||
| 29 | #endif | ||
| 30 | |||
| 20 | #endif /* ST_SENSORS_I2C_H */ | 31 | #endif /* ST_SENSORS_I2C_H */ |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index ccde91725f98..15dc6bc2bdd2 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
| @@ -277,14 +277,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, | |||
| 277 | **/ | 277 | **/ |
| 278 | static inline s64 iio_get_time_ns(void) | 278 | static inline s64 iio_get_time_ns(void) |
| 279 | { | 279 | { |
| 280 | struct timespec ts; | 280 | return ktime_get_real_ns(); |
| 281 | /* | ||
| 282 | * calls getnstimeofday. | ||
| 283 | * If hrtimers then up to ns accurate, if not microsecond. | ||
| 284 | */ | ||
| 285 | ktime_get_real_ts(&ts); | ||
| 286 | |||
| 287 | return timespec_to_ns(&ts); | ||
| 288 | } | 281 | } |
| 289 | 282 | ||
| 290 | /* Device operating modes */ | 283 | /* Device operating modes */ |
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index b665dc7f017b..fa2d01ef8f55 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h | |||
| @@ -157,13 +157,14 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 157 | const struct iio_chan_spec *chan, unsigned int error_mask, | 157 | const struct iio_chan_spec *chan, unsigned int error_mask, |
| 158 | int *val); | 158 | int *val); |
| 159 | 159 | ||
| 160 | #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \ | 160 | #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \ |
| 161 | .type = IIO_VOLTAGE, \ | 161 | .type = IIO_VOLTAGE, \ |
| 162 | .indexed = 1, \ | 162 | .indexed = 1, \ |
| 163 | .channel = (chan), \ | 163 | .channel = (chan), \ |
| 164 | .extend_name = name, \ | 164 | .extend_name = name, \ |
| 165 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 165 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 166 | BIT(IIO_CHAN_INFO_SCALE), \ | 166 | BIT(IIO_CHAN_INFO_SCALE), \ |
| 167 | .info_mask_shared_by_all = info_all, \ | ||
| 167 | .address = (addr), \ | 168 | .address = (addr), \ |
| 168 | .scan_index = (si), \ | 169 | .scan_index = (si), \ |
| 169 | .scan_type = { \ | 170 | .scan_type = { \ |
| @@ -174,19 +175,20 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 174 | }, \ | 175 | }, \ |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | #define ADIS_SUPPLY_CHAN(addr, si, bits) \ | 178 | #define ADIS_SUPPLY_CHAN(addr, si, info_all, bits) \ |
| 178 | ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits) | 179 | ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", info_all, bits) |
| 179 | 180 | ||
| 180 | #define ADIS_AUX_ADC_CHAN(addr, si, bits) \ | 181 | #define ADIS_AUX_ADC_CHAN(addr, si, info_all, bits) \ |
| 181 | ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits) | 182 | ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, info_all, bits) |
| 182 | 183 | ||
| 183 | #define ADIS_TEMP_CHAN(addr, si, bits) { \ | 184 | #define ADIS_TEMP_CHAN(addr, si, info_all, bits) { \ |
| 184 | .type = IIO_TEMP, \ | 185 | .type = IIO_TEMP, \ |
| 185 | .indexed = 1, \ | 186 | .indexed = 1, \ |
| 186 | .channel = 0, \ | 187 | .channel = 0, \ |
| 187 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 188 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 188 | BIT(IIO_CHAN_INFO_SCALE) | \ | 189 | BIT(IIO_CHAN_INFO_SCALE) | \ |
| 189 | BIT(IIO_CHAN_INFO_OFFSET), \ | 190 | BIT(IIO_CHAN_INFO_OFFSET), \ |
| 191 | .info_mask_shared_by_all = info_all, \ | ||
| 190 | .address = (addr), \ | 192 | .address = (addr), \ |
| 191 | .scan_index = (si), \ | 193 | .scan_index = (si), \ |
| 192 | .scan_type = { \ | 194 | .scan_type = { \ |
| @@ -197,13 +199,14 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
| 197 | }, \ | 199 | }, \ |
| 198 | } | 200 | } |
| 199 | 201 | ||
| 200 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ | 202 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, info_all, bits) { \ |
| 201 | .type = (_type), \ | 203 | .type = (_type), \ |
| 202 | .modified = 1, \ | 204 | .modified = 1, \ |
| 203 | .channel2 = IIO_MOD_ ## mod, \ | 205 | .channel2 = IIO_MOD_ ## mod, \ |
| 204 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 206 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 205 | info_sep, \ | 207 | info_sep, \ |
| 206 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 208 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 209 | .info_mask_shared_by_all = info_all, \ | ||
| 207 | .address = (addr) | ||
