diff options
| author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2014-10-10 23:33:27 -0400 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2014-11-16 15:19:22 -0500 |
| commit | cb80f6a36be9b3007f23c2d37eddc90a37dac87f (patch) | |
| tree | e5bf29141aabb30b3428333cea0f490283efa1ba | |
| parent | 5af6b30788d4f745e62e5cb53850f80222571d3a (diff) | |
iio: gyro: bmg160: 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>
| -rw-r--r-- | drivers/iio/gyro/bmg160.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index fa2e3766d4a7..9f751d6fac6f 100644 --- a/drivers/iio/gyro/bmg160.c +++ b/drivers/iio/gyro/bmg160.c | |||
| @@ -85,6 +85,9 @@ | |||
| 85 | 85 | ||
| 86 | #define BMG160_REG_INT_STATUS_2 0x0B | 86 | #define BMG160_REG_INT_STATUS_2 0x0B |
| 87 | #define BMG160_ANY_MOTION_MASK 0x07 | 87 | #define BMG160_ANY_MOTION_MASK 0x07 |
| 88 | #define BMG160_ANY_MOTION_BIT_X BIT(0) | ||
| 89 | #define BMG160_ANY_MOTION_BIT_Y BIT(1) | ||
| 90 | #define BMG160_ANY_MOTION_BIT_Z BIT(2) | ||
| 88 | 91 | ||
| 89 | #define BMG160_REG_TEMP 0x08 | 92 | #define BMG160_REG_TEMP 0x08 |
| 90 | #define BMG160_TEMP_CENTER_VAL 23 | 93 | #define BMG160_TEMP_CENTER_VAL 23 |
| @@ -929,10 +932,24 @@ static irqreturn_t bmg160_event_handler(int irq, void *private) | |||
| 929 | else | 932 | else |
| 930 | dir = IIO_EV_DIR_FALLING; | 933 | dir = IIO_EV_DIR_FALLING; |
| 931 | 934 | ||
| 932 | if (ret & BMG160_ANY_MOTION_MASK) | 935 | if (ret & BMG160_ANY_MOTION_BIT_X) |
| 933 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | 936 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, |
| 934 | 0, | 937 | 0, |
| 935 | IIO_MOD_X_OR_Y_OR_Z, | 938 | IIO_MOD_X, |
| 939 | IIO_EV_TYPE_ROC, | ||
| 940 | dir), | ||
| 941 | data->timestamp); | ||
| 942 | if (ret & BMG160_ANY_MOTION_BIT_Y) | ||
| 943 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
| 944 | 0, | ||
| 945 | IIO_MOD_Y, | ||
| 946 | IIO_EV_TYPE_ROC, | ||
| 947 | dir), | ||
| 948 | data->timestamp); | ||
| 949 | if (ret & BMG160_ANY_MOTION_BIT_Z) | ||
| 950 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
| 951 | 0, | ||
| 952 | IIO_MOD_Z, | ||
| 936 | IIO_EV_TYPE_ROC, | 953 | IIO_EV_TYPE_ROC, |
| 937 | dir), | 954 | dir), |
| 938 | data->timestamp); | 955 | data->timestamp); |
