Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion sof-ucm/sof_ucm/graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def build_end_to_end_graph(
continue

# Map FE DAI stream stubs on DSP component directly to their PCM node!
if dw.name in fe_stream_to_pcm_nid:
if dw.component != "card" and dw.name in fe_stream_to_pcm_nid:
pcm_nid = fe_stream_to_pcm_nid[dw.name]
dapm_node_by_key[key] = pcm_nid
dapm_node_by_name.setdefault(dw.name, pcm_nid)
Expand Down Expand Up @@ -377,6 +377,11 @@ def build_end_to_end_graph(
# 5. Synthesize Hardware Endpoints only for remaining dangling DAI/PCM paths
_synthesize_missing_endpoints(snap, vm, pcm_node_by_dev_dir)

# 5b. Demote intermediate codec pin widgets (e.g. rt722 HP/SPK/MIC2, dmic-codec DMic)
# that connect directly to a physical card transducer endpoint, so only true terminal
# transducers remain in the right-hand Endpoint column.
_demote_non_terminal_codec_endpoints(vm)

# 6. Attach Kcontrols to Edges and Owning Nodes
_attach_kcontrols(snap, vm, pcm_node_by_dev_dir, tplg_node_by_wname, hda_ctl_to_nid, include_readonly_masks)

Expand Down Expand Up @@ -694,6 +699,26 @@ def _add_edge(
return edge


def _demote_non_terminal_codec_endpoints(vm: UcmGraphViewModel) -> None:
"""Keep only terminal physical transducers as Endpoints; internal codec pins stay Codec."""
to_demote: Set[str] = set()
for e in vm.edges:
u = vm.nodes.get(e.source_node)
v = vm.nodes.get(e.sink_node)
if not u or not v:
continue
if u.class_category == "Endpoint" and v.class_category == "Endpoint":
if u.component != "card" and (v.component == "card" or u.direction == "playback"):
to_demote.add(u.id)
elif v.component != "card" and (u.component == "card" or v.direction == "capture"):
to_demote.add(v.id)
for nid in to_demote:
n = vm.nodes.get(nid)
if n:
n.class_category = "Codec"
n.category = "codec"


def _synthesize_missing_endpoints(
snap: MachineAudioSnapshot,
vm: UcmGraphViewModel,
Expand Down
Loading