summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/genvif.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/util/genvif.c b/util/genvif.c
index 9f49f3d2df..9b19796596 100644
--- a/util/genvif.c
+++ b/util/genvif.c
@@ -1314,14 +1314,32 @@ static int gen_vif(const char *name,
supports_to_ufp);
}
- if (is_src())
- set_vif_field_b(&vif_fields[Unconstrained_Power],
+ if (is_src()) {
+ /* SRC capable */
+ if (IS_ENABLED(CONFIG_CHARGER))
+ /* USB-C UP bit set */
+ set_vif_field_b(&vif_fields[Unconstrained_Power],
"Unconstrained_Power",
- src_pdo[0] & PDO_FIXED_UNCONSTRAINED);
- else
+ (src_pdo[0] & PDO_FIXED_UNCONSTRAINED));
+ else {
+ /* Barrel charger being used */
+ int32_t dedicated_charge_port_count = 0;
+
+ #ifdef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+ dedicated_charge_port_count =
+ CONFIG_DEDICATED_CHARGE_PORT_COUNT;
+ #endif
+
+ set_vif_field_b(&vif_fields[Unconstrained_Power],
+ "Unconstrained_Power",
+ (dedicated_charge_port_count > 0));
+ }
+ } else {
+ /* Not SRC capable */
set_vif_field_b(&vif_fields[Unconstrained_Power],
"Unconstrained_Power",
false);
+ }
set_vif_field_b(&vif_fields[VCONN_Swap_To_On_Supported],
"VCONN_Swap_To_On_Supported",