Skip to content

Commit dfb5cc9

Browse files
jwrdegoedegregkh
authored andcommitted
iio: accel: bmc150: Always restore device to normal mode after suspend-resume
commit e59e18989c68a8d7941005f81ad6abc4ca682de0 upstream. After probe we would put the device in normal mode, after a runtime suspend-resume we would put it back in normal mode. But for a regular suspend-resume we would only put it back in normal mode if triggers or events have been requested. This is not consistent and breaks reading raw values after a suspend-resume. This commit changes the regular resume path to also unconditionally put the device back in normal mode, fixing reading of raw values not working after a regular suspend-resume cycle. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c5f6f4f commit dfb5cc9

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

drivers/iio/accel/bmc150-accel-core.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ struct bmc150_accel_data {
194194
struct device *dev;
195195
int irq;
196196
struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
197-
atomic_t active_intr;
198197
struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
199198
struct mutex mutex;
200199
u8 fifo_mode, watermark;
@@ -489,11 +488,6 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i,
489488
goto out_fix_power_state;
490489
}
491490

492-
if (state)
493-
atomic_inc(&data->active_intr);
494-
else
495-
atomic_dec(&data->active_intr);
496-
497491
return 0;
498492

499493
out_fix_power_state:
@@ -1704,8 +1698,7 @@ static int bmc150_accel_resume(struct device *dev)
17041698
struct bmc150_accel_data *data = iio_priv(indio_dev);
17051699

17061700
mutex_lock(&data->mutex);
1707-
if (atomic_read(&data->active_intr))
1708-
bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0);
1701+
bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_NORMAL, 0);
17091702
bmc150_accel_fifo_set_mode(data);
17101703
mutex_unlock(&data->mutex);
17111704

0 commit comments

Comments
 (0)