summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-11-20 15:22:01 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-24 00:02:47 +0000
commitcac3d04165b61dfdceda4ac21ae284c7e10cdabe (patch)
tree6525087ebe5139239110ce17efe490fb690dd3ee /util
parent8ef91774b4b67e8e91ff15d74faadcd7bb1a06ee (diff)
downloadchrome-ec-cac3d04165b61dfdceda4ac21ae284c7e10cdabe.tar.gz
genvif: USB_PD_Support/PD_Port_Type selected output
Added check for USB4_Supported in is_usb_pd_supported because USB4_Supported is a must be YES for PD_Support Also split up PD_Port_Type from Type_C_State_Machine because PD_Port_Type should not appear if this component does not support USB PD and the same exclusion can not be said about Type_C_State_Machine BUG=b:172293518 BRANCH=none TEST=verify XML output Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I3d1a8f603693d90673ea3e610ca751f8d9c027a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552858 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/genvif.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/util/genvif.c b/util/genvif.c
index 7ea5654fb4..7776bc14ed 100644
--- a/util/genvif.c
+++ b/util/genvif.c
@@ -660,7 +660,8 @@ static bool is_usb_pd_supported(void)
&vif.Component[component_index]
.vif_field[USB_PD_Support],
&pd_supported))
- pd_supported = IS_ENABLED(CONFIG_USB_PRL_SM) ||
+ pd_supported = is_usb4_supported() ||
+ IS_ENABLED(CONFIG_USB_PRL_SM) ||
IS_ENABLED(CONFIG_USB_POWER_DELIVERY);
return pd_supported;
@@ -2595,32 +2596,43 @@ static void init_vif_component_fields(struct vif_field_t *vif_fields,
vif_component_name[USB_PD_Support],
is_usb_pd_supported());
+ if (is_usb_pd_supported()) {
+ switch (type) {
+ case SNK:
+ set_vif_field(&vif_fields[PD_Port_Type],
+ vif_component_name[PD_Port_Type],
+ "0",
+ "Consumer Only");
+ break;
+ case SRC:
+ set_vif_field(&vif_fields[PD_Port_Type],
+ vif_component_name[PD_Port_Type],
+ "3",
+ "Provider Only");
+ break;
+ case DRP:
+ set_vif_field(&vif_fields[PD_Port_Type],
+ vif_component_name[PD_Port_Type],
+ "4",
+ "DRP");
+ break;
+ }
+ }
+
switch (type) {
case SNK:
- set_vif_field(&vif_fields[PD_Port_Type],
- vif_component_name[PD_Port_Type],
- "0",
- "Consumer Only");
set_vif_field(&vif_fields[Type_C_State_Machine],
vif_component_name[Type_C_State_Machine],
"1",
"SNK");
break;
case SRC:
- set_vif_field(&vif_fields[PD_Port_Type],
- vif_component_name[PD_Port_Type],
- "3",
- "Provider Only");
set_vif_field(&vif_fields[Type_C_State_Machine],
vif_component_name[Type_C_State_Machine],
"0",
"SRC");
break;
case DRP:
- set_vif_field(&vif_fields[PD_Port_Type],
- vif_component_name[PD_Port_Type],
- "4",
- "DRP");
set_vif_field(&vif_fields[Type_C_State_Machine],
vif_component_name[Type_C_State_Machine],
"2",