mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Samus: Fixed sensor init when sysjump to between RO and RW code
When sysjump between RO and RW code, the motion sensor global data structure get reset to 0. The motion sensor task does not get notification from the power state change event. Added chipset S0 state check logic to re-init sensor active flag to S0. BUG=chrome-os-partner:33370 BRANCH=ToT TEST=sysjump RW; accelread 0 Test Cases: 1 - press power cycle button; checked with powerinfo,accelread 2 - press power cycle button + F3 (refresh) key; checked with powerinfo,accelread 3 - Go to G3, S0, S3; checked with powerinfo, accelread 4 - boot up to S0; sysjump RW; accelread 0|1|2 Change-Id: Ibfe4ba581c8b771be15adb7440374d09fdf03953 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226698 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Sheng-liang Song <ssl@chromium.org> Tested-by: Sheng-liang Song <ssl@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
e6a2d4c044
commit
327bfe2e58
@@ -245,9 +245,18 @@ void motion_sense_task(void)
|
||||
|
||||
set_present(lpc_status);
|
||||
|
||||
/* Initialize sampling interval. */
|
||||
accel_interval_ms = chipset_in_state(CHIPSET_STATE_ON) ?
|
||||
accel_interval_ap_on_ms : SUSPEND_SAMPLING_INTERVAL;
|
||||
if (chipset_in_state(CHIPSET_STATE_ON)) {
|
||||
/* Update the sensor current active state to S0. */
|
||||
for (i = 0; i < motion_sensor_count; ++i) {
|
||||
sensor = &motion_sensors[i];
|
||||
sensor->active = SENSOR_ACTIVE_S0;
|
||||
}
|
||||
|
||||
accel_interval_ms = accel_interval_ap_on_ms;
|
||||
} else {
|
||||
/* sensor->active already initializes to SENSOR_ACTIVE_S5 */
|
||||
accel_interval_ms = SUSPEND_SAMPLING_INTERVAL;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ts0 = get_time();
|
||||
@@ -681,6 +690,7 @@ static int command_accel_read_xyz(int argc, char **argv)
|
||||
sensor = &motion_sensors[id];
|
||||
|
||||
while ((n == -1) || (n-- > 0)) {
|
||||
x = y = z = 0;
|
||||
sensor->drv->read(sensor, &x, &y, &z);
|
||||
ccprintf("Current raw data %d: %-5d %-5d %-5d\n", id, x, y, z);
|
||||
ccprintf("Last calib. data %d: %-5d %-5d %-5d\n", id,
|
||||
|
||||
Reference in New Issue
Block a user