diff options
author | lschyi <lschyi@google.com> | 2022-05-31 16:58:50 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-06 10:38:09 +0000 |
commit | c9800bf8304fa2b4590133788cec223ed08992ac (patch) | |
tree | 730fbe13b0ec952e93990c168b06b7ff61496499 | |
parent | e73f64770f9885b15a33032171cfebf50e8d1123 (diff) | |
download | chrome-ec-c9800bf8304fa2b4590133788cec223ed08992ac.tar.gz |
rt1718s: Implement set_sbu
The rt1718s can enable the SBU protection and control in the SBU_CTRL
register. Implement the set_sbu function to make projects set the SBU
line protection and function within the application.
BUG=b:208372205
TEST=manually test with inserting a type c display, then check the SBU
register is set enabled and external display is functioning.
BRANCH=none
Change-Id: I13f3881ddbb3b70f04e8ea88fcb51b1cf37fd517
Signed-off-by: lschyi <lschyi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3682600
Commit-Queue: Sung-Chi Li <lschyi@chromium.org>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Tested-by: Sung-Chi Li <lschyi@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3723368
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Auto-Submit: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
-rw-r--r-- | driver/tcpm/rt1718s.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index 9bcc828d9c..18251d407f 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -763,6 +763,22 @@ static int command_rt1718s_gpio(int argc, char **argv) } DECLARE_CONSOLE_COMMAND(rt1718s_gpio, command_rt1718s_gpio, "", "RT1718S GPIO"); +#ifdef CONFIG_USB_PD_TCPM_SBU +static int rt1718s_set_sbu(int port, bool enable) +{ + /* + * The `enable` here means to enable the SBU line (set 1) + * - true: connect SBU lines from outer to the host + * - false: isolate the SBU lines + */ + return rt1718s_update_bits8(port, RT1718S_RT2_SBU_CTRL_01, + RT1718S_RT2_SBU_CTRL_01_SBU_VIEN | + RT1718S_RT2_SBU_CTRL_01_SBU1_SWEN | + RT1718S_RT2_SBU_CTRL_01_SBU2_SWEN, + enable ? 0xFF : 0); +} +#endif + /* RT1718S is a TCPCI compatible port controller */ const struct tcpm_drv rt1718s_tcpm_drv = { .init = &rt1718s_init, @@ -801,6 +817,9 @@ const struct tcpm_drv rt1718s_tcpm_drv = { .set_frs_enable = &rt1718s_set_frs_enable, #endif .set_bist_test_mode = &tcpci_set_bist_test_mode, +#ifdef CONFIG_USB_PD_TCPM_SBU + .set_sbu = &rt1718s_set_sbu, +#endif }; const struct bc12_drv rt1718s_bc12_drv = { |