static int svdm_dp_attention(int port, uint32_t *payload) { int cur_lvl; int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]); int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]); enum gpio_signal hpd = PORT_TO_HPD(port); cur_lvl = gpio_get_level(hpd); dp_status[port] = payload[1]; /* Its initial DP status message prior to config */ if (!(dp_flags[port] & DP_FLAGS_DP_ON)) { if (lvl) dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING; return 1; } if (irq & cur_lvl) { gpio_set_level(hpd, 0); hook_call_deferred(PORT_TO_HPD_IRQ_DEFERRED(port), HPD_DSTREAM_DEBOUNCE_IRQ); } else if (irq & !cur_lvl) { CPRINTF("ERR:HPD:IRQ&LOW\n"); return 0; /* nak */ } else { gpio_set_level(hpd, lvl); } /* ack */ return 1; }
static int svdm_dp_attention(int port, uint32_t *payload) { int cur_lvl; int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]); int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]); cur_lvl = gpio_get_level(GPIO_USBC_DP_HPD); dp_status = payload[1]; /* Its initial DP status message prior to config */ if (!(dp_flags & DP_FLAGS_DP_ON)) { if (lvl) dp_flags |= DP_FLAGS_HPD_HI_PENDING; return 1; } if (irq & cur_lvl) { gpio_set_level(GPIO_USBC_DP_HPD, 0); hook_call_deferred(&hpd_irq_deferred_data, HPD_DSTREAM_DEBOUNCE_IRQ); } else if (irq & !cur_lvl) { CPRINTF("ERR:HPD:IRQ&LOW\n"); return 0; /* nak */ } else { gpio_set_level(GPIO_USBC_DP_HPD, lvl); } /* ack */ return 1; }
static int svdm_dp_attention(int port, uint32_t *payload) { int cur_lvl; int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]); int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]); dp_status[port] = payload[1]; cur_lvl = gpio_get_level(GPIO_USB_DP_HPD); /* Its initial DP status message prior to config */ if (!(dp_flags[port] & DP_FLAGS_DP_ON)) { if (lvl) dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING; return 1; } if (irq & cur_lvl) { board_typec_dp_on(port); } else if (irq & !cur_lvl) { CPRINTF("ERR:HPD:IRQ&LOW\n"); return 0; /* nak */ } else { board_typec_dp_set(port, lvl); } /* ack */ return 1; }
static int svdm_dp_attention(int port, uint32_t *payload) { int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]); int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]); const struct usb_mux *mux = &usb_muxes[port]; dp_status[port] = payload[1]; if (!(dp_flags[port] & DP_FLAGS_DP_ON)) { if (lvl) dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING; return 1; } mux->hpd_update(port, lvl, irq); /* ack */ return 1; }
static int svdm_dp_attention(int port, uint32_t *payload) { const struct usb_mux *mux = &usb_muxes[port]; int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]); int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]); int mf_pref = PD_VDO_DPSTS_MF_PREF(payload[1]); dp_status[port] = payload[1]; mux->hpd_update(port, lvl, irq); if (lvl) usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP, USB_SWITCH_CONNECT, pd_get_polarity(port)); else usb_mux_set(port, mf_pref ? TYPEC_MUX_USB : TYPEC_MUX_NONE, USB_SWITCH_CONNECT, pd_get_polarity(port)); return 1; }