static int svdm_dp_config(int port, uint32_t *payload) { board_set_usb_mux(port, TYPEC_MUX_DP, pd_get_polarity(port)); dp_on = 1; payload[0] = VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(pd_alt_mode(port))); payload[1] = VDO_DP_CFG(MODE_DP_PIN_E, /* sink pins */ MODE_DP_PIN_E, /* src pins */ 1, /* DPv1.3 signaling */ 2); /* UFP connected */ return 2; };
static int svdm_dp_status(int port, uint32_t *payload) { payload[0] = VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_STATUS | VDO_OPOS(pd_alt_mode(port))); payload[1] = VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */ 0, /* HPD level ... not applicable */ 0, /* exit DP? ... no */ 0, /* usb mode? ... no */ 0, /* multi-function ... no */ dp_on, 0, /* power low? ... no */ dp_on); return 2; };
static int svdm_dp_config(int port, uint32_t *payload) { int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT); int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]); if (!pin_mode) return 0; payload[0] = VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos)); payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */ 1, /* DPv1.3 signaling */ 2); /* UFP connected */ return 2; };
static int svdm_dp_status(int port, uint32_t *payload) { int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT); payload[0] = VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_STATUS | VDO_OPOS(opos)); payload[1] = VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */ 0, /* HPD level ... not applicable */ 0, /* exit DP? ... no */ 0, /* usb mode? ... no */ 0, /* multi-function ... no */ (!!(dp_flags & DP_FLAGS_DP_ON)), 0, /* power low? ... no */ (!!(dp_flags & DP_FLAGS_DP_ON))); return 2; };
static int svdm_dp_config(int port, uint32_t *payload) { int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT); int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]); int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]); if (!pin_mode) return 0; usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP, USB_SWITCH_CONNECT, pd_get_polarity(port)); payload[0] = VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos)); payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */ 1, /* DPv1.3 signaling */ 2); /* UFP connected */ return 2; };