diff options
author | Diana Z <dzigterman@chromium.org> | 2021-01-28 16:03:38 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-29 20:36:14 +0000 |
commit | a60236f44ecd8ebb11188a84d2935f82f142ad52 (patch) | |
tree | 1385325ed5b7b308f7fe3904d4e38dafbc59b60c /driver/tcpm/raa489000.h | |
parent | 81b2ff65834abeadd67d5684f9a12f8c8ef4424e (diff) | |
download | chrome-ec-a60236f44ecd8ebb11188a84d2935f82f142ad52.tar.gz |
RAA489000: Add TCPC interface to control output current
Since the TCPC is controlling Vbus, output current must be updated
through the TCPC i2c address. Introduce a function which boards will
use for their implementation of typec_set_source_current_limit() with
this TCPC.
BRANCH=None
BUG=b:178064507
TEST=make -j buildall
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I5bcf83a8bb0221f232f85952ce03e82f49de1602
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2658376
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/tcpm/raa489000.h')
-rw-r--r-- | driver/tcpm/raa489000.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/driver/tcpm/raa489000.h b/driver/tcpm/raa489000.h index 48bfa7c45a..2fdd104a9d 100644 --- a/driver/tcpm/raa489000.h +++ b/driver/tcpm/raa489000.h @@ -6,6 +6,7 @@ */ #include "compile_time_macros.h" +#include "usb_pd_tcpm.h" #ifndef __CROS_EC_USB_PD_TCPM_RAA489000_H #define __CROS_EC_USB_PD_TCPM_RAA489000_H @@ -28,7 +29,8 @@ #define RAA489000_TCPC_PWR_CNTRL BIT(4) /* VBUS_CURRENT_TARGET */ -#define RAA489000_VBUS_CURRENT_TARGET_VALUE 0x61 /* 3.104A */ +#define RAA489000_VBUS_CURRENT_TARGET_3A 0x61 /* 3.104A */ +#define RAA489000_VBUS_CURRENT_TARGET_1_5A 0x30 /* 1.535A */ /* VBUS_OCP_UV_THRESHOLD */ /* Detect voltage level of overcurrent protection during Sourcing VBUS */ @@ -61,6 +63,19 @@ /* PD_PHYSICAL_PARMETER_1 */ #define PD_PHY_PARAM1_NOISE_FILTER_CNT_MASK (GENMASK(4, 0)) +/** + * + * Set output current limit on the TCPC. Note, this chip also offers an OTG + * current level register in the charger i2c page but we must use the TCPC + * current limit because the TCPC is controlling Vbus. + * + * @param port USB-C port number + * @param rp Rp value for current limit (either 1.5A or 3A) + * + * @return Zero if the current limit set was successful, non-zero otherwise + */ +int raa489000_set_output_current(int port, enum tcpc_rp_value rp); + extern const struct tcpm_drv raa489000_tcpm_drv; #endif |