diff options
author | David Huang <david.huang@quanta.corp-partner.google.com> | 2020-06-11 18:37:21 +0800 |
---|---|---|
committer | Marco Chen <marcochen@chromium.org> | 2020-06-15 04:26:29 +0000 |
commit | 58732e1f79886bd816e7000159d00f8c90c30f82 (patch) | |
tree | d549a0daab31261c385326ca62b73db07ca7bd28 /driver | |
parent | 3df08544d75c8854c8d0088e2afb4fe88f94b64b (diff) | |
download | chrome-ec-58732e1f79886bd816e7000159d00f8c90c30f82.tar.gz |
Syv682x: Set 5V source current limit base on the config definition
Add set 5V source current limit in init based on CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT.
Default is set to 1.5A if there's no define config.
BUG=b:154772847, b:156711950
BRANCH=octopus
TEST=connect a sink device with a pd analyzer to see if OC is triggered in PPC when pulling more than 1.75A by external sink device.
Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com>
Change-Id: I55aae8655703870ea9e023d1a4ddbb9efe1ffd14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2241076
Reviewed-by: Marco Chen <marcochen@chromium.org>
Commit-Queue: Marco Chen <marcochen@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/ppc/syv682x.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c index 08deec7592..48a24947df 100644 --- a/driver/ppc/syv682x.c +++ b/driver/ppc/syv682x.c @@ -5,6 +5,7 @@ /* Silergy SYV682x USB-C Power Path Controller */ #include "common.h" +#include "config.h" #include "console.h" #include "driver/ppc/syv682x.h" #include "hooks.h" @@ -483,6 +484,7 @@ static int syv682x_init(int port) int rv; int regval; int status, control_1; + enum tcpc_rp_value initial_current_limit; rv = read_reg(port, SYV682X_STATUS_REG, &status); if (rv) @@ -503,7 +505,6 @@ static int syv682x_init(int port) */ regval = SYV682X_CONTROL_1_PWR_ENB | (SYV682X_HV_ILIM_3_30 << SYV682X_HV_ILIM_BIT_SHIFT) | - (SYV682X_5V_ILIM_3_30 << SYV682X_5V_ILIM_BIT_SHIFT) | /* !SYV682X_CONTROL_1_HV_DR */ SYV682X_CONTROL_1_CH_SEL; rv = write_reg(port, SYV682X_CONTROL_1_REG, regval); @@ -516,6 +517,15 @@ static int syv682x_init(int port) return rv; } +#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT + initial_current_limit = CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT; +#else + initial_current_limit = CONFIG_USB_PD_PULLUP; +#endif + rv = syv682x_set_vbus_source_current_limit(port, initial_current_limit); + if (rv) + return rv; + /* * Set Control Reg 2 to defaults, plus enable smart discharge mode. * The SYV682 automatically discharges under the following conditions: |