summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Brandmeyer <jbrandmeyer@chromium.org>2018-06-07 11:04:20 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-28 12:47:06 -0700
commit616e73051406c6aac806a6abd17018149376e2aa (patch)
tree015cc0754c916ea58ced8626c8ce20e4bb7ec4fe
parentb6f2187bb736cdbebc369de54aa749cd1775e719 (diff)
downloadchrome-ec-616e73051406c6aac806a6abd17018149376e2aa.tar.gz
motion_sense: Provide option to defer resume actions.
See also crrev.com/c/433338. Grunt requires a delay on startup to account for the slew rate on the sensor power rails. Similar to the delay option for suspend actions, also provide a delay option for resume actions. BUG=b:79159777, b:35550738 TEST=KX022 init on S5->S3->S0 succeeds on both grunt clamshell and grunt convertible SKUs. BRANCH=none Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: I061c4c148c5c31c09b8d0c1d40aef1ba1e3d344b Reviewed-on: https://chromium-review.googlesource.com/1091211 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--baseboard/grunt/baseboard.h5
-rw-r--r--common/motion_sense.c5
-rw-r--r--include/config.h10
3 files changed, 13 insertions, 7 deletions
diff --git a/baseboard/grunt/baseboard.h b/baseboard/grunt/baseboard.h
index 252d731f7f..e894a81f31 100644
--- a/baseboard/grunt/baseboard.h
+++ b/baseboard/grunt/baseboard.h
@@ -147,6 +147,11 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+/*
+ * Slew rate on the PP1800_SENSOR load switch requires a short delay on startup.
+ */
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (10 * MSEC)
/* Thermal */
#define CONFIG_TEMP_SENSOR_SB_TSI
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 6929bb5710..1fe3aeb064 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -589,7 +589,7 @@ static void motion_sense_suspend(void)
* brief stop in S3.
*/
hook_call_deferred(&motion_sense_switch_sensor_rate_data,
- CONFIG_MOTION_SENSE_SUSPEND_DELAY_US);
+ CONFIG_MOTION_SENSE_SUSPEND_DELAY_US);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sense_suspend,
MOTION_SENSE_HOOK_PRIO);
@@ -597,7 +597,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sense_suspend,
static void motion_sense_resume(void)
{
sensor_active = SENSOR_ACTIVE_S0;
- motion_sense_switch_sensor_rate();
+ hook_call_deferred(&motion_sense_switch_sensor_rate_data,
+ CONFIG_MOTION_SENSE_RESUME_DELAY_US);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, motion_sense_resume,
MOTION_SENSE_HOOK_PRIO);
diff --git a/include/config.h b/include/config.h
index ad23544891..d9fbd06fb1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1582,13 +1582,13 @@
#undef CONFIG_LID_ANGLE_UPDATE
/*
- * During shutdown sequence sensor rails can be powered down asynchronously
- * to the EC hence EC cannot interlock the sensor states with the power down
- * states. To avoid this issue, defer switching the sensors rate with a
- * configurable delay if in S3. By the time deferred function is serviced,
- * if the chipset is in S5 we can back out from switching the sensor rate.
+ * Defer the (re)configuration of motion sensors after the suspend event or
+ * resume event. Sensor power rails may be powered up or down asynchronously
+ * from the EC, so it may be necessary to wait some time period before
+ * reconfiguring after a transition.
*/
#define CONFIG_MOTION_SENSE_SUSPEND_DELAY_US 0
+#define CONFIG_MOTION_SENSE_RESUME_DELAY_US 0
/* Define motion sensor count in board layer */
#undef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT