From 7f1bb54c108d8e01158b5fade051552942664fd0 Mon Sep 17 00:00:00 2001 From: Edward Hill Date: Sun, 14 Jan 2018 17:50:27 -0800 Subject: [PATCH] grunt: Set source current limit to enable 3A output Call ppc_set_vbus_source_current_limit to enable 3A output. BUG=b:69378796 BRANCH=none TEST=connect PD sink and see 5V 3A on both ports Change-Id: Ia38ebcb3b1b3d1148a00b3050fcda2bd2cf73af5 Signed-off-by: Edward Hill Reviewed-on: https://chromium-review.googlesource.com/866158 Reviewed-by: Justin TerAvest --- board/grunt/usb_pd_policy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/board/grunt/usb_pd_policy.c b/board/grunt/usb_pd_policy.c index b4184a1da5..ca2545c436 100644 --- a/board/grunt/usb_pd_policy.c +++ b/board/grunt/usb_pd_policy.c @@ -125,8 +125,10 @@ void pd_power_supply_reset(int port) if (prev_en) pd_set_vbus_discharge(port, 1); +#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT /* Give back the current quota we are no longer using */ charge_manager_source_port(port, 0); +#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */ /* Notify host of power info change. */ pd_send_host_event(PD_EVENT_POWER_CHANGE); @@ -141,9 +143,6 @@ int pd_set_power_supply_ready(int port) if (rv) return rv; - /* Ensure we advertise the proper available current quota */ - charge_manager_source_port(port, 1); - pd_set_vbus_discharge(port, 0); /* Provide Vbus. */ @@ -151,6 +150,11 @@ int pd_set_power_supply_ready(int port) if (rv) return rv; +#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT + /* Ensure we advertise the proper available current quota */ + charge_manager_source_port(port, 1); +#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */ + /* Notify host of power info change. */ pd_send_host_event(PD_EVENT_POWER_CHANGE); @@ -164,7 +168,7 @@ void pd_transition_voltage(int idx) void typec_set_source_current_limit(int port, int rp) { - /* TODO(ecgh): call ppc_set_vbus_source_current_limit */ + ppc_set_vbus_source_current_limit(port, rp); } int pd_snk_is_vbus_provided(int port)