cyan: Set Motion Sensors to Pre-init state in S3

In S3 state, sensors loose their power. Prevent any initiation of
communication with the sensors.

BUG=None
TEST=With Servo connected, verify that no I2C failures are reported
on EC Console when system is brought to S3.
BRANCH=None

Change-Id: I1988c40aa9de48403e9e3a6be5aec3b7267c29e0
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/268481
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Shamile Khan
2015-04-13 19:00:21 -07:00
committed by ChromeOS Commit Bot
parent 4293de83e0
commit ddf83269b4
3 changed files with 47 additions and 4 deletions

View File

@@ -11,6 +11,7 @@
#include "driver/temp_sensor/tmp432.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
@@ -134,3 +135,25 @@ const struct accel_orientation acc_orient = {
},
.hinge_axis = {0, 1, 0},
};
/*
* In S3, power rail for sensors (+V3p3S) goes down asynchronous to EC. We need
* to execute this routine first and set the sensor state to "Not Initialized".
* This prevents the motion_sense_suspend hook routine from communicating with
* the sensor.
*/
static void motion_sensors_pre_init(void)
{
struct motion_sensor_t *sensor;
int i;
for (i = 0; i < motion_sensor_count; ++i) {
sensor = &motion_sensors[i];
sensor->state = SENSOR_NOT_INITIALIZED;
sensor->odr = sensor->default_odr;
sensor->range = sensor->default_range;
}
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sensors_pre_init,
MOTION_SENSE_HOOK_PRIO - 1);

View File

@@ -19,6 +19,7 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \
@@ -27,7 +28,3 @@
TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
/*
* TODO: Re-enable when I2C/S3 issue is resolved.
TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE) \
*/

View File

@@ -12,6 +12,7 @@
#include "driver/temp_sensor/tmp432.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
@@ -148,3 +149,25 @@ const struct accel_orientation acc_orient = {
},
.hinge_axis = {1, 0, 0},
};
/*
* In S3, power rail for sensors (+V3p3S) goes down asynchronous to EC. We need
* to execute this routine first and set the sensor state to "Not Initialized".
* This prevents the motion_sense_suspend hook routine from communicating with
* the sensor.
*/
static void motion_sensors_pre_init(void)
{
struct motion_sensor_t *sensor;
int i;
for (i = 0; i < motion_sensor_count; ++i) {
sensor = &motion_sensors[i];
sensor->state = SENSOR_NOT_INITIALIZED;
sensor->odr = sensor->default_odr;
sensor->range = sensor->default_range;
}
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sensors_pre_init,
MOTION_SENSE_HOOK_PRIO - 1);