diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-12 08:21:41 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-19 12:56:42 -0700 |
commit | 251212fb9dea6d95a8caa43ec9eeb210abfa2df8 (patch) | |
tree | a85685d1f78524a104ee0b5f00c97293e96d30e6 /board/servo_v4 | |
parent | 7c2c5a9dc3779587f78a7c602cefeb667d210d41 (diff) | |
download | chrome-ec-251212fb9dea6d95a8caa43ec9eeb210abfa2df8.tar.gz |
pd: Remove ACCESSORY states
According to the USB-C spec, when a debug accessory is identified, we may
optionally establish USB PD communication over CC. Some DTS partners
(eg. servo_v4) expect us to speak PD, so let's make it so. There is no
need for special ACCESSORY states, these do not exist in the PD spec.
BRANCH=servo
BUG=chromium:737755,b:65837068
TEST=On scarlet, attach servo_v4 and verify scarlet charges. Also verify
EC and cr50 consoles are available through servo_v4.
Change-Id: I59d1ca50b4766509eccf38562cdf926578138585
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693294
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/servo_v4')
-rw-r--r-- | board/servo_v4/board.c | 7 | ||||
-rw-r--r-- | board/servo_v4/board.h | 7 | ||||
-rw-r--r-- | board/servo_v4/usb_pd_policy.c | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index 17a653af41..15057242b7 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -6,7 +6,6 @@ #include "adc.h" #include "adc_chip.h" -#include "case_closed_debug.h" #include "common.h" #include "console.h" #include "ec_version.h" @@ -395,9 +394,9 @@ static void check_for_disconnect(void) ccd_keepalive_enabled = 0; } -void ccd_set_mode(enum ccd_mode new_mode) +void ccd_enable(int enable) { - if (new_mode == CCD_MODE_ENABLED) { + if (enable) { /* * Unfortunately the polarity detect is designed for real plug * events, and only accurately detects pre-connect idle. If @@ -414,7 +413,7 @@ void ccd_set_mode(enum ccd_mode new_mode) /* Allow some time following turning on of VBUS */ hook_call_deferred(&ccd_measure_sbu_data, PD_POWER_SUPPLY_TURN_ON_DELAY); - } else if (new_mode == CCD_MODE_DISABLED) { + } else { /* We are not connected to anything */ /* Disable ccd_measure_sbu deferred call always */ diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h index a7ea1ec6e7..729051c73f 100644 --- a/board/servo_v4/board.h +++ b/board/servo_v4/board.h @@ -90,7 +90,6 @@ #define CONFIG_CHARGE_MANAGER #define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_DTS #define CONFIG_CMD_PD #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DYNAMIC_SRC_CAP @@ -219,5 +218,11 @@ int pd_set_rp_rd(int port, int cc_pull, int rp_value); */ int board_get_version(void); +/** + * Enable or disable CCD + * + * @param enable Enable CCD if true, otherwise disable + */ +void ccd_enable(int enable); #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c index 2e707d85c8..0ba2777779 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -409,6 +409,10 @@ int pd_set_power_supply_ready(int port) vbus[DUT].mv = 5000; vbus[DUT].ma = 500; + /* Enable CCD, if debuggable TS attached */ + if (pd_ts_dts_plugged(DUT)) + ccd_enable(1); + return EC_SUCCESS; /* we are ready */ } @@ -418,6 +422,8 @@ void pd_power_supply_reset(int port) if (port == CHG) return; + ccd_enable(0); + /* Disable VBUS */ gpio_set_level(GPIO_DUT_CHG_EN, 0); /* Set default VBUS source to Host */ |