summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2019-06-28 13:12:02 -0700
committerCommit Bot <commit-bot@chromium.org>2019-07-23 17:16:29 +0000
commitbaf1ebd8c80fd9e3793d193aaf1554cbcc8562df (patch)
tree1db43b47e84c57e15178692b57ebdc9abeb844e5
parent51e0541a296b342137d9a3c8d5e9f745246cff49 (diff)
downloadchrome-ec-baf1ebd8c80fd9e3793d193aaf1554cbcc8562df.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> (cherry picked from commit a551572c396ba2e3c90f1e0581f256d6f207be2a) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1686277
-rw-r--r--board/servo_v4/usb_pd_config.h4
-rw-r--r--board/servo_v4/usb_pd_policy.c10
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 0e3e0ebc6e..e77f4b2227 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);
}
}