summaryrefslogtreecommitdiff
path: root/board/glados/board.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2015-09-15 13:59:25 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-15 17:56:17 -0700
commitfa6359737129789af7f2a1db6b2e9c05c51038fb (patch)
tree55edee9d81d79f2e1841e9a5c5868c8d94f83710 /board/glados/board.c
parent2bff01f1cad298a11d5f28db61cc1f88629b50c9 (diff)
downloadchrome-ec-fa6359737129789af7f2a1db6b2e9c05c51038fb.tar.gz
GLaDOS: Add 3ms delay to end of chipset_resume.
This commit fixes two issues: - When we transition from S3 to S0, we enable the sensor rail. Very shortly thereafter, we attempt to initialize the motion sensors. They fail on the very first i2c transaction due to the fact that the senors are not ready. Therefore, this commit adds a small 3ms delay to the end of the board_chipset_resume() hook. This allows both the motion sensors to initialize successfully when the motion sense hook is called. - In order for the delay to be effective, it must be called prior to the motion sense hook. Therefore, the priority of board_chipset_resume() is increased. BUG=chrome-os-partner:43494 BRANCH=None TEST=Build and flash GLaDOS EC, reboot several times verifying that both sensors are initialized. TEST=make buildall tests Change-Id: I86ee87955f0750cac1960be147c2b39c7d922f0a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/299769 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/glados/board.c')
-rw-r--r--board/glados/board.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/board/glados/board.c b/board/glados/board.c
index 100d7db209..28362f72a7 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -22,6 +22,7 @@
#include "i2c.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "motion_sense.h"
#include "pi3usb9281.h"
#include "power.h"
#include "power_button.h"
@@ -345,8 +346,21 @@ static void board_chipset_resume(void)
{
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 1);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 1);
+
+ /*
+ * Now that we have enabled the rail to the sensors, let's give enough
+ * time for the sensors to boot up. Without this delay, the very first
+ * i2c transactions always fail because the sensors aren't ready yet.
+ * In testing, a 2ms delay seemed to be reliable, but we'll delay for
+ * 3ms just to be safe.
+ *
+ * Additionally, this hook needs to be run before the motion sense hook
+ * tries to initialize the sensors.
+ */
+ msleep(3);
}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume,
+ MOTION_SENSE_HOOK_PRIO-1);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)