summaryrefslogtreecommitdiff
path: root/baseboard/octopus/baseboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/octopus/baseboard.c')
-rw-r--r--baseboard/octopus/baseboard.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c
index 6bc0436473..cd14adb6d3 100644
--- a/baseboard/octopus/baseboard.c
+++ b/baseboard/octopus/baseboard.c
@@ -16,6 +16,7 @@
#include "power.h"
#include "system.h"
#include "task.h"
+#include "usb_mux.h"
#include "usbc_ppc.h"
#include "util.h"
@@ -177,7 +178,38 @@ void chipset_do_shutdown(void)
}
/******************************************************************************/
-/* Charger/PD functions */
+/* Power Delivery and charing functions */
+
+void baseboard_tcpc_init(void)
+{
+ int count = 0;
+ int port;
+
+ /* Wait for disconnected battery to wake up */
+ while (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED) {
+ usleep(100 * MSEC);
+ /* Give up waiting after more than 1 second */
+ if (++count > 10) {
+ ccprintf("Battery still disconnected > 1 second!\n");
+ break;
+ }
+ }
+
+ /* Only reset TCPC if not sysjump */
+ if (!system_jumped_to_this_image())
+ board_reset_pd_mcu();
+
+ /*
+ * Initialize HPD to low; after sysjump SOC needs to see
+ * HPD pulse to enable video path
+ */
+ for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
+ const struct usb_mux *mux = &usb_muxes[port];
+
+ mux->hpd_update(port, 0, 0);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
int board_set_active_charge_port(int port)
{