diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-10-07 18:11:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-12 15:32:19 +0400 |
commit | b4e3ac0a204ff1775c69924510f49922a56910a7 (patch) | |
tree | d71492a1357e418a3cc22fc59d185b3329a5790e /include/linux/iio/events.h | |
parent | 3661f3f5e961f73d40d93495c0de6711dabe6f8d (diff) | |
download | linux-b4e3ac0a204ff1775c69924510f49922a56910a7.tar.xz |
iio: Extend the event config interface
The event configuration interface of the IIO framework has not been getting the
same attention as other parts. As a result it has not seen the same improvements
as e.g. the channel interface has seen with the introduction of the channel spec
struct. Currently all the event config callbacks take a u64 (the so called event
code) to pass all the different information about for which event the callback
is invoked. The callback function then has to extract the information it is
interested in using some macros with rather long names. Most information encoded
in the event code comes straight from the iio_chan_spec struct the event was
registered for. Since we always have a handle to the channel spec when we call
the event callbacks the first step is to add the channel spec as a parameter to
the event callbacks. The two remaining things encoded in the event code are the
type and direction of the event. Instead of passing them in one parameter, add
one parameter for each of them and remove the eventcode from the event
callbacks. The patch also adds a new iio_event_info parameter to the
{read,write}_event_value callbacks. This makes it possible, similar to the
iio_chan_info_enum for channels, to specify additional properties other than
just the value for an event. Furthermore the new interface will allow to
register shared events. This is e.g. useful if a device allows configuring a
threshold event, but the threshold setting is the same for all channels.
To implement this the patch adds a new iio_event_spec struct which is similar to
the iio_chan_spec struct. It as two field to specify the type and the direction
of the event. Furthermore it has a mask field for each one of the different
iio_shared_by types. These mask fields holds which kind of attributes should be
registered for the event. Creation of the attributes follows the same rules as
the for the channel attributes. E.g. for the separate_mask there will be a
attribute for each channel with this event, for the shared_by_type there will
only be one attribute per channel type. The iio_chan_spec struct gets two new
fields, 'event_spec' and 'num_event_specs', which is used to specify which the
events for this channel. These two fields are going to replace the channel's
event_mask field.
For now both the old and the new event config interface coexist, but over the
few patches all drivers will be converted from the old to the new interface.
Once that is done all code for supporting the old interface will be removed.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio/events.h')
-rw-r--r-- | include/linux/iio/events.h | 14 |
1 files changed, 0 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 { #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) -enum iio_event_type { - IIO_EV_TYPE_THRESH, - IIO_EV_TYPE_MAG, - IIO_EV_TYPE_ROC, - IIO_EV_TYPE_THRESH_ADAPTIVE, - IIO_EV_TYPE_MAG_ADAPTIVE, -}; - -enum iio_event_direction { - IIO_EV_DIR_EITHER, - IIO_EV_DIR_RISING, - IIO_EV_DIR_FALLING, -}; - /** * IIO_EVENT_CODE() - create event identifier * @chan_type: Type of the channel. Should be one of enum iio_chan_type. |