Commit 744f4990 authored by Ramona Bolboaca's avatar Ramona Bolboaca Committed by Jonathan Cameron

iio: Add IIO_DELTA_ANGL channel type

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: default avatarRamona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230808075059.645525-2-ramona.bolboaca@analog.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 8c337436
...@@ -279,6 +279,20 @@ Description: ...@@ -279,6 +279,20 @@ Description:
but should match other such assignments on device). but should match other such assignments on device).
Units after application of scale and offset are m/s^2. 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_angl_raw
What: /sys/bus/iio/devices/iio:deviceX/in_anglY_raw What: /sys/bus/iio/devices/iio:deviceX/in_anglY_raw
KernelVersion: 4.17 KernelVersion: 4.17
...@@ -461,6 +475,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_humidityrelative_scale ...@@ -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_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_illuminance_scale
What: /sys/bus/iio/devices/iio:deviceX/in_countY_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_angl_scale
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_x_scale What: /sys/bus/iio/devices/iio:deviceX/in_intensity_x_scale
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_y_scale What: /sys/bus/iio/devices/iio:deviceX/in_intensity_y_scale
...@@ -1332,6 +1347,9 @@ Description: ...@@ -1332,6 +1347,9 @@ Description:
What: /sys/.../iio:deviceX/bufferY/in_accel_x_en 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_y_en
What: /sys/.../iio:deviceX/bufferY/in_accel_z_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_x_en
What: /sys/.../iio:deviceX/bufferY/in_anglvel_y_en What: /sys/.../iio:deviceX/bufferY/in_anglvel_y_en
What: /sys/.../iio:deviceX/bufferY/in_anglvel_z_en What: /sys/.../iio:deviceX/bufferY/in_anglvel_z_en
...@@ -1362,6 +1380,7 @@ Description: ...@@ -1362,6 +1380,7 @@ Description:
Scan element control for triggered data capture. Scan element control for triggered data capture.
What: /sys/.../iio:deviceX/bufferY/in_accel_type 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_anglvel_type
What: /sys/.../iio:deviceX/bufferY/in_magn_type What: /sys/.../iio:deviceX/bufferY/in_magn_type
What: /sys/.../iio:deviceX/bufferY/in_incli_type What: /sys/.../iio:deviceX/bufferY/in_incli_type
...@@ -1416,6 +1435,9 @@ What: /sys/.../iio:deviceX/bufferY/in_voltage_q_index ...@@ -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_x_index
What: /sys/.../iio:deviceX/bufferY/in_accel_y_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_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_x_index
What: /sys/.../iio:deviceX/bufferY/in_anglvel_y_index What: /sys/.../iio:deviceX/bufferY/in_anglvel_y_index
What: /sys/.../iio:deviceX/bufferY/in_anglvel_z_index What: /sys/.../iio:deviceX/bufferY/in_anglvel_z_index
......
...@@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = { ...@@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_POSITIONRELATIVE] = "positionrelative", [IIO_POSITIONRELATIVE] = "positionrelative",
[IIO_PHASE] = "phase", [IIO_PHASE] = "phase",
[IIO_MASSCONCENTRATION] = "massconcentration", [IIO_MASSCONCENTRATION] = "massconcentration",
[IIO_DELTA_ANGL] = "deltaangl",
}; };
static const char * const iio_modifier_names[] = { static const char * const iio_modifier_names[] = {
......
...@@ -47,6 +47,7 @@ enum iio_chan_type { ...@@ -47,6 +47,7 @@ enum iio_chan_type {
IIO_POSITIONRELATIVE, IIO_POSITIONRELATIVE,
IIO_PHASE, IIO_PHASE,
IIO_MASSCONCENTRATION, IIO_MASSCONCENTRATION,
IIO_DELTA_ANGL,
}; };
enum iio_modifier { enum iio_modifier {
......
...@@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = { ...@@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_POSITIONRELATIVE] = "positionrelative", [IIO_POSITIONRELATIVE] = "positionrelative",
[IIO_PHASE] = "phase", [IIO_PHASE] = "phase",
[IIO_MASSCONCENTRATION] = "massconcentration", [IIO_MASSCONCENTRATION] = "massconcentration",
[IIO_DELTA_ANGL] = "deltaangl",
}; };
static const char * const iio_ev_type_text[] = { static const char * const iio_ev_type_text[] = {
...@@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event) ...@@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_POSITIONRELATIVE: case IIO_POSITIONRELATIVE:
case IIO_PHASE: case IIO_PHASE:
case IIO_MASSCONCENTRATION: case IIO_MASSCONCENTRATION:
case IIO_DELTA_ANGL:
break; break;
default: default:
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment