diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2020-05-27 07:35:17 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-06-14 13:49:41 +0300 |
commit | e7e3b9d23f3bc6774cce585ef4fcb02462e04065 (patch) | |
tree | 4c3279b9dcd7fa1c8009f2f8df4ad748db14d625 /drivers/iio/pressure/cros_ec_baro.c | |
parent | 79846e33aac15f1a1451bcf424b7a1cc22440a88 (diff) | |
download | linux-e7e3b9d23f3bc6774cce585ef4fcb02462e04065.tar.xz |
iio: cros_ec: Reapply range at resume
EC does not currently preserve range across sensor reinit.
If sensor is powered down at suspend, it will default to the EC default
range at resume, not the range set by the host.
Save range if modified, and apply at resume.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/pressure/cros_ec_baro.c')
-rw-r--r-- | drivers/iio/pressure/cros_ec_baro.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c index c079b8960082..f0938b6fbba0 100644 --- a/drivers/iio/pressure/cros_ec_baro.c +++ b/drivers/iio/pressure/cros_ec_baro.c @@ -96,8 +96,11 @@ static int cros_ec_baro_write(struct iio_dev *indio_dev, /* Always roundup, so caller gets at least what it asks for. */ st->core.param.sensor_range.roundup = 1; - if (cros_ec_motion_send_host_cmd(&st->core, 0)) - ret = -EIO; + ret = cros_ec_motion_send_host_cmd(&st->core, 0); + if (ret == 0) { + st->core.range_updated = true; + st->core.curr_range = val; + } break; default: ret = cros_ec_sensors_core_write(&st->core, chan, val, val2, @@ -199,6 +202,7 @@ MODULE_DEVICE_TABLE(platform, cros_ec_baro_ids); static struct platform_driver cros_ec_baro_platform_driver = { .driver = { .name = "cros-ec-baro", + .pm = &cros_ec_sensors_pm_ops, }, .probe = cros_ec_baro_probe, .id_table = cros_ec_baro_ids, |