Skip to content

Commit

Permalink
sensors/lsm6dsv16x: fix interrupt handling
Browse files Browse the repository at this point in the history
In case I3C IBI interrupt is not used do not skip reading the status
register, otherwise the interrupt event will not get cleared.

Signed-off-by: Armando Visconti <[email protected]>
  • Loading branch information
avisconti committed Dec 29, 2024
1 parent b577b91 commit 046163d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ static void lsm6dsv16x_handle_interrupt(const struct device *dev)
int ret;

while (1) {
if (IS_ENABLED(CONFIG_LSM6DSV16X_STREAM)) {
/* When using I3C IBI interrupt the status register is already automatically
* read (clearing the interrupt condition), so we can skip the extra bus
* transaction for FIFO stream case.
*/
if (ON_I3C_BUS(cfg) && I3C_INT_PIN(cfg) && IS_ENABLED(CONFIG_LSM6DSV16X_STREAM)) {
break;
}

Expand All @@ -186,7 +190,8 @@ static void lsm6dsv16x_handle_interrupt(const struct device *dev)
return;
}

if ((status.drdy_xl == 0) && (status.drdy_gy == 0)) {
if (((status.drdy_xl == 0) && (status.drdy_gy == 0)) ||
IS_ENABLED(CONFIG_LSM6DSV16X_STREAM)) {
break;
}

Expand Down

0 comments on commit 046163d

Please sign in to comment.