diff options
author | Denis Brockus <dbrockus@google.com> | 2020-11-04 11:22:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-06 02:52:46 +0000 |
commit | b78cfb3fb8ca70659c54957c7f5d38a01d8fffa1 (patch) | |
tree | 21453c7af3b84719f171e6dab403b4fb029cf5f0 /util/genvif.c | |
parent | 9048036ddb3037e18ea2c2212d8ea9eeab28077f (diff) | |
download | chrome-ec-b78cfb3fb8ca70659c54957c7f5d38a01d8fffa1.tar.gz |
genvif: BC_1_2_Support and BC_1_2_Charging_Port_Type
BUG=b:172417926,b:172419455
BRANCH=none
TEST=verify XML output
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I241d69d86f631fb6b4cb56136d10e737e8a1fb60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2519953
Tested-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'util/genvif.c')
-rw-r--r-- | util/genvif.c | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/util/genvif.c b/util/genvif.c index 2111f5d59d..b4afc9b0af 100644 --- a/util/genvif.c +++ b/util/genvif.c @@ -55,6 +55,15 @@ enum usb_speed { USB_GEN22 = 4 }; +/* + * BC_1_2_SUPPORT options + */ +enum bc_1_2_support { + BC_1_2_SUPPORT_NONE = 0, + BC_1_2_SUPPORT_PORTABLE_DEVICE = 1, + BC_1_2_SUPPORT_CHARGING_PORT = 2, + BC_1_2_SUPPORT_BOTH = 3 +}; /***************************************************************************** * Generic Helper Functions @@ -622,7 +631,6 @@ __maybe_unused static void set_vif_field_itis(struct vif_field_t *vif_field, * Device_Truncates_DP_For_tDHPResponse booleanFieldType * Device_Gen1x1_tLinkTurnaround numericFieldType * Device_Gen2x1_tLinkTurnaround numericFieldType - * BC_1_2_Charging_Port_Type numericFieldType * XID_SOP numericFieldType * Data_Capable_As_USB_Host_SOP booleanFieldType * Data_Capable_As_USB_Device_SOP booleanFieldType @@ -972,6 +980,7 @@ static int gen_vif(const char *name, struct vif_field_t *vif_fields; int32_t src_max_power = 0; + enum bc_1_2_support bc_support; /* Determine if we are DRP, SRC or SNK */ @@ -1159,10 +1168,42 @@ static int gen_vif(const char *name, "Port_Battery_Powered", IS_ENABLED(CONFIG_BATTERY)); - set_vif_field(&vif_fields[BC_1_2_Support], - "BC_1_2_Support", - "0", - "None"); + bc_support = BC_1_2_SUPPORT_NONE; + if (IS_ENABLED(CONFIG_BC12_DETECT_MAX14637)) + bc_support = BC_1_2_SUPPORT_PORTABLE_DEVICE; + if (IS_ENABLED(CONFIG_BC12_DETECT_MT6360)) + bc_support = BC_1_2_SUPPORT_PORTABLE_DEVICE; + if (IS_ENABLED(CONFIG_BC12_DETECT_PI3USB9201)) + bc_support = BC_1_2_SUPPORT_BOTH; + if (IS_ENABLED(CONFIG_BC12_DETECT_PI3USB9281)) + bc_support = BC_1_2_SUPPORT_PORTABLE_DEVICE; + + switch (bc_support) { + case BC_1_2_SUPPORT_NONE: + set_vif_field(&vif_fields[BC_1_2_Support], + "BC_1_2_Support", + "0", + "None"); + break; + case BC_1_2_SUPPORT_PORTABLE_DEVICE: + set_vif_field(&vif_fields[BC_1_2_Support], + "BC_1_2_Support", + "1", + "Portable Device"); + break; + case BC_1_2_SUPPORT_CHARGING_PORT: + set_vif_field(&vif_fields[BC_1_2_Support], + "BC_1_2_Support", + "2", + "Charging Port"); + break; + case BC_1_2_SUPPORT_BOTH: + set_vif_field(&vif_fields[BC_1_2_Support], + "BC_1_2_Support", + "3", + "Both"); + break; + } /********************************************************************* * General PD Fields @@ -1771,6 +1812,16 @@ static int gen_vif(const char *name, IS_ENABLED(CONFIG_USB_PD_FRS)); /********************************************************************* + * Battery Charging 1.2 Fields + */ + if (bc_support == BC_1_2_SUPPORT_CHARGING_PORT || + bc_support == BC_1_2_SUPPORT_BOTH) + set_vif_field(&vif_fields[BC_1_2_Charging_Port_Type], + "BC_1_2_Charging_Port_Type", + "1", + "CDP"); + + /********************************************************************* * Product Power Fields */ if (type == DRP || type == SRC) { |