diff options
author | Boris Mittelberg <bmbm@google.com> | 2023-01-11 15:30:13 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-18 04:09:47 +0000 |
commit | b07c6e3cf3a62c5469af6ed2d0a3800c1fa384fc (patch) | |
tree | ccfb85f5951e4a3343b1ac34e57b77b2ea2c9ada | |
parent | 76f511d38ff2eb53ac173d7d0988b38b695b4767 (diff) | |
download | chrome-ec-firmware-hatch-12672.B.tar.gz |
kindred: fix set TCPC_AUX_SWITCH to 0xC on Port 0firmware-hatch-12672.B
Updating the mux via a callback instead of interrupt
BUG=b:183123775
BRANCH=main,firmware-hatch-12672.B
TEST=make BOARD=kindred
Signed-off-by: Boris Mittelberg <bmbm@google.com>
Change-Id: Ic90202937bda5b8c8028b9f9affae021095521b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4158694
Tested-by: Shelley Chen <shchen@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
-rw-r--r-- | board/kindred/board.c | 49 | ||||
-rw-r--r-- | board/kindred/gpio.inc | 6 |
2 files changed, 25 insertions, 30 deletions
diff --git a/board/kindred/board.c b/board/kindred/board.c index f5a5779f40..f738bbf771 100644 --- a/board/kindred/board.c +++ b/board/kindred/board.c @@ -174,9 +174,31 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, }; +static int board_anx7447_mux_set_c0(int port, mux_state_t mux_state) +{ + 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; +} + struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { .driver = &anx7447_usb_mux_driver, + .board_set = &board_anx7447_mux_set_c0, .hpd_update = &anx7447_tcpc_update_hpd_status, }, [USB_PD_PORT_TCPC_1] = { @@ -530,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 */ diff --git a/board/kindred/gpio.inc b/board/kindred/gpio.inc index 2adb08f564..85ddf5e9da 100644 --- a/board/kindred/gpio.inc +++ b/board/kindred/gpio.inc @@ -37,15 +37,15 @@ GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(9, 5), GPIO_INT_FALLING, bc12_interrupt) GPIO_INT(USB_C1_BC12_INT_ODL, PIN(E, 4), GPIO_INT_FALLING, bc12_interrupt) -/* CCD mode line*/ -GPIO_INT(CCD_MODE_ODL, PIN(E, 5), GPIO_INT_FALLING, ccd_mode_isr) - GPIO_INT(HDMI_CONN_HPD, PIN(7, 2), GPIO_INT_BOTH, hdmi_hpd_interrupt) /* Volume button interrupts */ GPIO_INT(EC_VOLDN_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(EC_VOLUP_BTN_ODL, PIN(7, 5), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) +/* CCD mode line*/ +GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) + GPIO(SYS_RESET_L, PIN(C, 5), GPIO_ODR_HIGH) /* SYS_RST_ODL */ GPIO(ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW) /* EC_ENTERING_RW */ GPIO(PCH_WAKE_L, PIN(7, 4), GPIO_ODR_HIGH) /* EC_PCH_WAKE_ODL */ |