diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iio/buffer.h | 31 | ||||
| -rw-r--r-- | include/linux/iio/common/st_sensors.h | 1 | ||||
| -rw-r--r-- | include/linux/iio/consumer.h | 2 | ||||
| -rw-r--r-- | include/linux/iio/iio.h | 35 | ||||
| -rw-r--r-- | include/linux/iio/sysfs.h | 15 | ||||
| -rw-r--r-- | include/linux/mfd/ti_am335x_tscadc.h | 9 |
6 files changed, 78 insertions, 15 deletions
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index 2bac0eb8948d..a1124bdc4cac 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h | |||
| @@ -36,7 +36,7 @@ struct iio_buffer; | |||
| 36 | * any of them not existing. | 36 | * any of them not existing. |
| 37 | **/ | 37 | **/ |
| 38 | struct iio_buffer_access_funcs { | 38 | struct iio_buffer_access_funcs { |
| 39 | int (*store_to)(struct iio_buffer *buffer, u8 *data); | 39 | int (*store_to)(struct iio_buffer *buffer, const void *data); |
| 40 | int (*read_first_n)(struct iio_buffer *buffer, | 40 | int (*read_first_n)(struct iio_buffer *buffer, |
| 41 | size_t n, | 41 | size_t n, |
| 42 | char __user *buf); | 42 | char __user *buf); |
| @@ -81,7 +81,7 @@ struct iio_buffer { | |||
| 81 | bool stufftoread; | 81 | bool stufftoread; |
| 82 | const struct attribute_group *attrs; | 82 | const struct attribute_group *attrs; |
| 83 | struct list_head demux_list; | 83 | struct list_head demux_list; |
| 84 | unsigned char *demux_bounce; | 84 | void *demux_bounce; |
| 85 | struct list_head buffer_list; | 85 | struct list_head buffer_list; |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| @@ -120,7 +120,32 @@ int iio_scan_mask_set(struct iio_dev *indio_dev, | |||
| 120 | * @indio_dev: iio_dev structure for device. | 120 | * @indio_dev: iio_dev structure for device. |
| 121 | * @data: Full scan. | 121 | * @data: Full scan. |
| 122 | */ | 122 | */ |
| 123 | int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data); | 123 | int iio_push_to_buffers(struct iio_dev *indio_dev, const void *data); |
| 124 | |||
| 125 | /* | ||
| 126 | * iio_push_to_buffers_with_timestamp() - push data and timestamp to buffers | ||
| 127 | * @indio_dev: iio_dev structure for device. | ||
| 128 | * @data: sample data | ||
| 129 | * @timestamp: timestamp for the sample data | ||
| 130 | * | ||
| 131 | * Pushes data to the IIO device's buffers. If timestamps are enabled for the | ||
| 132 | * device the function will store the supplied timestamp as the last element in | ||
| 133 | * the sample data buffer before pushing it to the device buffers. The sample | ||
| 134 | * data buffer needs to be large enough to hold the additional timestamp | ||
| 135 | * (usually the buffer should be indio->scan_bytes bytes large). | ||
| 136 | * | ||
| 137 | * Returns 0 on success, a negative error code otherwise. | ||
| 138 | */ | ||
| 139 | static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev, | ||
| 140 | void *data, int64_t timestamp) | ||
| 141 | { | ||
| 142 | if (indio_dev->scan_timestamp) { | ||
| 143 | size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1; | ||
| 144 | ((int64_t *)data)[ts_offset] = timestamp; | ||
| 145 | } | ||
| 146 | |||
| 147 | return iio_push_to_buffers(indio_dev, data); | ||
| 148 | } | ||
| 124 | 149 | ||
| 125 | int iio_update_demux(struct iio_dev *indio_dev); | 150 | int iio_update_demux(struct iio_dev *indio_dev); |
| 126 | 151 | ||
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index e51f65480ea5..e732fda6c8e6 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
| @@ -184,6 +184,7 @@ struct st_sensors { | |||
| 184 | u8 wai; | 184 | u8 wai; |
| 185 | char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; | 185 | char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; |
| 186 | struct iio_chan_spec *ch; | 186 | struct iio_chan_spec *ch; |
| 187 | int num_ch; | ||
| 187 | struct st_sensor_odr odr; | 188 | struct st_sensor_odr odr; |
| 188 | struct st_sensor_power pw; | 189 | struct st_sensor_power pw; |
| 189 | struct st_sensor_axis enable_axis; | 190 | struct st_sensor_axis enable_axis; |
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 833926c91aa8..2752b1fd12be 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h | |||
| @@ -77,7 +77,7 @@ struct iio_cb_buffer; | |||
| 77 | * fail. | 77 | * fail. |
| 78 | */ | 78 | */ |
| 79 | struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, | 79 | struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, |
| 80 | int (*cb)(u8 *data, | 80 | int (*cb)(const void *data, |
| 81 | void *private), | 81 | void *private), |
| 82 | void *private); | 82 | void *private); |
| 83 | /** | 83 | /** |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 2103cc32a5fb..ac1cb8f1858c 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
| @@ -36,6 +36,14 @@ enum iio_chan_info_enum { | |||
| 36 | IIO_CHAN_INFO_PHASE, | 36 | IIO_CHAN_INFO_PHASE, |
| 37 | IIO_CHAN_INFO_HARDWAREGAIN, | 37 | IIO_CHAN_INFO_HARDWAREGAIN, |
| 38 | IIO_CHAN_INFO_HYSTERESIS, | 38 | IIO_CHAN_INFO_HYSTERESIS, |
| 39 | IIO_CHAN_INFO_INT_TIME, | ||
| 40 | }; | ||
| 41 | |||
| 42 | enum iio_shared_by { | ||
| 43 | IIO_SEPARATE, | ||
| 44 | IIO_SHARED_BY_TYPE, | ||
| 45 | IIO_SHARED_BY_DIR, | ||
| 46 | IIO_SHARED_BY_ALL | ||
| 39 | }; | 47 | }; |
| 40 | 48 | ||
| 41 | enum iio_endian { | 49 | enum iio_endian { |
| @@ -57,7 +65,7 @@ struct iio_dev; | |||
| 57 | */ | 65 | */ |
| 58 | struct iio_chan_spec_ext_info { | 66 | struct iio_chan_spec_ext_info { |
| 59 | const char *name; | 67 | const char *name; |
| 60 | bool shared; | 68 | enum iio_shared_by shared; |
| 61 | ssize_t (*read)(struct iio_dev *, uintptr_t private, | 69 | ssize_t (*read)(struct iio_dev *, uintptr_t private, |
| 62 | struct iio_chan_spec const *, char *buf); | 70 | struct iio_chan_spec const *, char *buf); |
| 63 | ssize_t (*write)(struct iio_dev *, uintptr_t private, | 71 | ssize_t (*write)(struct iio_dev *, uintptr_t private, |
| @@ -125,7 +133,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
| 125 | #define IIO_ENUM_AVAILABLE(_name, _e) \ | 133 | #define IIO_ENUM_AVAILABLE(_name, _e) \ |
| 126 | { \ | 134 | { \ |
| 127 | .name = (_name "_available"), \ | 135 | .name = (_name "_available"), \ |
| 128 | .shared = true, \ | 136 | .shared = IIO_SHARED_BY_TYPE, \ |
| 129 | .read = iio_enum_available_read, \ | 137 | .read = iio_enum_available_read, \ |
| 130 | .private = (uintptr_t)(_e), \ | 138 | .private = (uintptr_t)(_e), \ |
| 131 | } | 139 | } |
| @@ -146,12 +154,14 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
| 146 | * shift: Shift right by this before masking out | 154 | * shift: Shift right by this before masking out |
| 147 | * realbits. | 155 | * realbits. |
| 148 | * endianness: little or big endian | 156 | * endianness: little or big endian |
| 149 | * @info_mask: What information is to be exported about this channel. | ||
| 150 | * This includes calibbias, scale etc. | ||
| 151 | * @info_mask_separate: What information is to be exported that is specific to | 157 | * @info_mask_separate: What information is to be exported that is specific to |
| 152 | * this channel. | 158 | * this channel. |
| 153 | * @info_mask_shared_by_type: What information is to be exported that is shared | 159 | * @info_mask_shared_by_type: What information is to be exported that is shared |
| 154 | * by all channels of the same type. | 160 | * by all channels of the same type. |
| 161 | * @info_mask_shared_by_dir: What information is to be exported that is shared | ||
| 162 | * by all channels of the same direction. | ||
| 163 | * @info_mask_shared_by_all: What information is to be exported that is shared | ||
| 164 | * by all channels. | ||
| 155 | * @event_mask: What events can this channel produce. | 165 | * @event_mask: What events can this channel produce. |
| 156 | * @ext_info: Array of extended info attributes for this channel. | 166 | * @ext_info: Array of extended info attributes for this channel. |
| 157 | * The array is NULL terminated, the last element should | 167 | * The array is NULL terminated, the last element should |
| @@ -186,9 +196,10 @@ struct iio_chan_spec { | |||
| 186 | u8 shift; | 196 | u8 shift; |
| 187 | enum iio_endian endianness; | 197 | enum iio_endian endianness; |
| 188 | } scan_type; | 198 | } scan_type; |
| 189 | long info_mask; | ||
| 190 | long info_mask_separate; | 199 | long info_mask_separate; |
| 191 | long info_mask_shared_by_type; | 200 | long info_mask_shared_by_type; |
| 201 | long info_mask_shared_by_dir; | ||
| 202 | long info_mask_shared_by_all; | ||
| 192 | long event_mask; | 203 | long event_mask; |
| 193 | const struct iio_chan_spec_ext_info *ext_info; | 204 | const struct iio_chan_spec_ext_info *ext_info; |
| 194 | const char *extend_name; | 205 | const char *extend_name; |
| @@ -212,7 +223,9 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, | |||
| 212 | enum iio_chan_info_enum type) | 223 | enum iio_chan_info_enum type) |
| 213 | { | 224 | { |
| 214 | return (chan->info_mask_separate & BIT(type)) | | 225 | return (chan->info_mask_separate & BIT(type)) | |
| 215 | (chan->info_mask_shared_by_type & BIT(type)); | 226 | (chan->info_mask_shared_by_type & BIT(type)) | |
| 227 | (chan->info_mask_shared_by_dir & BIT(type)) | | ||
| 228 | (chan->info_mask_shared_by_all & BIT(type)); | ||
| 216 | } | 229 | } |
| 217 | 230 | ||
| 218 | #define IIO_ST(si, rb, sb, sh) \ | 231 | #define IIO_ST(si, rb, sb, sh) \ |
| @@ -457,7 +470,7 @@ static inline void iio_device_put(struct iio_dev *indio_dev) | |||
| 457 | { | 470 | { |
| 458 | if (indio_dev) | 471 | if (indio_dev) |
| 459 | put_device(&indio_dev->dev); | 472 | put_device(&indio_dev->dev); |
| 460 | }; | 473 | } |
| 461 | 474 | ||
| 462 | /** | 475 | /** |
| 463 | * dev_to_iio_dev() - Get IIO device struct from a device struct | 476 | * dev_to_iio_dev() - Get IIO device struct from a device struct |
| @@ -593,7 +606,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) | |||
| 593 | { | 606 | { |
| 594 | return indio_dev->currentmode | 607 | return indio_dev->currentmode |
| 595 | & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); | 608 | & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); |
| 596 | }; | 609 | } |
| 597 | 610 | ||
| 598 | /** | 611 | /** |
| 599 | * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry | 612 | * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry |
| @@ -603,12 +616,12 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) | |||
| 603 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) | 616 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) |
| 604 | { | 617 | { |
| 605 | return indio_dev->debugfs_dentry; | 618 | return indio_dev->debugfs_dentry; |
| 606 | }; | 619 | } |
| 607 | #else | 620 | #else |
| 608 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) | 621 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) |
| 609 | { | 622 | { |
| 610 | return NULL; | 623 | return NULL; |
| 611 | }; | 624 | } |
| 612 | #endif | 625 | #endif |
| 613 | 626 | ||
| 614 | int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, | 627 | int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, |
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h index 2958c960003a..8a1d18640ab9 100644 --- a/include/linux/iio/sysfs.h +++ b/include/linux/iio/sysfs.h | |||
| @@ -100,6 +100,21 @@ struct iio_const_attr { | |||
| 100 | #define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ | 100 | #define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ |
| 101 | IIO_CONST_ATTR(sampling_frequency_available, _string) | 101 | IIO_CONST_ATTR(sampling_frequency_available, _string) |
| 102 | 102 | ||
| 103 | /** | ||
| 104 | * IIO_DEV_ATTR_INT_TIME_AVAIL - list available integration times | ||
| 105 | * @_show: output method for the attribute | ||
| 106 | **/ | ||
| 107 | #define IIO_DEV_ATTR_INT_TIME_AVAIL(_show) \ | ||
| 108 | IIO_DEVICE_ATTR(integration_time_available, S_IRUGO, _show, NULL, 0) | ||
| 109 | /** | ||
| 110 | * IIO_CONST_ATTR_INT_TIME_AVAIL - list available integration times | ||
| 111 | * @_string: frequency string for the attribute | ||
| 112 | * | ||
| 113 | * Constant version | ||
| 114 | **/ | ||
| 115 | #define IIO_CONST_ATTR_INT_TIME_AVAIL(_string) \ | ||
| 116 | IIO_CONST_ATTR(integration_time_available, _string) | ||
| 117 | |||
| 103 | #define IIO_DEV_ATTR_TEMP_RAW(_show) \ | 118 | #define IIO_DEV_ATTR_TEMP_RAW(_show) \ |
| 104 | IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) | 119 | IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) |
| 105 | 120 | ||
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index 25f2c611ab01..08cce7f96ab9 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h | |||
| @@ -46,16 +46,24 @@ | |||
| 46 | /* Step Enable */ | 46 | /* Step Enable */ |
| 47 | #define STEPENB_MASK (0x1FFFF << 0) | 47 | #define STEPENB_MASK (0x1FFFF << 0) |
| 48 | #define STEPENB(val) ((val) << 0) | 48 | #define STEPENB(val) ((val) << 0) |
| 49 | #define ENB(val) (1 << (val)) | ||
| 50 | #define STPENB_STEPENB STEPENB(0x1FFFF) | ||
| 51 | #define STPENB_STEPENB_TC STEPENB(0x1FFF) | ||
| 49 | 52 | ||
| 50 | /* IRQ enable */ | 53 | /* IRQ enable */ |
| 51 | #define IRQENB_HW_PEN BIT(0) | 54 | #define IRQENB_HW_PEN BIT(0) |
| 52 | #define IRQENB_FIFO0THRES BIT(2) | 55 | #define IRQENB_FIFO0THRES BIT(2) |
| 56 | #define IRQENB_FIFO0OVRRUN BIT(3) | ||
| 57 | #define IRQENB_FIFO0UNDRFLW BIT(4) | ||
| 53 | #define IRQENB_FIFO1THRES BIT(5) | 58 | #define IRQENB_FIFO1THRES BIT(5) |
| 59 | #define IRQENB_FIFO1OVRRUN BIT(6) | ||
| 60 | #define IRQENB_FIFO1UNDRFLW BIT(7) | ||
| 54 | #define IRQENB_PENUP BIT(9) | 61 | #define IRQENB_PENUP BIT(9) |
| 55 | 62 | ||
| 56 | /* Step Configuration */ | 63 | /* Step Configuration */ |
| 57 | #define STEPCONFIG_MODE_MASK (3 << 0) | 64 | #define STEPCONFIG_MODE_MASK (3 << 0) |
| 58 | #define STEPCONFIG_MODE(val) ((val) << 0) | 65 | #define STEPCONFIG_MODE(val) ((val) << 0) |
| 66 | #define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1) | ||
| 59 | #define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2) | 67 | #define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2) |
| 60 | #define STEPCONFIG_AVG_MASK (7 << 2) | 68 | #define STEPCONFIG_AVG_MASK (7 << 2) |
| 61 | #define STEPCONFIG_AVG(val) ((val) << 2) | 69 | #define STEPCONFIG_AVG(val) ((val) << 2) |
| @@ -123,6 +131,7 @@ | |||
| 123 | #define ADC_CLK 3000000 | 131 | #define ADC_CLK 3000000 |
| 124 | #define TOTAL_STEPS 16 | 132 | #define TOTAL_STEPS 16 |
| 125 | #define TOTAL_CHANNELS 8 | 133 | #define TOTAL_CHANNELS 8 |
| 134 | #define FIFO1_THRESHOLD 19 | ||
| 126 | 135 | ||
| 127 | /* | 136 | /* |
| 128 | * ADC runs at 3MHz, and it takes | 137 | * ADC runs at 3MHz, and it takes |
