summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2019-08-27 16:36:08 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-28 07:41:09 +0000
commit19b8749c0915278171acfd83495d5a73bb359385 (patch)
treedd5336eb2869a7bb33787c9380065fcdaeef15fe
parentef2805c454082e676c61c1d663c80f8f1c4d5ff5 (diff)
downloadchrome-ec-19b8749c0915278171acfd83495d5a73bb359385.tar.gz
servo_v4: Disable CCD (monitoring SBU) when DTS-mode disabled by a user
The SBU monitoring logic is used for muxing the correct polarity for CCD. If the DTS-mode is disabled by a user, meaning that CCD is supposed not being used, the SBU monitoring logic can be disabled. For DP alt-mode, the SBU lines are used for AUX channel. This SBU monitoring logic affects the AUX channel, due to the strong pull-up on the USB D+ line. It should be disabled. Remove the original calls of ccd_enable(), which is called when supplying power and detecting DUT Rd/Rd or Rp/Rp. This requires PD comm. We don't want CCD depends on PD comm. BRANCH=servo BUG=b:137219603 TEST=The default role "cc srcdts", CCD works on both phyical polarity. TEST=Called "cc src", checked GPIO SBU_MUX_EN 0. Change-Id: I8f2f7bda88426e6097f0f4efd811114b7a1135c3 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1815557 Reviewed-by: Nick Sanders <nsanders@chromium.org>
-rw-r--r--board/servo_v4/board.c11
-rw-r--r--board/servo_v4/usb_pd_policy.c14
2 files changed, 14 insertions, 11 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index 0d5abc58e2..bf1c51e267 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 07008c0cca..138f53a4a7 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -658,10 +658,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 */
}
@@ -671,8 +667,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);
@@ -827,6 +821,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;