Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Cosmin Tanislav <cosmin.tanislav@analog.com>
Link: https://lore.kernel.org/r/20220214073810.781016-2-cosmin.tanislav@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Cosmin Tanislav and committed by
Jonathan Cameron
a1a5cfe7 b38da7fe

+3
+1
drivers/iio/industrialio-event.c
··· 230 230 [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", 231 231 [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", 232 232 [IIO_EV_TYPE_CHANGE] = "change", 233 + [IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced", 233 234 }; 234 235 235 236 static const char * const iio_ev_dir_text[] = {
+1
include/uapi/linux/iio/types.h
··· 104 104 IIO_EV_TYPE_THRESH_ADAPTIVE, 105 105 IIO_EV_TYPE_MAG_ADAPTIVE, 106 106 IIO_EV_TYPE_CHANGE, 107 + IIO_EV_TYPE_MAG_REFERENCED, 107 108 }; 108 109 109 110 enum iio_event_direction {
+1
tools/iio/iio_event_monitor.c
··· 68 68 [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", 69 69 [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", 70 70 [IIO_EV_TYPE_CHANGE] = "change", 71 + [IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced", 71 72 }; 72 73 73 74 static const char * const iio_ev_dir_text[] = {