summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-08-28 08:50:43 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-02 21:50:24 +0000
commit44302acb01290bea42acf35bd15a390a36a6688d (patch)
treec4228e16eb9e29349b2dbb78a8f3bb198596a57a /common
parentee80da857da052809b34746e87ee58651e913194 (diff)
downloadchrome-ec-44302acb01290bea42acf35bd15a390a36a6688d.tar.gz
TCPMv2: Disabling DPM_REQUEST for SnkGetSnkCaps if FRS disabled
Leaving this code in when we don't care about the single thing we are getting from it, whether the partner can do FRS, does not make a lot of sense and wastes flash space if we do not have FRS configured to be enabled in the current build. BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I73568f04af5bf1df7a03b53983b8e1f443dbdae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2381407 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usbc/usb_pe_drp_sm.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 7eefcabbe1..60924579b4 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -374,12 +374,14 @@ static const char * const pe_state_names[] = {
[PE_PRS_SNK_SRC_ASSERT_RP] = "PE_PRS_SNK_SRC_Assert_Rp",
[PE_PRS_SNK_SRC_SOURCE_ON] = "PE_PRS_SNK_SRC_Source_On",
[PE_PRS_SNK_SRC_SEND_SWAP] = "PE_PRS_SNK_SRC_Send_Swap",
+#ifdef CONFIG_USBC_VCONN
[PE_VCS_EVALUATE_SWAP] = "PE_VCS_Evaluate_Swap",
[PE_VCS_SEND_SWAP] = "PE_VCS_Send_Swap",
[PE_VCS_WAIT_FOR_VCONN_SWAP] = "PE_VCS_Wait_For_Vconn_Swap",
[PE_VCS_TURN_ON_VCONN_SWAP] = "PE_VCS_Turn_On_Vconn_Swap",
[PE_VCS_TURN_OFF_VCONN_SWAP] = "PE_VCS_Turn_Off_Vconn_Swap",
[PE_VCS_SEND_PS_RDY_SWAP] = "PE_VCS_Send_Ps_Rdy_Swap",
+#endif
[PE_VDM_IDENTITY_REQUEST_CBL] = "PE_VDM_Identity_Request_Cbl",
[PE_INIT_PORT_VDM_IDENTITY_REQUEST] =
"PE_INIT_PORT_VDM_Identity_Request",
@@ -391,7 +393,9 @@ static const char * const pe_state_names[] = {
[PE_BIST_TX] = "PE_Bist_TX",
[PE_BIST_RX] = "PE_Bist_RX",
[PE_DEU_SEND_ENTER_USB] = "PE_DEU_Send_Enter_USB",
+#ifdef CONFIG_USB_PD_FRS
[PE_DR_SNK_GET_SINK_CAP] = "PE_DR_SNK_Get_Sink_Cap",
+#endif
[PE_DR_SNK_GIVE_SOURCE_CAP] = "PE_DR_SNK_Give_Source_Cap",
/* PD3.0 only states below here*/
@@ -442,6 +446,11 @@ GEN_NOT_SUPPORTED(PE_SNK_CHUNK_RECEIVED);
void pe_set_frs_enable(int port, int enable);
#endif /* CONFIG_USB_PD_REV30 */
+#ifndef CONFIG_USB_PD_FRS
+GEN_NOT_SUPPORTED(PE_DR_SNK_GET_SINK_CAP);
+#define PE_DR_SNK_GET_SINK_CAP PE_DR_SNK_GET_SINK_CAP_NOT_SUPPORTED
+#endif /* CONFIG_USB_PD_FRS */
+
#ifndef CONFIG_USB_PD_EXTENDED_MESSAGES
GEN_NOT_SUPPORTED(PE_GIVE_BATTERY_CAP);
#define PE_GIVE_BATTERY_CAP PE_GIVE_BATTERY_CAP_NOT_SUPPORTED
@@ -2741,7 +2750,9 @@ static void pe_snk_select_capability_run(int port)
* Setup to get Device Policy Manager to
* request Sink Capabilities for possible FRS
*/
- pe_dpm_request(port, DPM_REQUEST_GET_SNK_CAPS);
+ if (IS_ENABLED(CONFIG_USB_PD_FRS))
+ pe_dpm_request(port,
+ DPM_REQUEST_GET_SNK_CAPS);
return;
}
/*
@@ -3094,7 +3105,8 @@ static void pe_snk_ready_run(int port)
pe_set_dpm_curr_request(port,
DPM_REQUEST_NEW_POWER_LEVEL);
set_state_pe(port, PE_SNK_SELECT_CAPABILITY);
- } else if (PE_CHK_DPM_REQUEST(port,
+ } else if (IS_ENABLED(CONFIG_USB_PD_FRS) &&
+ PE_CHK_DPM_REQUEST(port,
DPM_REQUEST_GET_SNK_CAPS)) {
pe_set_dpm_curr_request(port,
DPM_REQUEST_GET_SNK_CAPS);
@@ -5715,7 +5727,7 @@ static void pe_vcs_send_ps_rdy_swap_run(int port)
/*
* PE_DR_SNK_Get_Sink_Cap
*/
-static void pe_dr_snk_get_sink_cap_entry(int port)
+static __maybe_unused void pe_dr_snk_get_sink_cap_entry(int port)
{
print_current_state(port);
@@ -5724,7 +5736,7 @@ static void pe_dr_snk_get_sink_cap_entry(int port)
pe_sender_response_msg_entry(port);
}
-static void pe_dr_snk_get_sink_cap_run(int port)
+static __maybe_unused void pe_dr_snk_get_sink_cap_run(int port)
{
int type;
int cnt;
@@ -6190,10 +6202,12 @@ static const struct usb_state pe_states[] = {
.entry = pe_bist_rx_entry,
.run = pe_bist_rx_run,
},
+#ifdef CONFIG_USB_PD_FRS
[PE_DR_SNK_GET_SINK_CAP] = {
.entry = pe_dr_snk_get_sink_cap_entry,
.run = pe_dr_snk_get_sink_cap_run,
},
+#endif
[PE_DR_SNK_GIVE_SOURCE_CAP] = {
.entry = pe_dr_snk_give_source_cap_entry,
.run = pe_dr_snk_give_source_cap_run,