diff options
author | Wai-Hong Tam <waihong@google.com> | 2019-06-28 13:12:02 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-20 03:16:59 +0000 |
commit | a551572c396ba2e3c90f1e0581f256d6f207be2a (patch) | |
tree | 372229c3632f0814caa761dad5cfa7ccd28486a9 /board/servo_v4 | |
parent | c3aa5d72a4a74245589c749d97cb1cca39e6380d (diff) | |
download | chrome-ec-a551572c396ba2e3c90f1e0581f256d6f207be2a.tar.gz |
servo_v4: Remove unnecessary init for GPIO MODULE_USB_PD
The pd_config_init() does two things:
* pd_tx_init() to init the GPIO MODULE_USB_PD;
* pd_set_host_mode() to set CC pull resistors.
The pd_config_init() is called on PD phy init hook.
For setting CC pull resistors, calling pd_set_host_mode() is enough.
Don't need to reinit GPIO MODULE_USB_PD.
BRANCH=servo
BUG=b:135691171
TEST=Set "cc" role to "src", "snk", "srcdts", "snkdts", and "off".
TEST=Unplugged and replugged the CHG port cable.
Change-Id: I1e783dfa5da4f8e8f1d9d591818eb1128b7a8caa
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682917
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/servo_v4')
-rw-r--r-- | board/servo_v4/usb_pd_config.h | 4 | ||||
-rw-r--r-- | board/servo_v4/usb_pd_policy.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/board/servo_v4/usb_pd_config.h b/board/servo_v4/usb_pd_config.h index de2e3c70c8..e56dc5c791 100644 --- a/board/servo_v4/usb_pd_config.h +++ b/board/servo_v4/usb_pd_config.h @@ -265,8 +265,8 @@ static inline void pd_set_host_mode(int port, int enable) static inline void pd_config_init(int port, uint8_t power_role) { /* - * Set CC pull resistors, and charge_en and vbus_en GPIOs to match - * the initial role. + * Set CC pull resistors. The PD state machine will then transit and + * enable VBUS after it detects valid voltages on CC lines. */ pd_set_host_mode(port, power_role); diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c index e45a920b1e..0ae2552e02 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -131,7 +131,7 @@ static void dut_allow_charge(void) pd_get_dual_role(DUT) != PD_DRP_FORCE_SOURCE) { CPRINTS("Enable DUT charge through"); pd_set_dual_role(DUT, PD_DRP_FORCE_SOURCE); - pd_config_init(DUT, PD_ROLE_SOURCE); + pd_set_host_mode(DUT, 1); pd_update_contract(DUT); } } @@ -165,7 +165,7 @@ static void board_manage_dut_port(void) /* Mark as SNK only. */ pd_set_dual_role(DUT, PD_DRP_FORCE_SINK); - pd_config_init(DUT, PD_ROLE_SINK); + pd_set_host_mode(DUT, 0); } else { /* Allow charge through after PD negotiate. */ hook_call_deferred(&dut_allow_charge_data, 2000 * MSEC); @@ -743,16 +743,16 @@ static void do_cc(int disable_cc_new, int disable_dts_new, int allow_src_new) allow_src_mode = allow_src_new; if (!disable_cc) { - /* Can we charge? */ + /* Can we source? */ dualrole = allow_src_mode && charge_port_is_active(); pd_set_dual_role(DUT, dualrole ? PD_DRP_FORCE_SOURCE : PD_DRP_FORCE_SINK); /* * Present Rp or Rd on CC1 and CC2 based on - * disable_dts_mode + * whether we can source or not. */ - pd_config_init(DUT, dualrole); + pd_set_host_mode(DUT, dualrole); pd_comm_enable(DUT, dualrole); } } |