Skip to content

Commit

Permalink
fix transfer error when using hrtimer and suspend
Browse files Browse the repository at this point in the history
  • Loading branch information
antheas committed Oct 6, 2024
1 parent dfecf99 commit 90d96f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions bmi260.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct bmi260_config {
int gyro_odr;
int gyro_uodr;
bool irq;
bool suspended;
};

struct bmi260_data {
Expand Down
5 changes: 5 additions & 0 deletions bmi260_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ static irqreturn_t bmi260_trigger_handler(int irq, void *p)
int i, ret, j = 0, base = BMI260_REG_DATA_AUX_XOUT_L;
__le16 sample;

if (data->conf.suspended)
return IRQ_NONE;

for_each_set_bit(i, indio_dev->active_scan_mask,
indio_dev->masklength) {
ret = regmap_bulk_read(data->regmap, base + i * sizeof(sample),
Expand Down Expand Up @@ -995,11 +998,13 @@ static int bmi260_chip_resume(struct device *dev) {
bmi260_set_odr(data, BMI260_ACCEL, data->conf.accel_odr, data->conf.accel_uodr);
bmi260_set_odr(data, BMI260_GYRO, data->conf.gyro_odr, data->conf.gyro_uodr);
bmi260_enable_irq(data->regmap, data->int_pin, data->conf.irq);
data->conf.suspended = false;
return 0;
}

static int bmi260_chip_suspend(struct device *dev) {
struct bmi260_data *data = iio_priv(dev_get_drvdata(dev));
data->conf.suspended = true;
bmi260_get_scale(data, BMI260_ACCEL, &data->conf.accel_scale);
bmi260_get_scale(data, BMI260_GYRO, &data->conf.gyro_scale);
bmi260_get_odr(data, BMI260_ACCEL, &data->conf.accel_odr, &data->conf.accel_uodr);
Expand Down

0 comments on commit 90d96f0

Please sign in to comment.