summaryrefslogtreecommitdiff
path: root/common/vboot
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-01-25 12:47:33 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-03 02:38:10 -0800
commit044cc724967fbb424dd4f686a67abce5a67cfdec (patch)
tree4d57676879db285b665f121d77851d43c0c70a74 /common/vboot
parentcd5173dfe0e80ad2ca622e64aeb9d14b82ef494f (diff)
downloadchrome-ec-044cc724967fbb424dd4f686a67abce5a67cfdec.tar.gz
Enable PD communication in RO for external display
This patch makes EC enable PD communication if it's running in manual recovery mode. This is required to show recovery screen on a type-c monitor. This patch also makes EC-EFS ignore power availability. It will make EC verify & jump to RW even if power is sourced by a barrel jack adapter. This should allow depthcharge to show screens (e.g. broken, warning) on a type-c monitor. BUG=b:72387533 BRANCH=none TEST=On Fizz with type-c monitor, verify - Recovery screen is displayed in manual recovery mode. - Critical update screen is displayed in normal mode. - Warning screen is displayed in developer mode. Monitors tested: Dingdong, Dell S2718D Change-Id: Ib53e02d1e5c0f5b2d96d9a02fd33022f92e52b04 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/898346 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/vboot')
-rw-r--r--common/vboot/vboot.c54
1 files changed, 15 insertions, 39 deletions
diff --git a/common/vboot/vboot.c b/common/vboot/vboot.c
index 47cf1aa10a..b1961ad6f7 100644
--- a/common/vboot/vboot.c
+++ b/common/vboot/vboot.c
@@ -182,33 +182,16 @@ static int is_manual_recovery(void)
return host_is_event_set(EC_HOST_EVENT_KEYBOARD_RECOVERY);
}
-static void vboot_main(void);
-DECLARE_DEFERRED(vboot_main);
-static void vboot_main(void)
-{
- const int check_charge_manager_frequency_usec = 10 * MSEC;
- int port = charge_manager_get_active_charge_port();
-
- if (port == CHARGE_PORT_NONE) {
- /* We loop here until charge manager is ready */
- hook_call_deferred(&vboot_main_data,
- check_charge_manager_frequency_usec);
- return;
- }
+static int pd_comm_enabled;
- CPRINTS("Checking power");
+int vboot_need_pd_comm(void)
+{
+ return pd_comm_enabled;
+}
- if (system_can_boot_ap()) {
- /*
- * We are here for the two cases:
- * 1. Booting on RO with a barrel jack adapter. We can continue
- * to boot AP with EC-RO. We'll jump later in softsync.
- * 2. Booting on RW with a type-c charger. PD negotiation is
- * done and we can boot AP.
- */
- CPRINTS("Got enough power");
- return;
- }
+void vboot_main(void)
+{
+ CPRINTS("Main");
if (system_is_in_rw() || !system_is_locked()) {
/*
@@ -217,23 +200,18 @@ static void vboot_main(void)
* or unlocked RO.
*
* This could be caused by a weak type-c charger. If that's
- * the case, users need to plug a better charger. We could
- * also be here because PD negotiation is still taking place.
- * If so, we'll briefly show request power sign but it will
- * be immediately corrected.
+ * the case, users need to plug a better charger.
*
- * We can also get here because we called system_can_boot_ap too
- * early. Power will be requested but it should be cancelled by
- * board_set_charge_limit as soon as a PD contract is made.
+ * We could also be here because PD negotiation is still taking
+ * place. If so, we'll end up showing request power signal but
+ * it will be immediately corrected.
*/
request_power();
return;
}
- CPRINTS("Booting RO on weak battery/charger");
-
if (is_manual_recovery()) {
- CPRINTS("Manual recovery requested");
+ CPRINTS("Manual recovery");
if (battery_is_present() || has_matrix_keyboard()) {
request_power();
return;
@@ -243,8 +221,8 @@ static void vboot_main(void)
* hole by allowing EC-RO to do PD negotiation but attackers
* don't gain meaningful advantage on devices without a matrix
* keyboard */
- CPRINTS("Enable C%d PD comm", port);
- pd_comm_enable(port, 1);
+ CPRINTS("Enable PD comm");
+ pd_comm_enabled = 1;
return;
}
@@ -264,5 +242,3 @@ static void vboot_main(void)
/* Failed to jump. Need recovery. */
request_recovery();
}
-
-DECLARE_HOOK(HOOK_INIT, vboot_main, HOOK_PRIO_DEFAULT);