summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-05-27 16:09:13 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-05 02:48:22 +0000
commitd092f7d58c84e9d558c7c96c761d55a22a202c96 (patch)
treed5ca372ee093fa64c51a265b6256b9517539ba37
parentf362ce70fc03c988eaef10da30e36607822ce0b4 (diff)
downloadchrome-ec-d092f7d58c84e9d558c7c96c761d55a22a202c96.tar.gz
TCPMv2: Rename pd_can_source_from_device
Clarify the function name by changing it to "can charge from" since "source from" isn't a generally common phrase in PD terms. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id7a40ac9d8d4c0007e8ff6cb25c2e8c2d006df0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923239 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--baseboard/honeybuns/usb_pd_policy.c2
-rw-r--r--common/usbc/usb_pe_drp_sm.c12
-rw-r--r--include/usb_pd.h4
3 files changed, 9 insertions, 9 deletions
diff --git a/baseboard/honeybuns/usb_pd_policy.c b/baseboard/honeybuns/usb_pd_policy.c
index 7306c4fbfc..96739c2356 100644
--- a/baseboard/honeybuns/usb_pd_policy.c
+++ b/baseboard/honeybuns/usb_pd_policy.c
@@ -346,7 +346,7 @@ static void usb_tc_disconnect(void)
}
DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, usb_tc_disconnect, HOOK_PRIO_DEFAULT);
-__override bool pd_can_source_from_device(int port, const int pdo_cnt,
+__override bool pd_can_charge_from_device(int port, const int pdo_cnt,
const uint32_t *pdos)
{
/*
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index ca03d02cf0..ac146a381f 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -1213,11 +1213,11 @@ void pe_got_soft_reset(int port)
set_state_pe(port, PE_SOFT_RESET);
}
-__overridable bool pd_can_source_from_device(int port, const int pdo_cnt,
+__overridable bool pd_can_charge_from_device(int port, const int pdo_cnt,
const uint32_t *pdos)
{
/*
- * Don't attempt to source from a device we have no SrcCaps from. Or, if
+ * Don't attempt to charge from a device we have no SrcCaps from. Or, if
* drp_state is FORCE_SOURCE then don't attempt a PRS.
*/
if (pdo_cnt == 0 || pd_get_dual_role(port) == PD_DRP_FORCE_SOURCE)
@@ -1265,7 +1265,7 @@ void pd_resume_check_pr_swap_needed(int port)
*/
if (pe_is_explicit_contract(port) &&
pd_get_power_role(port) == PD_ROLE_SINK &&
- !pd_can_source_from_device(port, pd_get_src_cap_cnt(port),
+ !pd_can_charge_from_device(port, pd_get_src_cap_cnt(port),
pd_get_src_caps(port)) &&
(!IS_ENABLED(CONFIG_CHARGE_MANAGER) ||
charge_manager_get_active_charge_port() != port))
@@ -1742,7 +1742,7 @@ static void pe_update_src_pdo_flags(int port, int pdo_cnt, uint32_t *pdos)
return;
if (IS_ENABLED(CONFIG_CHARGE_MANAGER)) {
- if (pd_can_source_from_device(port, pdo_cnt, pdos)) {
+ if (pd_can_charge_from_device(port, pdo_cnt, pdos)) {
charge_manager_update_dualrole(port, CAP_DEDICATED);
} else {
charge_manager_update_dualrole(port, CAP_DUALROLE);
@@ -3073,7 +3073,7 @@ static void pe_snk_evaluate_capability_entry(int port)
* If port policy preference is to be a power role source,
* then request a power role swap.
*/
- if (!pd_can_source_from_device(port, num, pdo))
+ if (!pd_can_charge_from_device(port, num, pdo))
pd_request_power_swap(port);
pe_update_src_pdo_flags(port, num, pdo);
@@ -6774,7 +6774,7 @@ static void pe_dr_src_get_source_cap_run(int port)
* If we'd prefer to charge from this partner,
* then propose a PR swap.
*/
- if (pd_can_source_from_device(port, cnt,
+ if (pd_can_charge_from_device(port, cnt,
payload))
pd_request_power_swap(port);
diff --git a/include/usb_pd.h b/include/usb_pd.h
index cc85cbf2c2..751907d3c8 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1606,14 +1606,14 @@ void pd_vbus_low(int port);
__override_proto int pd_check_power_swap(int port);
/**
- * Check if we are allowed to automatically be charging from port partner
+ * Check if we are allowed to automatically charge from port partner
*
* @param port USB-C port number
* @pdo_cnt number of source cap PDOs
* @*pdos pointer to source cap PDOs
* @return True if port partner can supply power
*/
-__override_proto bool pd_can_source_from_device(int port, const int pdo_cnt,
+__override_proto bool pd_can_charge_from_device(int port, const int pdo_cnt,
const uint32_t *pdos);
/**