Skip to content

Commit

Permalink
tplgtool2.py: show widget CPC in topology graph
Browse files Browse the repository at this point in the history
This patch adds support to show widget CPC value
int topology graph.

Signed-off-by: Chao Song <[email protected]>
  • Loading branch information
Chao Song committed Sep 6, 2023
1 parent 06199c4 commit e7e1d53
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/tplgtool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class SofVendorToken(enum.IntEnum):
SOF_TKN_COMP_FORMAT = 402
SOF_TKN_COMP_CORE_ID = 404
SOF_TKN_COMP_UUID = 405
SOF_TKN_COMP_CPC = 406
# sof_ssp_tokens
SOF_TKN_INTEL_SSP_CLKS_CONTROL = 500
SOF_TKN_INTEL_SSP_MCLK_ID = 501
Expand Down Expand Up @@ -690,10 +691,10 @@ def get_priv_element(comp: Container, token: SofVendorToken, default = None):
return default

@staticmethod
def get_core_id(widget: Container, default = None):
"Get widget core ID."
return GroupedTplg.get_priv_element(widget["widget"], SofVendorToken.SOF_TKN_COMP_CORE_ID, default)
def get_widget_token_value(widget: Container, token: SofVendorToken, default = None):
"Get the value for specified token"
return GroupedTplg.get_priv_element(widget["widget"], token, default)

@staticmethod
def get_widget_uuid(widget: Container, default = None):
"Get widget UUID."
Expand Down Expand Up @@ -741,7 +742,7 @@ def coreids(self):
"All available core IDs."
cores = set()
for widget in self.widget_list:
core = self.get_core_id(widget)
core = self.get_widget_token_value(widget, SofVendorToken.SOF_TKN_COMP_CORE_ID)
if core is None:
cores.add(-1) # placeholder for the lack of core ID
else:
Expand Down Expand Up @@ -917,12 +918,15 @@ def _display_node_attrs(self, name: str, widget: Container):
attr = {}
if not self.without_nodeinfo:
sublabel = self.node_sublabel(widget)
core = GroupedTplg.get_core_id(widget)
core = GroupedTplg.get_widget_token_value(widget, SofVendorToken.SOF_TKN_COMP_CORE_ID)
if core is not None:
if self.show_core == 'always' or (
self.show_core == 'auto' and self._tplg.has_core_differences
):
sublabel2 += f'<BR ALIGN="CENTER"/><SUB>core:{core}</SUB>'
comp_cpc = GroupedTplg.get_widget_token_value(widget, SofVendorToken.SOF_TKN_COMP_CPC)
if comp_cpc is not None:
sublabel2 += f'<BR ALIGN="CENTER"/><SUB>cpc:{comp_cpc}</SUB>'
display_name = name
wname = widget.widget.name
# See the *_NUM_REGEX above
Expand Down

0 comments on commit e7e1d53

Please sign in to comment.