Skip to content

Commit fa13ac6

Browse files
NXP-CarlosSongjic23
authored andcommitted
iio: gyro: fxas21002c: Fix missing data update in trigger handler
The fxas21002c_trigger_handler() may fail to acquire sample data because the runtime PM enters the autosuspend state and sensor can not return sample data in standby mode.. Resume the sensor before reading the sample data into the buffer within the trigger handler. After the data is read, place the sensor back into the autosuspend state. Fixes: a0701b6 ("iio: gyro: add core driver for fxas21002c") Signed-off-by: Carlos Song <[email protected]> Signed-off-by: Frank Li <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent aaa90d0 commit fa13ac6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/iio/gyro/fxas21002c_core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,14 +730,21 @@ static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
730730
int ret;
731731

732732
mutex_lock(&data->lock);
733+
ret = fxas21002c_pm_get(data);
734+
if (ret < 0)
735+
goto out_unlock;
736+
733737
ret = regmap_bulk_read(data->regmap, FXAS21002C_REG_OUT_X_MSB,
734738
data->buffer, CHANNEL_SCAN_MAX * sizeof(s16));
735739
if (ret < 0)
736-
goto out_unlock;
740+
goto out_pm_put;
737741

738742
iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
739743
data->timestamp);
740744

745+
out_pm_put:
746+
fxas21002c_pm_put(data);
747+
741748
out_unlock:
742749
mutex_unlock(&data->lock);
743750

0 commit comments

Comments
 (0)