Commit a1a5cfe7 authored by Cosmin Tanislav's avatar Cosmin Tanislav Committed by Jonathan Cameron

iio: introduce mag_referenced

Some accelerometers that support activity and inactivity
events also support a referenced mode, in which the
gravitational acceleration is taken as a point of
reference before comparing the acceleration to the
specified activity and inactivity magnitude.

For example, in the case of the ADXL367, for activity
detection, the formula is:

abs(acceleration - reference) > magnitude

Add a new event type that makes this behavior clear.
Signed-off-by: default avatarCosmin Tanislav <cosmin.tanislav@analog.com>
Link: https://lore.kernel.org/r/20220214073810.781016-2-cosmin.tanislav@analog.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent b38da7fe
...@@ -230,6 +230,7 @@ static const char * const iio_ev_type_text[] = { ...@@ -230,6 +230,7 @@ static const char * const iio_ev_type_text[] = {
[IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
[IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
[IIO_EV_TYPE_CHANGE] = "change", [IIO_EV_TYPE_CHANGE] = "change",
[IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced",
}; };
static const char * const iio_ev_dir_text[] = { static const char * const iio_ev_dir_text[] = {
......
...@@ -104,6 +104,7 @@ enum iio_event_type { ...@@ -104,6 +104,7 @@ enum iio_event_type {
IIO_EV_TYPE_THRESH_ADAPTIVE, IIO_EV_TYPE_THRESH_ADAPTIVE,
IIO_EV_TYPE_MAG_ADAPTIVE, IIO_EV_TYPE_MAG_ADAPTIVE,
IIO_EV_TYPE_CHANGE, IIO_EV_TYPE_CHANGE,
IIO_EV_TYPE_MAG_REFERENCED,
}; };
enum iio_event_direction { enum iio_event_direction {
......
...@@ -68,6 +68,7 @@ static const char * const iio_ev_type_text[] = { ...@@ -68,6 +68,7 @@ static const char * const iio_ev_type_text[] = {
[IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive",
[IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive",
[IIO_EV_TYPE_CHANGE] = "change", [IIO_EV_TYPE_CHANGE] = "change",
[IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced",
}; };
static const char * const iio_ev_dir_text[] = { static const char * const iio_ev_dir_text[] = {
......
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