History

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.

Gwendal Grignou committed 6 years ago

Commit e7e3b9d1 parent 79846e35 files · +47 −4Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/iio/common/cros_ec_sensors_core.h+10−1
@@ -42,6 +42,10 @@ typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p); · 41 unmodified lines
4242 * @resp: motion sensor response structure
4343 * @type: type of motion sensor
4444 * @loc: location where the motion sensor is placed
45+ * @range_updated: True if the range of the sensor has been
46+ * updated.
47+ * @curr_range: If updated, the current range value.
48+ * It will be reapplied at every resume.
4549 * @calib: calibration parameters. Note that trigger
4650 * captured data will always provide the calibrated
4751 * data
@@ -65,6 +69,9 @@ struct cros_ec_sensors_core_state { · 17 unmodified lines
6569 enum motionsensor_type type;
6670 enum motionsensor_location loc;
6771
72+ bool range_updated;
73+ int curr_range;
74+
6875 struct calib_data {
6976 s16 offset;
7077 u16 scale;
@@ -114,7 +121,9 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, · 43 unmodified lines
114121 struct iio_chan_spec const *chan,
115122 int val, int val2, long mask);
116123
117−/* List of extended channel specification for all sensors */
124+extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
125+
126+/* List of extended channel specification for all sensors. */
118127 extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119128 extern const struct attribute *cros_ec_sensor_fifo_attributes[];
120129