]> git.baikalelectronics.ru Git - kernel.git/commit
iio: mma8452: add freefall detection for Freescale's accelerometers
authorMartin Kepplinger <martink@posteo.de>
Sat, 16 Jan 2016 14:35:20 +0000 (15:35 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 23 Jan 2016 16:27:35 +0000 (16:27 +0000)
commit3593221e2dd0510bba0071cc7ad858d10b8e2038
treeccb8019a0388d09b5930a4f95025b7859a1570fe
parent47ca660e1ccc35dae960552c0f621d0685ff636c
iio: mma8452: add freefall detection for Freescale's accelerometers

This adds freefall event detection to the supported devices. It adds
the in_accel_x&y&z_mag_falling_en iio event attribute, which activates
freefall mode.

In freefall mode, the current acceleration magnitude (AND combination
of all axis values) is compared to the specified threshold.
If it falls under the threshold (in_accel_mag_falling_value),
the appropriate IIO event code is generated.

This is what the sysfs "events" directory for these devices looks
like after this change:

-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_falling_period
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_falling_value
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_rising_period
-rw-r--r--    4096 Oct 23 08:45 in_accel_mag_rising_value
-r--r--r--    4096 Oct 23 08:45 in_accel_scale
-rw-r--r--    4096 Oct 23 08:45 in_accel_x&y&z_mag_falling_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_x_mag_rising_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_y_mag_rising_en
-rw-r--r--    4096 Oct 23 08:45 in_accel_z_mag_rising_en

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/mma8452.c