summaryrefslogtreecommitdiff
path: root/baseboard/kukui/usb_pd_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/kukui/usb_pd_policy.c')
-rw-r--r--baseboard/kukui/usb_pd_policy.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/baseboard/kukui/usb_pd_policy.c b/baseboard/kukui/usb_pd_policy.c
index d6b5ddf764..5d5ca68e2d 100644
--- a/baseboard/kukui/usb_pd_policy.c
+++ b/baseboard/kukui/usb_pd_policy.c
@@ -250,10 +250,14 @@ static void svdm_safe_dp_mode(int port)
static int svdm_enter_dp_mode(int port, uint32_t mode_caps)
{
- /* Kukui doesn't support superspeed lanes. */
- const uint32_t support_pin_mode = MODE_DP_PIN_C | MODE_DP_PIN_E;
+ /* Kukui/Krane doesn't support superspeed lanes. */
+ const uint32_t support_pin_mode = IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ?
+ (MODE_DP_PIN_C | MODE_DP_PIN_E) : MODE_DP_PIN_ALL;
- /* Only enter mode if device is DFP_D and PIN_C, PIN_E capable */
+ /**
+ * Only enter mode if device is DFP_D (and PIN_C/E for Kukui/Krane)
+ * capable
+ */
if ((mode_caps & MODE_DP_SNK) &&
(mode_caps & (support_pin_mode << MODE_DP_DFP_PIN_SHIFT))) {
svdm_safe_dp_mode(port);
@@ -284,15 +288,25 @@ static int svdm_dp_status(int port, uint32_t *payload)
static int svdm_dp_config(int port, uint32_t *payload)
{
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
+ int status = dp_status[port];
+ int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
+ int pin_mode;
+
/* Kukui doesn't support multi-function mode, mask it out. */
- int status = dp_status[port] & ~PD_VDO_DPSTS_MF_MASK;
- int pin_mode = pd_dfp_dp_get_pin_mode(port, status);
+ if (IS_ENABLED(CONFIG_USB_MUX_VIRTUAL))
+ status &= ~PD_VDO_DPSTS_MF_MASK;
+
+ pin_mode = pd_dfp_dp_get_pin_mode(port, status);
if (!pin_mode)
return 0;
- usb_mux_set(port, TYPEC_MUX_DP, USB_SWITCH_CONNECT,
- board_get_polarity(port));
+ if (IS_ENABLED(CONFIG_USB_MUX_VIRTUAL))
+ usb_mux_set(port, TYPEC_MUX_DP, USB_SWITCH_CONNECT,
+ board_get_polarity(port));
+ else
+ usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
+ USB_SWITCH_CONNECT, board_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
CMD_DP_CONFIG | VDO_OPOS(opos));