From bfb16961c7fcdcca1823f776ab75d54079ebaa20 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Wed, 5 Mar 2014 09:52:06 -0800 Subject: Samus: Enable manual control of TOUCHSCREEN_RESET_L The charger task was holding this either on or off in S3, no matter what we wanted. We really only need to set it at S3->S0 or S3->S5, or when the lid opens or closes. The rest of the time we should be able to turn it off and on with gpioset, for testing purposes. BUG=chrome-os-partner:26502 BRANCH=ToT TEST=manual Check the state with gpioget TOUCHSCREEN_RESET_L Open and close the lid, suspend the AP with powerd_dbus_suspend, etc. The touchscreen should be on when the lid is open and the AP is in either S3 or S0, off when the lid is closed or the AP is off. Then gpioset TOUCHSCREEN_RESET_L 1 gpioget TOUCHSCREEN_RESET_L gpioset TOUCHSCREEN_RESET_L 0 gpioget TOUCHSCREEN_RESET_L The change should persist as long as nothing else changes. Change-Id: If7b6f809b1b28ae2699d0fbc6c9b2305fc57cbff Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/188869 Reviewed-by: Randall Spangler --- board/samus/power_sequence.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c index e9bdbbb576..a8bba2748d 100644 --- a/board/samus/power_sequence.c +++ b/board/samus/power_sequence.c @@ -146,6 +146,18 @@ enum power_state power_chipset_init(void) return POWER_G3; } +static void update_touchscreen(void) +{ + /* + * If the lid is closed; put the touchscreen in reset to save power. + * If the lid is open, take it out of reset so it can wake the + * processor (although just opening the lid should do that anyway, so + * we don't have to worry about it staying on while the AP is off). + */ + gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, lid_is_open()); +} +DECLARE_HOOK(HOOK_LID_CHANGE, update_touchscreen, HOOK_PRIO_DEFAULT); + enum power_state power_handle_state(enum power_state state) { switch (state) { @@ -159,13 +171,6 @@ enum power_state power_handle_state(enum power_state state) break; case POWER_S3: - /* - * If lid is closed; hold touchscreen in reset to cut - * power usage. If lid is open, take touchscreen out - * of reset so it can wake the processor. - */ - gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, lid_is_open()); - /* Check for state transitions */ if (!power_has_signals(IN_PGOOD_S3)) { /* Required rail went away */ @@ -280,11 +285,7 @@ enum power_state power_handle_state(enum power_state state) /* Enable wireless. */ wireless_set_state(WIRELESS_ON); - /* - * Make sure touchscreen is out if reset (even if the - * lid is still closed); it may have been turned off if - * the lid was closed in S3. - */ + /* Make sure the touchscreen is on, too. */ gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 1); /* Wait for non-core power rails good */ -- cgit v1.2.1