diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index b12126c7d8..61271508e7 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -304,8 +304,6 @@ static void init_ioexpander(void) /* Define voltage thresholds for SBU USB detection */ #define GND_MAX_MV 350 #define USB_HIGH_MV 1500 -/* Tracks current state of ccd */ -static int ccd_mode; static void ccd_measure_sbu(void); DECLARE_DEFERRED(ccd_measure_sbu); @@ -324,16 +322,12 @@ static void ccd_measure_sbu(void) /* SBU flip = 1 */ write_ioexpander(0, 2, 1); msleep(10); - gpio_set_level(GPIO_SBU_MUX_EN, 1); - ccd_mode = CCD_MODE_ENABLED; CPRINTS("CCD: connected flip"); } else if ((sbu2 > USB_HIGH_MV) && (sbu1 < GND_MAX_MV)) { /* SBU flip = 0 */ write_ioexpander(0, 2, 0); msleep(10); - gpio_set_level(GPIO_SBU_MUX_EN, 1); - ccd_mode = CCD_MODE_ENABLED; CPRINTS("CCD: connected noflip"); } else { /* Measure again after 100 msec */ @@ -352,10 +346,12 @@ void ccd_set_mode(enum ccd_mode new_mode) /* Disable ccd_measure_sbu deferred call always */ hook_call_deferred(&ccd_measure_sbu_data, -1); - /* Turn off CCD */ - gpio_set_level(GPIO_SBU_MUX_EN, 0); - CPRINTS("CCD: disconnect"); - ccd_mode = CCD_MODE_DISABLED; + /* + * The DUT port has detected a detach event. Don't want to + * disconnect the SBU mux here so that the H1 USB console can + * remain connected. + */ + CPRINTS("CCD: TypeC detach, no change to SBU mux"); } } @@ -382,7 +378,11 @@ static void board_init(void) init_ioexpander(); init_uservo_port(); - /* Initialize CCD mode and disable sbu mux. */ - ccd_set_mode(CCD_MODE_DISABLED); + /* + * Enable SBU mux. The polarity is set each time a new PD attach event + * occurs. But, the SBU mux is not disabled on detach so that the H1 USB + * console will survie a DUT EC reset. + */ + gpio_set_level(GPIO_SBU_MUX_EN, 1); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);