poppy: source 3A on one port

Add a new source policy to provide 3A if there is only one port used
as a source.

Also ensure that the load switch on VBUS when sourcing power is properly
configured to limit the current to 1.5A or 3.0A depending on the case.

BRANCH=none
BUG=b:35585396
BUG=b:35577509
TEST=On soraka (rev1), connect any USB device on port 0. On port 1
     attach C-C cable to MacBook Pro. MacBook Pro charges at ~1.5A.
     Disconnect USB device on port 0, MacBook Pro charges at 3A.
TEST=On soraka (rev1), connect USB key on port 0, see it enumerating,
     plug another USB key on port 1, it enumerates too, and the device
     on port 0 does NOT disconnect/re-enumerate.
TEST=Repeat 2 tests above, but starting with port 1.

Change-Id: I48e744c8edec89bc0a53b54c47f666ad53e47551
Reviewed-on: https://chromium-review.googlesource.com/481563
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Nicolas Boichat
2017-04-19 13:08:36 +08:00
committed by chrome-bot
parent fc562bbf9b
commit 1c929523a2

View File

@@ -110,9 +110,13 @@ int pd_set_power_supply_ready(int port)
/* Disable charging */
gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
GPIO_USB_C0_CHARGE_L, 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
/* Provide VBUS */
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 1);
vbus_en[port] = 1;
board_vbus_update_source_current(port);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -123,8 +127,11 @@ int pd_set_power_supply_ready(int port)
void pd_power_supply_reset(int port)
{
/* Disable VBUS */
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 0);
vbus_en[port] = 0;
board_vbus_update_source_current(port);
/* Give back the current quota we are no longer using */
charge_manager_source_port(port, 0);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);