diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2014-10-10 23:35:32 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2014-11-16 15:22:39 -0500 |
commit | 8d5a9781920171a36e5826248cd56b4b6a734335 (patch) | |
tree | 02378b41cc31123e34c7e26a874257be059d8e93 /drivers/iio | |
parent | aaeecd80440bc5e06de7d2b741cd403325d8ca7a (diff) |
iio: accel: bmc150: Send x, y and z motion separately
This chip is capable to identify motion across x, y and z axes. So
send different events.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/bmc150-accel.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index fdb101c48599..c6df8ee00c9d 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B | 45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B |
46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 | 46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 |
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0) | ||
48 | #define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1) | ||
49 | #define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2) | ||
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) | 50 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) |
48 | 51 | ||
49 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 | 52 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 |
@@ -1097,12 +1100,26 @@ static irqreturn_t bmc150_accel_event_handler(int irq, void *private) | |||
1097 | else | 1100 | else |
1098 | dir = IIO_EV_DIR_RISING; | 1101 | dir = IIO_EV_DIR_RISING; |
1099 | 1102 | ||
1100 | if (ret & BMC150_ACCEL_ANY_MOTION_MASK) | 1103 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) |
1101 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | 1104 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, |
1102 | 0, | 1105 | 0, |
1103 | IIO_MOD_X_OR_Y_OR_Z, | 1106 | IIO_MOD_X, |
1104 | IIO_EV_TYPE_ROC, | 1107 | IIO_EV_TYPE_ROC, |
1105 | IIO_EV_DIR_EITHER), | 1108 | dir), |
1109 | data->timestamp); | ||
1110 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) | ||
1111 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1112 | 0, | ||
1113 | IIO_MOD_Y, | ||
1114 | IIO_EV_TYPE_ROC, | ||
1115 | dir), | ||
1116 | data->timestamp); | ||
1117 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) | ||
1118 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1119 | 0, | ||
1120 | IIO_MOD_Z, | ||
1121 | IIO_EV_TYPE_ROC, | ||
1122 | dir), | ||
1106 | data->timestamp); | 1123 | data->timestamp); |
1107 | ack_intr_status: | 1124 | ack_intr_status: |
1108 | if (!data->dready_trigger_on) | 1125 | if (!data->dready_trigger_on) |