diff options
-rw-r--r-- | board/servo_v4/board.c | 11 | ||||
-rw-r--r-- | board/servo_v4/usb_pd_policy.c | 14 |
2 files changed, 14 insertions, 11 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index dc1ae7cea9..ec596a8b66 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -383,13 +383,14 @@ static void ccd_measure_sbu(void) hook_call_deferred(&ccd_measure_sbu_data, 100 * MSEC); } - void ccd_enable(int enable) { - /* - * We may use this if displayport is ever enabled. - * For now, CCD is always enabled on SBU. - */ + if (enable) { + hook_call_deferred(&ccd_measure_sbu_data, 0); + } else { + gpio_set_level(GPIO_SBU_MUX_EN, 0); + hook_call_deferred(&ccd_measure_sbu_data, -1); + } } int board_get_version(void) diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c index 3c49eefeda..08c2d5042c 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -655,10 +655,6 @@ int pd_set_power_supply_ready(int port) return EC_ERROR_NOT_POWERED; } - /* Enable CCD, if debuggable TS attached */ - if (pd_ts_dts_plugged(DUT)) - ccd_enable(1); - return EC_SUCCESS; /* we are ready */ } @@ -668,8 +664,6 @@ void pd_power_supply_reset(int port) if (port == CHG) return; - ccd_enable(0); - /* Disable VBUS */ gpio_set_level(GPIO_DUT_CHG_EN, 0); @@ -824,6 +818,14 @@ static void do_cc(int cc_config_new) usleep(PD_T_ERROR_RECOVERY); } + if ((cc_config & ~cc_config_new) & CC_DISABLE_DTS) { + /* DTS-disabled -> DTS-enabled */ + ccd_enable(1); + } else if ((cc_config_new & ~cc_config) & CC_DISABLE_DTS) { + /* DTS-enabled -> DTS-disabled */ + ccd_enable(0); + } + /* Accept new cc_config value */ cc_config = cc_config_new; |