summaryrefslogtreecommitdiff
path: root/board/oak/usb_pd_policy.c
diff options
context:
space:
mode:
authorRong Chang <rongchang@chromium.org>2015-06-08 20:55:47 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-10 15:49:35 +0000
commit2b129cc3b79d9940be9e80b660d2523e399eb732 (patch)
tree70cac0df0d61f270b0d97bc132a44d8b5f64eb46 /board/oak/usb_pd_policy.c
parentffd83ca8e9b3652527aa0966414f528daf068244 (diff)
downloadchrome-ec-2b129cc3b79d9940be9e80b660d2523e399eb732.tar.gz
oak: enable CHARGE_MANAGER to handle charging on both ports
This CL copies CL:275686 that enables charge manager to handle charging on two ports. Since oak has the same PD design, so both CHARGE_L controls need to be enabled to detect VBUS when no charger is plugged in. That means if you set chgoverride -1, this actually enable charging on both ports. BRANCH=none BUG=chrome-os-partner:41167 TEST=manual plug in zinger and donette onto both ports. verify that we charge from the first one plugged in. Change-Id: If5ed360e55f6c6b1a0315a68a5a6d924ae856c6d Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275853 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/oak/usb_pd_policy.c')
-rw-r--r--board/oak/usb_pd_policy.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c
index 73bc31bce3..5f403ba45a 100644
--- a/board/oak/usb_pd_policy.c
+++ b/board/oak/usb_pd_policy.c
@@ -73,31 +73,31 @@ void pd_transition_voltage(int idx)
int pd_set_power_supply_ready(int port)
{
- /*
- * TODO: this only works on port 0 for now. need to include
- * charge manager to manage CHARGE_L
- */
- if (port == 0) {
- /* Disable charging */
- gpio_set_level(GPIO_USB_C0_CHARGE_L, 1);
- /* Provide VBUS */
- gpio_set_level(GPIO_USB_C0_5V_OUT, 1);
- }
+ /* Disable charging */
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
+ GPIO_USB_C0_CHARGE_L, 1);
+ /* Provide VBUS */
+ gpio_set_level(port ? GPIO_USB_C1_5V_OUT :
+ GPIO_USB_C0_5V_OUT, 1);
+
return EC_SUCCESS; /* we are ready */
}
void pd_power_supply_reset(int port)
{
+ /* Disable VBUS */
+ gpio_set_level(port ? GPIO_USB_C1_5V_OUT :
+ GPIO_USB_C0_5V_OUT, 0);
+
/*
- * TODO: this only works on port 0 for now. need to include
- * charge manager to manage CHARGE_L
+ * TODO: Currently we can only detect VBUS when charge_l is
+ * asserted, so, if there is no active charge port, then enable
+ * charge_l. If the other port is the active charger, then leave
+ * this port disabled.
*/
- if (port == 0) {
- /* Disable VBUS */
- gpio_set_level(GPIO_USB_C0_5V_OUT, 0);
- /* Enable charging */
- gpio_set_level(GPIO_USB_C0_CHARGE_L, 0);
- }
+ if (charge_manager_get_active_charge_port() != !port)
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
+ GPIO_USB_C0_CHARGE_L, 0);
}
void pd_set_input_current_limit(int port, uint32_t max_ma,