kevin: source 3A on one port

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

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:56110
TEST=manual: on Kevin, plug and unplug various devices on the 2 ports,
while measuring the type-C pull-up with Twinkie.

Change-Id: Ic3dfda7b69d0edeb6b3a9218e723e2c3e0232a51
Reviewed-on: https://chromium-review.googlesource.com/373819
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Vincent Palatin
2016-08-22 17:14:55 +02:00
committed by chrome-bot
parent e4d6f134ec
commit 6b4a8e715a
2 changed files with 11 additions and 0 deletions

View File

@@ -102,6 +102,7 @@
#define CONFIG_USB_PD_LOG_SIZE 512
#define CONFIG_USB_PD_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_FUSB302
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
/* TODO: Enable TRY_SRC */
#undef CONFIG_USB_PD_TRY_SRC

View File

@@ -30,6 +30,10 @@ const uint32_t pd_src_pdo[] = {
PDO_FIXED(5000, 1500, PDO_FIXED_FLAGS),
};
const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
const uint32_t pd_src_pdo_max[] = {
PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
};
const int pd_src_pdo_max_cnt = ARRAY_SIZE(pd_src_pdo_max);
const uint32_t pd_snk_pdo[] = {
PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
@@ -54,6 +58,9 @@ int pd_set_power_supply_ready(int port)
if (charge_manager_get_active_charge_port() == port)
bd99955_select_input_port(BD99955_CHARGE_PORT_NONE);
/* 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);
@@ -70,6 +77,9 @@ void pd_power_supply_reset(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 0);
/* 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);
}