summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYH Huang <yh.huang@mediatek.com>2015-06-17 15:25:13 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-23 20:40:58 +0000
commit0c46bcc3e77c3e7049e1354e0a4802d6bba8c9e2 (patch)
tree6de28d9152a151c4923b43181d9ad75ba4184221
parent99e964c018eec1cba83022361866dd0b14d47610 (diff)
downloadchrome-ec-0c46bcc3e77c3e7049e1354e0a4802d6bba8c9e2.tar.gz
oak: power off ap if reboot ap-off
When ec gets the console command "reboot ap-off", turn off ap. BRANCH=none BUG=none TEST=manual Enter "reboot ap-off" in ec console and then ap is off. Change-Id: Iba2c3743ae37ee9ceaadba58752d2129fb00d3a8 Signed-off-by: YH Huang <yh.huang@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/277976 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
-rw-r--r--power/mediatek.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/power/mediatek.c b/power/mediatek.c
index 3aa1c1c564..c8b08b2faa 100644
--- a/power/mediatek.c
+++ b/power/mediatek.c
@@ -390,6 +390,28 @@ void chipset_force_shutdown(void)
/*****************************************************************************/
/**
+ * Power off the AP
+ */
+static void power_off(void)
+{
+ /* Call hooks before we drop power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
+ /* switch off all rails */
+ chipset_turn_off_power_rails();
+
+ /* Change SUSPEND_L pin to high-Z to reduce power draw. */
+ gpio_set_flags(power_signal_list[MTK_SUSPEND_ASSERTED].gpio,
+ GPIO_INPUT);
+
+ lid_opened = 0;
+ enable_sleep(SLEEP_MASK_AP_RUN);
+#ifdef HAS_TASK_POWERLED
+ powerled_set_state(POWERLED_STATE_OFF);
+#endif
+ CPRINTS("power shutdown complete");
+}
+
+/**
* Check if there has been a power-on event
*
* This checks all power-on event signals and returns non-zero if any have been
@@ -415,6 +437,12 @@ static int check_for_power_on_event(void)
return POWER_ON_BY_IN_POWER_GOOD;
}
} else {
+ if (ap_off_flag) {
+ CPRINTS("RESET_FLAG_AP_OFF is on");
+ power_off();
+ return POWER_ON_CANCEL;
+ }
+
CPRINTS("POWER_GOOD is not asserted");
}
@@ -530,28 +558,6 @@ static int wait_for_power_button_release(unsigned int timeout_us)
return EC_SUCCESS;
}
-/**
- * Power off the AP
- */
-static void power_off(void)
-{
- /* Call hooks before we drop power rails */
- hook_notify(HOOK_CHIPSET_SHUTDOWN);
- /* switch off all rails */
- chipset_turn_off_power_rails();
-
- /* Change SUSPEND_L pin to high-Z to reduce power draw. */
- gpio_set_flags(power_signal_list[MTK_SUSPEND_ASSERTED].gpio,
- GPIO_INPUT);
-
- lid_opened = 0;
- enable_sleep(SLEEP_MASK_AP_RUN);
-#ifdef HAS_TASK_POWERLED
- powerled_set_state(POWERLED_STATE_OFF);
-#endif
- CPRINTS("power shutdown complete");
-}
-
void chipset_reset(int is_cold)
{
if (is_cold) {