diff options
Diffstat (limited to 'board/kindred/board.c')
-rw-r--r-- | board/kindred/board.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/board/kindred/board.c b/board/kindred/board.c index 99375e94c7..3358b86583 100644 --- a/board/kindred/board.c +++ b/board/kindred/board.c @@ -173,11 +173,35 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, }; +static int board_anx7447_mux_set_c0(const struct usb_mux *me, + mux_state_t mux_state) +{ + int port = me->usb_port; + int rv = EC_SUCCESS; + + if (port != USB_PD_PORT_TCPC_0) + return rv; + + if (gpio_get_level(GPIO_CCD_MODE_ODL)) + return rv; + + /* + * Expect to set AUX_SWITCH to 0, but 0xc isolates the DP_AUX + * signal from SBU. + */ + CPRINTS("C%d: AUX_SW_SEL=0x%x", port, 0xc); + if (tcpc_write(port, ANX7447_REG_TCPC_AUX_SWITCH, 0xc)) + CPRINTS("C%d: Setting AUX_SW_SEL failed", port); + + return rv; +} + const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .mux = &(const struct usb_mux) { .usb_port = USB_PD_PORT_TCPC_0, .driver = &anx7447_usb_mux_driver, + .board_set = &board_anx7447_mux_set_c0, .hpd_update = &anx7447_tcpc_update_hpd_status, }, }, @@ -528,39 +552,12 @@ static void board_update_sensor_config_from_sku(void) } } -static void anx7447_set_aux_switch(void) -{ - const int port = USB_PD_PORT_TCPC_0; - - /* Debounce */ - if (gpio_get_level(GPIO_CCD_MODE_ODL)) - return; - - /* - * Expect to set AUX_SWITCH to 0, but 0xc isolates the DP_AUX - * signal from SBU. - */ - CPRINTS("C%d: AUX_SW_SEL=0x%x", port, 0xc); - if (tcpc_write(port, ANX7447_REG_TCPC_AUX_SWITCH, 0xc)) - CPRINTS("C%d: Setting AUX_SW_SEL failed", port); -} -DECLARE_DEFERRED(anx7447_set_aux_switch); - -void ccd_mode_isr(enum gpio_signal signal) -{ - /* Wait 2 seconds until all mux setting is done by PD task */ - hook_call_deferred(&anx7447_set_aux_switch_data, 2 * SECOND); -} - static void board_init(void) { /* Initialize Fans */ setup_fans(); /* Enable HDMI HPD interrupt. */ gpio_enable_interrupt(GPIO_HDMI_CONN_HPD); - /* Trigger once to set mux in case CCD cable is already connected. */ - ccd_mode_isr(GPIO_CCD_MODE_ODL); - gpio_enable_interrupt(GPIO_CCD_MODE_ODL); /* Select correct gpio signal for PP5000_A control */ board_gpio_set_pp5000(); /* Use sku_id to set motion sensor count */ |