summaryrefslogtreecommitdiff
path: root/board/glados/usb_pd_policy.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-05 14:40:02 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-07 19:09:06 +0000
commitdab5edc1b4f7658fd6141ec3b8e5826ad52cd84b (patch)
treeaa3e75c80d8888f8c4699256a5fb6d5d3445e95b /board/glados/usb_pd_policy.c
parentea07b1851b0fef035a253ab2ab4e788228a06a19 (diff)
downloadchrome-ec-dab5edc1b4f7658fd6141ec3b8e5826ad52cd84b.tar.gz
glados: enable CHARGE_MANAGER to handle charging on both ports
Enable CONFIG_CHARGE_MANAGER to handle charging on two ports. For now, we only use the type-C pull-up supplier and the PD supplier. This adds Pericom BC1.2 suppliers as well even though we aren't using them. Currently, on Glados, we can't detect VBUS unless charge_en GPIO is asserted. This means, when no charger is plugged in, we must have both ports enabled. And when one charger is plugged in, we must disable the other port. Practically, this means we always charge from first charger plugged in since we can't detect the second one. And, this means that if you do chgoverride -1, which normally stops charging, this will actually enable charging on both ports. BUG=chrome-os-partner:40920 BRANCH=none TEST=load onto glados and plug in zinger and donette onto both ports. verify that we always charge from first charger plugged in. plug in hoho to either port and make sure it gets VBUS. Change-Id: Ia5d5725ee86b25f6fec0f276d4c471f533c81112 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275686 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/glados/usb_pd_policy.c')
-rw-r--r--board/glados/usb_pd_policy.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c
index 891008f7ce..1799c84724 100644
--- a/board/glados/usb_pd_policy.c
+++ b/board/glados/usb_pd_policy.c
@@ -73,31 +73,30 @@ 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_EN_L, 1);
- /* Provide VBUS */
- gpio_set_level(GPIO_USB_C0_5V_EN, 1);
- }
+ /* Disable charging */
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
+ GPIO_USB_C0_CHARGE_EN_L, 1);
+ /* Provide VBUS */
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN :
+ GPIO_USB_C0_5V_EN, 1);
+
return EC_SUCCESS; /* we are ready */
}
void pd_power_supply_reset(int port)
{
+ /* Disable VBUS */
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN :
+ GPIO_USB_C0_5V_EN, 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_en is
+ * asserted, so, if there is no active charge port, then enable
+ * charge_en. 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_EN, 0);
- /* Enable charging */
- gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
- }
+ if (charge_manager_get_active_charge_port() != !port)
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
+ GPIO_USB_C0_CHARGE_EN_L, 0);
}
void pd_set_input_current_limit(int port, uint32_t max_ma,