diff options
Diffstat (limited to 'include/linux/iio')
-rw-r--r-- | include/linux/iio/events.h | 14 | ||||
-rw-r--r-- | include/linux/iio/iio.h | 58 | ||||
-rw-r--r-- | include/linux/iio/types.h | 19 |
3 files changed, 77 insertions, 14 deletions
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h index 13ce220c7003..5dab2c41031f 100644 --- a/include/linux/iio/events.h +++ b/include/linux/iio/events.h | |||
@@ -26,20 +26,6 @@ struct iio_event_data { | |||
26 | 26 | ||
27 | #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) | 27 | #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) |
28 | 28 | ||
29 | enum iio_event_type { | ||
30 | IIO_EV_TYPE_THRESH, | ||
31 | IIO_EV_TYPE_MAG, | ||
32 | IIO_EV_TYPE_ROC, | ||
33 | IIO_EV_TYPE_THRESH_ADAPTIVE, | ||
34 | IIO_EV_TYPE_MAG_ADAPTIVE, | ||
35 | }; | ||
36 | |||
37 | enum iio_event_direction { | ||
38 | IIO_EV_DIR_EITHER, | ||
39 | IIO_EV_DIR_RISING, | ||
40 | IIO_EV_DIR_FALLING, | ||
41 | }; | ||
42 | |||
43 | /** | 29 | /** |
44 | * IIO_EVENT_CODE() - create event identifier | 30 | * IIO_EVENT_CODE() - create event identifier |
45 | * @chan_type: Type of the channel. Should be one of enum iio_chan_type. | 31 | * @chan_type: Type of the channel. Should be one of enum iio_chan_type. |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index ac1cb8f1858c..256a90a1bea6 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
@@ -139,6 +139,29 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * struct iio_event_spec - specification for a channel event | ||
143 | * @type: Type of the event | ||
144 | * @dir: Direction of the event | ||
145 | * @mask_separate: Bit mask of enum iio_event_info values. Attributes | ||
146 | * set in this mask will be registered per channel. | ||
147 | * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes | ||
148 | * set in this mask will be shared by channel type. | ||
149 | * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes | ||
150 | * set in this mask will be shared by channel type and | ||
151 | * direction. | ||
152 | * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes | ||
153 | * set in this mask will be shared by all channels. | ||
154 | */ | ||
155 | struct iio_event_spec { | ||
156 | enum iio_event_type type; | ||
157 | enum iio_event_direction dir; | ||
158 | unsigned long mask_separate; | ||
159 | unsigned long mask_shared_by_type; | ||
160 | unsigned long mask_shared_by_dir; | ||
161 | unsigned long mask_shared_by_all; | ||
162 | }; | ||
163 | |||
164 | /** | ||
142 | * struct iio_chan_spec - specification of a single channel | 165 | * struct iio_chan_spec - specification of a single channel |
143 | * @type: What type of measurement is the channel making. | 166 | * @type: What type of measurement is the channel making. |
144 | * @channel: What number do we wish to assign the channel. | 167 | * @channel: What number do we wish to assign the channel. |
@@ -163,6 +186,9 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
163 | * @info_mask_shared_by_all: What information is to be exported that is shared | 186 | * @info_mask_shared_by_all: What information is to be exported that is shared |
164 | * by all channels. | 187 | * by all channels. |
165 | * @event_mask: What events can this channel produce. | 188 | * @event_mask: What events can this channel produce. |
189 | * @event_spec: Array of events which should be registered for this | ||
190 | * channel. | ||
191 | * @num_event_specs: Size of the event_spec array. | ||
166 | * @ext_info: Array of extended info attributes for this channel. | 192 | * @ext_info: Array of extended info attributes for this channel. |
167 | * The array is NULL terminated, the last element should | 193 | * The array is NULL terminated, the last element should |
168 | * have its name field set to NULL. | 194 | * have its name field set to NULL. |
@@ -201,6 +227,8 @@ struct iio_chan_spec { | |||
201 | long info_mask_shared_by_dir; | 227 | long info_mask_shared_by_dir; |
202 | long info_mask_shared_by_all; | 228 | long info_mask_shared_by_all; |
203 | long event_mask; | 229 | long event_mask; |
230 | const struct iio_event_spec *event_spec; | ||
231 | unsigned int num_event_specs; | ||
204 | const struct iio_chan_spec_ext_info *ext_info; | 232 | const struct iio_chan_spec_ext_info *ext_info; |
205 | const char *extend_name; | 233 | const char *extend_name; |
206 | const char *datasheet_name; | 234 | const char *datasheet_name; |
@@ -283,6 +311,12 @@ struct iio_dev; | |||
283 | * is event dependant. event_code specifies which event. | 311 | * is event dependant. event_code specifies which event. |
284 | * @write_event_value: write the value associated with the event. | 312 | * @write_event_value: write the value associated with the event. |
285 | * Meaning is event dependent. | 313 | * Meaning is event dependent. |
314 | * @read_event_config_new: find out if the event is enabled. New style interface. | ||
315 | * @write_event_config_new: set if the event is enabled. New style interface. | ||
316 | * @read_event_value_new: read a configuration value associated with the event. | ||
317 | * New style interface. | ||
318 | * @write_event_value_new: write a configuration value for the event. New style | ||
319 | * interface. | ||
286 | * @validate_trigger: function to validate the trigger when the | 320 | * @validate_trigger: function to validate the trigger when the |
287 | * current trigger gets changed. | 321 | * current trigger gets changed. |
288 | * @update_scan_mode: function to configure device and scan buffer when | 322 | * @update_scan_mode: function to configure device and scan buffer when |
@@ -323,6 +357,30 @@ struct iio_info { | |||
323 | int (*write_event_value)(struct iio_dev *indio_dev, | 357 | int (*write_event_value)(struct iio_dev *indio_dev, |
324 | u64 event_code, | 358 | u64 event_code, |
325 | int val); | 359 | int val); |
360 | |||
361 | int (*read_event_config_new)(struct iio_dev *indio_dev, | ||
362 | const struct iio_chan_spec *chan, | ||
363 | enum iio_event_type type, | ||
364 | enum iio_event_direction dir); | ||
365 | |||
366 | int (*write_event_config_new)(struct iio_dev *indio_dev, | ||
367 | const struct iio_chan_spec *chan, | ||
368 | enum iio_event_type type, | ||
369 | enum iio_event_direction dir, | ||
370 | int state); | ||
371 | |||
372 | int (*read_event_value_new)(struct iio_dev *indio_dev, | ||
373 | const struct iio_chan_spec *chan, | ||
374 | enum iio_event_type type, | ||
375 | enum iio_event_direction dir, | ||
376 | enum iio_event_info info, int *val, int *val2); | ||
377 | |||
378 | int (*write_event_value_new)(struct iio_dev *indio_dev, | ||
379 | const struct iio_chan_spec *chan, | ||
380 | enum iio_event_type type, | ||
381 | enum iio_event_direction dir, | ||
382 | enum iio_event_info info, int val, int val2); | ||
383 | |||
326 | int (*validate_trigger)(struct iio_dev *indio_dev, | 384 | int (*validate_trigger)(struct iio_dev *indio_dev, |
327 | struct iio_trigger *trig); | 385 | struct iio_trigger *trig); |
328 | int (*update_scan_mode)(struct iio_dev *indio_dev, | 386 | int (*update_scan_mode)(struct iio_dev *indio_dev, |
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 88bf0f0d27b4..18339ef4ff5d 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h | |||
@@ -54,6 +54,25 @@ enum iio_modifier { | |||
54 | IIO_MOD_LIGHT_BLUE, | 54 | IIO_MOD_LIGHT_BLUE, |
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum iio_event_type { | ||
58 | IIO_EV_TYPE_THRESH, | ||
59 | IIO_EV_TYPE_MAG, | ||
60 | IIO_EV_TYPE_ROC, | ||
61 | IIO_EV_TYPE_THRESH_ADAPTIVE, | ||
62 | IIO_EV_TYPE_MAG_ADAPTIVE, | ||
63 | }; | ||
64 | |||
65 | enum iio_event_info { | ||
66 | IIO_EV_INFO_ENABLE, | ||
67 | IIO_EV_INFO_VALUE, | ||
68 | }; | ||
69 | |||
70 | enum iio_event_direction { | ||
71 | IIO_EV_DIR_EITHER, | ||
72 | IIO_EV_DIR_RISING, | ||
73 | IIO_EV_DIR_FALLING, | ||
74 | }; | ||
75 | |||
57 | #define IIO_VAL_INT 1 | 76 | #define IIO_VAL_INT 1 |
58 | #define IIO_VAL_INT_PLUS_MICRO 2 | 77 | #define IIO_VAL_INT_PLUS_MICRO 2 |
59 | #define IIO_VAL_INT_PLUS_NANO 3 | 78 | #define IIO_VAL_INT_PLUS_NANO 3 |