diff options
Diffstat (limited to 'board/trogdor')
-rw-r--r-- | board/trogdor/board.c | 13 | ||||
-rw-r--r-- | board/trogdor/usb_pd_policy.c | 7 |
2 files changed, 7 insertions, 13 deletions
diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 717392a1a2..c8d770fc37 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -266,12 +266,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { * to AP. But the TCPC chip is also needed to know the HPD status; otherwise, * the mux misbehaves. */ -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { { + .usb_port = 0, .driver = &ps8xxx_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, { + .usb_port = 1, .driver = &ps8xxx_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, } @@ -328,8 +330,6 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_tcpc_init(void) { - int port; - /* Only reset TCPC if not sysjump */ if (!system_jumped_to_this_image()) { /* TODO(crosbug.com/p/61098): How long do we need to wait? */ @@ -347,11 +347,8 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { - const struct usb_mux *mux = &usb_muxes[port]; - - mux->hpd_update(port, 0, 0); - } + for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) + usb_mux_hpd_update(port, 0, 0); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1); diff --git a/board/trogdor/usb_pd_policy.c b/board/trogdor/usb_pd_policy.c index c88768f63a..6840ae919e 100644 --- a/board/trogdor/usb_pd_policy.c +++ b/board/trogdor/usb_pd_policy.c @@ -152,7 +152,6 @@ __override int svdm_dp_attention(int port, uint32_t *payload) enum gpio_signal hpd = GPIO_DP_HOT_PLUG_DET; 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]; int cur_lvl = gpio_get_level(hpd); dp_status[port] = payload[1]; @@ -217,7 +216,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload) pd_notify_dp_alt_mode_entry(); /* Configure TCPC for the HPD event, for proper muxing */ - mux->hpd_update(port, lvl, irq); + usb_mux_hpd_update(port, lvl, irq); /* Signal AP for the HPD event, through GPIO to AP */ if (irq & cur_lvl) { @@ -249,8 +248,6 @@ __override int svdm_dp_attention(int port, uint32_t *payload) __override void svdm_exit_dp_mode(int port) { - const struct usb_mux *mux = &usb_muxes[port]; - /* Disconnect the DP port selection mux. */ gpio_set_level(GPIO_DP_MUX_OE_L, 1); @@ -258,7 +255,7 @@ __override void svdm_exit_dp_mode(int port) svdm_safe_dp_mode(port); /* Signal AP for the HPD low event */ - mux->hpd_update(port, 0, 0); + usb_mux_hpd_update(port, 0, 0); gpio_set_level(GPIO_DP_HOT_PLUG_DET, 0); } #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ |