summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgc <chao.ge@bitland.com.cn>2018-02-08 16:22:13 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-11 01:13:33 +0000
commite120dd644521ed5b81c906edf61836339eb69ee1 (patch)
treea9ef163ceac5a3fda6400c59a548c4c54efb3c33
parentf125a9c6f1ef0a027a819a3bb313659e7ecddebf (diff)
downloadchrome-ec-e120dd644521ed5b81c906edf61836339eb69ee1.tar.gz
hana/birch: Function board_spi_enable() be called more than once,SPI will be still disabled.
After function board_spi_enable() called at first time, reset SPI in board_spi_enable(), and function spi_master_initialize() will be locked.If system from S0 state goto S3 state, and then back S0 state, board_spi_enable() will be called once through function board_chipset_resume() and board_spi_disable() not. So if keep the action(S0->S3->S0), SPI will be still disabled.Function board_spi_enable() called through board_chipset_resume() in S3 -> S0. Correspondingly it is better to call function board_spi_disable() through board_chipset_suspend() in S0 -> S3.On the other hand it is appropriate to call board_reset_sensors() through board_init() only in RW stage. BRANCH=oak TEST=1. Log in system with Guest mode. 2. Clode lid. 3. Open lid more than 180 degree. 4. Keyboard is still available. 5. Open VT2 , G-sensor data is constant with "ectool motionsense". Change-Id: Ia121983e772f6b44895393d25e697d5efcbf9fc6 Reviewed-on: https://chromium-review.googlesource.com/907710 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: wang bing <cherish.wang@bitland.com.cn> Tested-by: wang bing <cherish.wang@bitland.com.cn> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
-rw-r--r--board/elm/board.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/board/elm/board.c b/board/elm/board.c
index d4dd9545f0..1b378ef469 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -267,6 +267,8 @@ static void board_extpower_buffer_to_soc(void)
/* Initialize board. */
static void board_init(void)
{
+ uint32_t reset_flags = system_get_reset_flags();
+
/* Enable Level shift of AC_OK & LID_OPEN signals */
board_extpower_buffer_to_soc();
/* Enable rev1 testing GPIOs */
@@ -287,7 +289,9 @@ static void board_init(void)
REG32(STM32_DMA1_BASE + 0xa8) |= (1 << 20) | (1 << 21) |
(1 << 24) | (1 << 25);
- board_reset_sensors();
+ /* Hard reset G-sensors after doing SYSJUMP */
+ if (reset_flags & RESET_FLAG_SYSJUMP)
+ board_reset_sensors();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -475,7 +479,6 @@ static void board_chipset_pre_init(void)
{
/* Enable level shift of AC_OK when power on */
board_extpower_buffer_to_soc();
-
}
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_chipset_pre_init, HOOK_PRIO_DEFAULT);
@@ -484,15 +487,13 @@ static void board_chipset_shutdown(void)
{
/* Disable level shift to SoC when shutting down */
gpio_set_level(GPIO_LEVEL_SHIFT_EN_L, 1);
-
- board_spi_disable();
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
- board_spi_enable();
+ board_spi_enable();
#ifdef CONFIG_TEMP_SENSOR_TMP432
hook_call_deferred(&tmp432_set_power_deferred_data, 0);
#endif
@@ -502,6 +503,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ board_spi_disable();
#ifdef CONFIG_TEMP_SENSOR_TMP432
hook_call_deferred(&tmp432_set_power_deferred_data, 0);
#endif