summaryrefslogtreecommitdiff
path: root/board/plankton/usb_pd_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'board/plankton/usb_pd_config.h')
-rw-r--r--board/plankton/usb_pd_config.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/board/plankton/usb_pd_config.h b/board/plankton/usb_pd_config.h
index c1fefbcf7e..23bdd82d0e 100644
--- a/board/plankton/usb_pd_config.h
+++ b/board/plankton/usb_pd_config.h
@@ -133,12 +133,24 @@ static inline void pd_set_host_mode(int port, int enable)
* Initialize various GPIOs and interfaces to safe state at start of pd_task.
*
* These include:
+ * VBUS, charge path based on power role.
+ * Physical layer CC transmit.
* VCONNs disabled.
*
- * @param port USB-C port number
+ * @param port USB-C port number
+ * @param power_role Power role of device
*/
-static inline void pd_config_init(int port)
+static inline void pd_config_init(int port, uint8_t power_role)
{
+ /*
+ * Set CC pull resistors, and charge_en and vbus_en GPIOs to match
+ * the initial role.
+ */
+ pd_set_host_mode(port, power_role);
+
+ /* Initialize TX pins and put them in Hi-Z */
+ pd_tx_init();
+
gpio_set_level(GPIO_USB_CC1_VCONN_EN_L, 1);
gpio_set_level(GPIO_USB_CC2_VCONN_EN_L, 1);
}