diff options
author | Denis Brockus <dbrockus@google.com> | 2020-11-06 09:58:00 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-10 01:05:31 +0000 |
commit | 687ec68c0cfa1f7a1c9dc431c4f5606ad982b8ba (patch) | |
tree | 6e773b0ddb1a727aef6338d50e9e3ba04b87310b | |
parent | 5d36fe2ef100d1f1a174eb32bb5956d5534af27f (diff) | |
download | chrome-ec-687ec68c0cfa1f7a1c9dc431c4f5606ad982b8ba.tar.gz |
genvif: Unconstrained_Power
BUG=b:172419824
BRANCH=none
TEST=verify XML output
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I465fadb323649fbcace24f81a944595a0751d714
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522670
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | util/genvif.c | 26 |
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", |