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
42 * @resp: motion sensor response structure42 * @resp: motion sensor response structure
43 * @type: type of motion sensor43 * @type: type of motion sensor
44 * @loc: location where the motion sensor is placed44 * @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.
45 * @calib: calibration parameters. Note that trigger49 * @calib: calibration parameters. Note that trigger
46 * captured data will always provide the calibrated50 * captured data will always provide the calibrated
47 * data51 * data
@@ -65,6 +69,9 @@ struct cros_ec_sensors_core_state { · 17 unmodified lines
65 enum motionsensor_type type;69 enum motionsensor_type type;
66 enum motionsensor_location loc;70 enum motionsensor_location loc;
67 71
72 bool range_updated;
73 int curr_range;
74
68 struct calib_data {75 struct calib_data {
69 s16 offset;76 s16 offset;
70 u16 scale;77 u16 scale;
@@ -114,7 +121,9 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, · 43 unmodified lines
114 struct iio_chan_spec const *chan,121 struct iio_chan_spec const *chan,
115 int val, int val2, long mask);122 int val, int val2, long mask);
116 123
117/* List of extended channel specification for all sensors */124extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
125
126/* List of extended channel specification for all sensors. */
118extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];127extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119extern const struct attribute *cros_ec_sensor_fifo_attributes[];128extern const struct attribute *cros_ec_sensor_fifo_attributes[];
120 129