iio: Add IIO_DELTA_ANGL channel type
authorRamona Bolboaca <ramona.bolboaca@analog.com>
Tue, 8 Aug 2023 07:50:57 +0000 (10:50 +0300)
committerJonathan Cameron <jonathan.cameron@huawei.com>
Tue, 12 Sep 2023 09:42:03 +0000 (10:42 +0100)
The delta angle is defined as a piece-wise integration of angular
velocity data. The delta angle represents the amount of
angular displacement between two consecutive measurements and it
is measured in radians.

In order to track the total angular displacement during a desired
period of time, simply sum-up the delta angle samples acquired
during that time.

IIO currently does not offer a suitable channel type for this
type of measurements hence this patch adds it.

Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230808075059.645525-2-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Documentation/ABI/testing/sysfs-bus-iio
drivers/iio/industrialio-core.c
include/uapi/linux/iio/types.h
tools/iio/iio_event_monitor.c

index a2854dc9a839319984426ff7a0401021156424f7..363dd4b09930420d792f147c43084c01783a7b23 100644 (file)
@@ -279,6 +279,20 @@ Description:
                but should match other such assignments on device).
                Units after application of scale and offset are m/s^2.
 
+What:          /sys/bus/iio/devices/iio:deviceX/in_deltaangl_x_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_deltaangl_y_raw
+What:          /sys/bus/iio/devices/iio:deviceX/in_deltaangl_z_raw
+KernelVersion: 6.5
+Contact:       linux-iio@vger.kernel.org
+Description:
+               Angular displacement between two consecutive samples on x, y or
+               z (may be arbitrarily assigned but should match other such
+               assignments on device).
+               In order to compute the total angular displacement during a
+               desired period of time, the application should sum-up the delta
+               angle samples acquired during that time.
+               Units after application of scale and offset are radians.
+
 What:          /sys/bus/iio/devices/iio:deviceX/in_angl_raw
 What:          /sys/bus/iio/devices/iio:deviceX/in_anglY_raw
 KernelVersion: 4.17
@@ -461,6 +475,7 @@ What:               /sys/bus/iio/devices/iio:deviceX/in_humidityrelative_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_velocity_sqrt(x^2+y^2+z^2)_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_illuminance_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_countY_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_deltaangl_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_angl_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_intensity_x_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_intensity_y_scale
@@ -1332,6 +1347,9 @@ Description:
 What:          /sys/.../iio:deviceX/bufferY/in_accel_x_en
 What:          /sys/.../iio:deviceX/bufferY/in_accel_y_en
 What:          /sys/.../iio:deviceX/bufferY/in_accel_z_en
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_x_en
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_y_en
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_z_en
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_x_en
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_y_en
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_z_en
@@ -1362,6 +1380,7 @@ Description:
                Scan element control for triggered data capture.
 
 What:          /sys/.../iio:deviceX/bufferY/in_accel_type
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_type
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_type
 What:          /sys/.../iio:deviceX/bufferY/in_magn_type
 What:          /sys/.../iio:deviceX/bufferY/in_incli_type
@@ -1416,6 +1435,9 @@ What:             /sys/.../iio:deviceX/bufferY/in_voltage_q_index
 What:          /sys/.../iio:deviceX/bufferY/in_accel_x_index
 What:          /sys/.../iio:deviceX/bufferY/in_accel_y_index
 What:          /sys/.../iio:deviceX/bufferY/in_accel_z_index
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_x_index
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_y_index
+What:          /sys/.../iio:deviceX/bufferY/in_deltaangl_z_index
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_x_index
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_y_index
 What:          /sys/.../iio:deviceX/bufferY/in_anglvel_z_index
index d752e9c0499b964e3e2edee7ef36e10bb7aaa5c9..11a65030186de5f912d44092ca77d5287d256d92 100644 (file)
@@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = {
        [IIO_POSITIONRELATIVE]  = "positionrelative",
        [IIO_PHASE] = "phase",
        [IIO_MASSCONCENTRATION] = "massconcentration",
+       [IIO_DELTA_ANGL] = "deltaangl",
 };
 
 static const char * const iio_modifier_names[] = {
index c79f2f046a0be1c6d71a0bcb9e6378b8bce04b3c..55666a17d311cef3002ab51f216ea01e71e9288c 100644 (file)
@@ -47,6 +47,7 @@ enum iio_chan_type {
        IIO_POSITIONRELATIVE,
        IIO_PHASE,
        IIO_MASSCONCENTRATION,
+       IIO_DELTA_ANGL,
 };
 
 enum iio_modifier {
index 0a5c2bb60030b93b7c67f2afbf87dde2139ac7c3..3505450060e6f07e93f4f736621cce02f4b46a31 100644 (file)
@@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = {
        [IIO_POSITIONRELATIVE] = "positionrelative",
        [IIO_PHASE] = "phase",
        [IIO_MASSCONCENTRATION] = "massconcentration",
+       [IIO_DELTA_ANGL] = "deltaangl",
 };
 
 static const char * const iio_ev_type_text[] = {
@@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event)
        case IIO_POSITIONRELATIVE:
        case IIO_PHASE:
        case IIO_MASSCONCENTRATION:
+       case IIO_DELTA_ANGL:
                break;
        default:
                return false;