-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
USB-C: genVIF: Cleanup and add support to pick static data from input
Removed few VIF properties which are being hardcoded Updated the script to parse source VIF XML and add information to the output Added optional Kconfig option to configure custom source VIF XML path Cleaned up the code Signed-off-by: Madhurima Paruchuri <[email protected]>
- Loading branch information
1 parent
8ea9fce
commit a19d905
Showing
11 changed files
with
381 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<vif:VIF xmlns:vif="http://usb.org/VendorInfoFile.xsd"> | ||
<vif:Vendor_Name>Zephyr</vif:Vendor_Name> | ||
<vif:Model_Part_Number>Sink</vif:Model_Part_Number> | ||
<vif:Product_Revision>1</vif:Product_Revision> | ||
<vif:TID>0</vif:TID> | ||
<vif:VIF_Product_Type value="0">Port Product</vif:VIF_Product_Type> | ||
<vif:Certification_Type value="0">End Product</vif:Certification_Type> | ||
</vif:VIF> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2022 The Chromium OS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""This file contains device tree constants defined to be used by generate_vif.py""" | ||
|
||
SINK_PDOS = "sink-pdos" | ||
PD_DISABLE = "pd-disable" | ||
POWER_ROLE = "power-role" | ||
|
||
DT_VIF_ELEMENTS = { | ||
SINK_PDOS: "SnkPdoList", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2022 The Chromium OS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""This file contains generic constants defined to be used by generate_vif.py""" | ||
|
||
NAME = "name" | ||
VALUE = "value" | ||
TEXT = "text" | ||
ATTRIBUTES = "attributes" | ||
CHILD = "child" | ||
TRUE = "true" | ||
FALSE = "false" | ||
|
||
PD_PORT_TYPE_VALUES = { | ||
"sink": ("0", "Consumer Only"), | ||
"source": ("3", "Provider Only"), | ||
"dual": ("4", "DRP"), | ||
} | ||
|
||
TYPE_C_STATE_MACHINE_VALUES = { | ||
"sink": ("1", "SNK"), | ||
"source": ("0", "SRC"), | ||
"dual": ("2", "DRP"), | ||
} | ||
|
||
FR_SWAP_REQD_TYPE_C_CURRENT_AS_INITIAL_SOURCE_VALUES = { | ||
0: "FR_Swap not supported", | ||
1: "Default USB Power", | ||
2: "1.5A @ 5V", | ||
3: "3A @ 5V", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2022 The Chromium OS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""This file contains PDO constants defined to be used by generate_vif.py""" | ||
|
||
# PDO | ||
PDO_TYPE_FIXED = 0 | ||
PDO_TYPE_BATTERY = 1 | ||
PDO_TYPE_VARIABLE = 2 | ||
PDO_TYPE_AUGUMENTED = 3 | ||
|
||
PDO_TYPES = { | ||
PDO_TYPE_FIXED: "Fixed", | ||
PDO_TYPE_BATTERY: "Battery", | ||
PDO_TYPE_VARIABLE: "Variable", | ||
PDO_TYPE_AUGUMENTED: "Augmented", | ||
} |
29 changes: 29 additions & 0 deletions
29
scripts/generate_usb_vif/constants/vif_element_constants.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2022 The Chromium OS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""This file contains VIF element constants defined to be used by generate_vif.py""" | ||
|
||
VENDOR_NAME = "Vendor_Name" | ||
MODEL_PART_NUMBER = "Model_Part_Number" | ||
PRODUCT_REVISION = "Product_Revision" | ||
TID = "TID" | ||
VIF_PRODUCT_TYPE = "VIF_Product_Type" | ||
CERTIFICATION_TYPE = "Certification_Type" | ||
COMPONENT = "Component" | ||
|
||
USB_PD_SUPPORT = "USB_PD_Support" | ||
PD_PORT_TYPE = "PD_Port_Type" | ||
TYPE_C_STATE_MACHINE = "Type_C_State_Machine" | ||
SINK_PDO = "SnkPDO" | ||
SINK_PDO_SUPPLY_TYPE = "Snk_PDO_Supply_Type" | ||
SINK_PDO_VOLTAGE = "Snk_PDO_Voltage" | ||
SINK_PDO_OP_CURRENT = "Snk_PDO_Op_Current" | ||
SINK_PDO_OP_POWER = "Snk_PDO_Op_Power" | ||
SINK_PDO_MIN_VOLTAGE = "Snk_PDO_Min_Voltage" | ||
SINK_PDO_MAX_VOLTAGE = "Snk_PDO_Max_Voltage" | ||
PD_POWER_AS_SINK = "PD_Power_As_Sink" | ||
HIGHER_CAPABILITY_SET = "Higher_Capability_Set" | ||
FR_SWAP_REQD_TYPE_C_CURRENT_AS_INITIAL_SOURCE = "FR_Swap_Reqd_Type_C_Current_As_Initial_Source" | ||
NUM_SNK_PDOS = "Num_Snk_PDOs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2022 The Chromium OS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""This file contains XML constants defined to be used by generate_vif.py""" | ||
|
||
from constants import other_constants | ||
from constants import vif_element_constants | ||
|
||
XML_ENCODING = "utf-8" | ||
XML_ELEMENT_NAME_PREFIX = "vif" | ||
XML_ROOT_ELEMENT_NAME = "VIF" | ||
XML_VIF_NAMESPACE = "http://usb.org/VendorInfoFile.xsd" | ||
XML_NAMESPACE_ATTRIBUTES = { | ||
"xmlns:vif": XML_VIF_NAMESPACE, | ||
} | ||
|
||
VIF_SPEC_ELEMENTS = { | ||
"VIF_Specification": { | ||
other_constants.TEXT: "3.19", | ||
}, | ||
"VIF_App": { | ||
other_constants.CHILD: { | ||
"Description": { | ||
other_constants.TEXT: "This VIF XML file is generated by the Zephyr GenVIF script", | ||
} | ||
} | ||
}, | ||
} | ||
|
||
VIF_SPEC_ELEMENTS_FROM_SOURCE_XML = {vif_element_constants.VENDOR_NAME, | ||
vif_element_constants.MODEL_PART_NUMBER, | ||
vif_element_constants.PRODUCT_REVISION, | ||
vif_element_constants.TID, | ||
vif_element_constants.VIF_PRODUCT_TYPE, | ||
vif_element_constants.CERTIFICATION_TYPE, } |
Oops, something went wrong.