diff options
author | David Huang <david.huang@quanta.corp-partner.google.com> | 2020-06-11 18:37:21 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-15 04:33:12 +0000 |
commit | c446ada8c44c05691f3913f827871cf89e65bd32 (patch) | |
tree | b48f638041b26b2c0ed96e4a2706e2a0c8685775 | |
parent | d31bdc1113824383951ae42b21660fa6d3ca43b2 (diff) | |
download | chrome-ec-c446ada8c44c05691f3913f827871cf89e65bd32.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/+/2241077
Tested-by: Marco Chen <marcochen@chromium.org>
Reviewed-by: Marco Chen <marcochen@chromium.org>
Commit-Queue: Marco Chen <marcochen@chromium.org>
-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 d438597751..d2bfea81b4 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" @@ -484,6 +485,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) @@ -504,7 +506,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); @@ -517,6 +518,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: |