Skip to content

Commit cb80f6a

Browse files
spandruvadajic23
authored andcommitted
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>
1 parent 5af6b30 commit cb80f6a

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

‎drivers/iio/gyro/bmg160.c‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585

8686
#define BMG160_REG_INT_STATUS_2 0x0B
8787
#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)
8891

8992
#define BMG160_REG_TEMP 0x08
9093
#define BMG160_TEMP_CENTER_VAL 23
@@ -929,10 +932,24 @@ static irqreturn_t bmg160_event_handler(int irq, void *private)
929932
else
930933
dir = IIO_EV_DIR_FALLING;
931934

932-
if (ret & BMG160_ANY_MOTION_MASK)
935+
if (ret & BMG160_ANY_MOTION_BIT_X)
933936
iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
934937
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,
936953
IIO_EV_TYPE_ROC,
937954
dir),
938955
data->timestamp);

0 commit comments

Comments
 (0)