summaryrefslogtreecommitdiff
path: root/board/servo_v4/usb_pd_policy.c
diff options
context:
space:
mode:
authorScott <scollyer@chromium.org>2017-01-13 17:48:31 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-01 14:29:23 -0800
commita185dee8ca10c39a667518f3b87854e92d95ec01 (patch)
treebd714118b36bee2d2d0812f7a2b17dd2268ce85e /board/servo_v4/usb_pd_policy.c
parent11704ae6e9c35889ed1ec97bdaa9d42652397867 (diff)
downloadchrome-ec-a185dee8ca10c39a667518f3b87854e92d95ec01.tar.gz
servo_v4: Support to enable Type C DTS mode
- Defined the config option CONFIG_USB_PD_DTS to board.h. - Added ccd_set_mode function in board.c - Removed ccd attach/detach functions from board.c as that function is - now integrated in the the usb_pd state machine. - Removed the fixed polarity that was being used in usb_pd_config.h so that the DUT port could connect as a SNK device. - Defined PD_ROLE_DEFAULT to override the value in usb_Pd.h so that CHG is SNK and DUT is SRC This set of changes allows servo_v4 to act like a suzyq. Hoever, PD messaging is still not supported. The CHG port can still connect as a SNK device, but VBUS on the DUT is only being provided by the host and not the CHG port. BUG=chrome-os-partner:61878 BRANCH=None TEST=Manual Connected zinger to CHG port and verifed via servo_v4 console that it reached SNK_READY. Connected DUT port to Reef and verified that it reached SRC_ACCESSORY state and that the correct SBU polarity was selected and that lsusb shows H1 as a USB device. Bus 003 Device 042: ID 18d1:5014 Google Inc. Change-Id: I4a0ab2468f383a3ba4db3a3236bb18df6a2c405a Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/428309 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/servo_v4/usb_pd_policy.c')
-rw-r--r--board/servo_v4/usb_pd_policy.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index e26562794b..48cce3519b 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -59,21 +59,32 @@ void pd_transition_voltage(int idx)
int pd_set_power_supply_ready(int port)
{
+ /* Port 0 can never provide vbus. */
+ if (!port)
+ return EC_ERROR_INVAL;
+
+ /*
+ * TODO(crosbug.com/p/60794): For now always assume VBUS is supplied by
+ * host. No support yet for using CHG VBUS passthru mode.
+ */
+
/*
- * TODO(crosbug.com/p/60794): Will likely need to set the GPIOs
- * DUT_CHG_EN and HOST_OR_CHG_CTL which control whether DUT port
- * provides VBUS from Host or CHG port.
+ * Select Host as source for VBUS.
+ * To select host, set GPIO_HOST_OR_CHG_CTL low. To select CHG as VBUS
+ * source, then set GPIO_HOST_OR_CHG_CTL high.
*/
+ gpio_set_level(GPIO_HOST_OR_CHG_CTL, 0);
+
+ /* Enable VBUS from the source selected above. */
+ gpio_set_level(GPIO_DUT_CHG_EN, 1);
+
return EC_SUCCESS; /* we are ready */
}
void pd_power_supply_reset(int port)
{
- /*
- * TODO(crosbug.com/p/60794): Will need to set the GPIOs
- * DUT_CHG_EN and HOST_OR_CHG_CTL which control whether DUT port
- * provides VBUS from Host or CHG port.
- */
+ /* Disable VBUS */
+ gpio_set_level(GPIO_DUT_CHG_EN, 0);
}
void pd_set_input_current_limit(int port, uint32_t max_ma,