diff options
author | 2020-05-26 21:35:17 -0700 | |
---|---|---|
committer | 2020-06-14 11:49:41 +0100 | |
commit | e7e3b9d23f3bc6774cce585ef4fcb02462e04065 (patch) | |
tree | 4c3279b9dcd7fa1c8009f2f8df4ad748db14d625 /drivers/iio/light | |
parent | iio: accel: mxc4005: add support for mxc6655 (diff) | |
download | linux-e7e3b9d23f3bc6774cce585ef4fcb02462e04065.tar.gz linux-e7e3b9d23f3bc6774cce585ef4fcb02462e04065.tar.bz2 linux-e7e3b9d23f3bc6774cce585ef4fcb02462e04065.zip |
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/light')
-rw-r--r-- | drivers/iio/light/cros_ec_light_prox.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c index 2198b50909ed..fed79ba27fda 100644 --- a/drivers/iio/light/cros_ec_light_prox.c +++ b/drivers/iio/light/cros_ec_light_prox.c @@ -145,8 +145,11 @@ static int cros_ec_light_prox_write(struct iio_dev *indio_dev, break; case IIO_CHAN_INFO_CALIBSCALE: st->core.param.cmd = MOTIONSENSE_CMD_SENSOR_RANGE; - st->core.param.sensor_range.data = (val << 16) | (val2 / 100); + st->core.curr_range = (val << 16) | (val2 / 100); + st->core.param.sensor_range.data = st->core.curr_range; ret = cros_ec_motion_send_host_cmd(&st->core, 0); + if (ret == 0) + st->core.range_updated = true; break; default: ret = cros_ec_sensors_core_write(&st->core, chan, val, val2, @@ -256,6 +259,7 @@ MODULE_DEVICE_TABLE(platform, cros_ec_light_prox_ids); static struct platform_driver cros_ec_light_prox_platform_driver = { .driver = { .name = "cros-ec-light-prox", + .pm = &cros_ec_sensors_pm_ops, }, .probe = cros_ec_light_prox_probe, .id_table = cros_ec_light_prox_ids, |