ps8xxx: put the PS8751's power role to sink state
BRANCH=octopus
TEST=check the external monitor can work
Commit-Ready: James Chao
Tested-by: James Chao
@@ -207,6 +207,21 @@ struct i2c_stress_test_dev ps8xxx_i2c_stress_test_dev = {
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_TCPC */
+static int ps8xxx_mux_init(int port)
+{
+ tcpci_tcpm_mux_init(port);
+
+ /* If this MUX is also the TCPC, then skip init */
+ if (!(usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC))
+ return EC_SUCCESS;
+
+ /* We always want to be a sink when this device is only being used as a mux
+ * to support external peripherals better.
+ */
+ return mux_write(port, TCPC_REG_ROLE_CTRL,
+ TCPC_REG_ROLE_CTRL_SET(0, 1, TYPEC_CC_RD, TYPEC_CC_RD));
+}
+
static int ps8xxx_mux_enter_low_power_mode(int port)
{
mux_write(port, TCPC_REG_ROLE_CTRL,
@@ -214,8 +229,9 @@ static int ps8xxx_mux_enter_low_power_mode(int port)
return tcpci_tcpm_mux_enter_low_power(port);
}
+/* This is meant for mux-only applications */
const struct usb_mux_driver ps8xxx_usb_mux_driver = {
- .init = &tcpci_tcpm_mux_init,
+ .init = &ps8xxx_mux_init,
.set = &tcpci_tcpm_mux_set,
.get = &tcpci_tcpm_mux_get,
.enter_low_power_mode = &ps8xxx_mux_enter_low_power_mode,
