iio: core: Introduce CHANGE event type
authorIrina Tirdea <irina.tirdea@intel.com>
Sun, 11 Jan 2015 19:10:11 +0000 (21:10 +0200)
committerJonathan Cameron <jic23@kernel.org>
Tue, 27 Jan 2015 18:49:55 +0000 (18:49 +0000)
A step detector will generate an interrupt each time N step are detected.
A device that has such pedometer functionality is Freescale's MMA9553L:
http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf.

Introduce IIO_EV_TYPE_CHANGE event type for events that are generated
when the channel passes a threshold on the absolute change in value.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/ABI/testing/sysfs-bus-iio
drivers/iio/industrialio-event.c
drivers/staging/iio/Documentation/iio_event_monitor.c
include/linux/iio/types.h

index 71dc8db4388b359810dcae6be2353e04c144240c..c03a1401b9ca131d0509306e829efbd7790b293d 100644 (file)
@@ -891,12 +891,24 @@ Description:
                number or direction is not specified, applies to all channels of
                this type.
 
-What:          /sys/.../events/in_steps_instance_en
-KernelVersion: 3.19
+What:          /sys/.../events/in_steps_change_en
+KernelVersion: 3.20
 Contact:       linux-iio@vger.kernel.org
 Description:
-               Enables or disables step detection. Each time the user takes a step an
-               event of this type will be generated.
+               Event generated when channel passes a threshold on the absolute
+               change in value. E.g. for steps: a step change event is
+               generated each time the user takes N steps, where N is set using
+               in_steps_change_value.
+
+What:          /sys/.../events/in_steps_change_value
+KernelVersion: 3.20
+Contact:       linux-iio@vger.kernel.org
+Description:
+               Specifies the value of change threshold that the
+               device is comparing against for the events enabled by
+               <type>[Y][_name]_roc[_rising|falling|]_en. E.g. for steps:
+               if set to 3, a step change event will be generated every 3
+               steps.
 
 What:          /sys/bus/iio/devices/iio:deviceX/trigger/current_trigger
 KernelVersion: 2.6.35
index 78cf115dc0d4595cae5d114316df67802e980b2f..b33ce55eb695082fcb82102ef8611e8b59e5f23d 100644 (file)
@@ -198,6 +198,7 @@ static const char * const iio_ev_type_text[] = {
        [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
        [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
        [IIO_EV_TYPE_INSTANCE] = "instance",
+       [IIO_EV_TYPE_CHANGE] = "change",
 };
 
 static const char * const iio_ev_dir_text[] = {
index def236abcb3e1242183050c2316948257442977d..2e78d58b9b779eb1f5c26a74d82e831bc6cfd98d 100644 (file)
@@ -60,6 +60,7 @@ static const char * const iio_ev_type_text[] = {
        [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
        [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
        [IIO_EV_TYPE_INSTANCE] = "instance",
+       [IIO_EV_TYPE_CHANGE] = "change",
 };
 
 static const char * const iio_ev_dir_text[] = {
@@ -179,6 +180,7 @@ static bool event_is_known(struct iio_event_data *event)
        case IIO_EV_TYPE_THRESH_ADAPTIVE:
        case IIO_EV_TYPE_MAG_ADAPTIVE:
        case IIO_EV_TYPE_INSTANCE:
+       case IIO_EV_TYPE_CHANGE:
                break;
        default:
                return false;
index c3601c2c0a9d6f26a87d8bf29699b2093a0f0210..3ba3d66784126f94c46db000f002eac0cf251b60 100644 (file)
@@ -79,6 +79,7 @@ enum iio_event_type {
        IIO_EV_TYPE_THRESH_ADAPTIVE,
        IIO_EV_TYPE_MAG_ADAPTIVE,
        IIO_EV_TYPE_INSTANCE,
+       IIO_EV_TYPE_CHANGE,
 };
 
 enum iio_event_info {