@@ -803,59 +803,6 @@ def format_pcm(self):
803803 % (pcm ["pcm_name" ], pcm ["pcm_id" ], pcm_type , fmt [0 ], rates [0 ], rates [1 ], \
804804 channel [0 ], channel [1 ]))
805805
806- @staticmethod
807- def find_second_end_point (first_end_point , node_list ):
808- second_end_point = []
809- for node in node_list :
810- if node ["source" ] is not None and node ["sink" ] is not None :
811- continue
812- if node ["source" ] is None and node ["sink" ] is None :
813- continue
814- if node ["name" ].startswith (first_end_point ["name" ][0 :3 ]):
815- continue
816- end_node = TplgFormatter .find_connected_comp (first_end_point , node ["name" ])
817- [second_end_point .append (node ) for node in end_node ]
818- assert (len (second_end_point ) == 1 )
819- return second_end_point [0 ]
820-
821- # If there is one/more link between two pipelines, these two pipeline are interweaved.
822- # eg. PCM0P and PCM6C in echo reference topology: sof-tgl-max98357a-rt5682.tplg.
823- # PCM0P and PCM0C in DSM topology: sof-tgl-mas98373-rt5682.tplg.
824- # Return example:
825- # {"name":['PCM0C', 'PCM0P'], "sname":['Low Latency Playback 0', 'Passthrough Capture 6'] 'smart_amp':'SMART_AMP_1.0' }
826- def find_interweaved_pipeline (self , comp ):
827- head_list , node_list = self .link_graph ()
828- interweaved_list = []
829- # find all interweaved pipelines' endpoints. If two pipelines are interweaved, there should
830- # be four endpoints.
831- for head in head_list :
832- # If we can find a PCM* from a PCM*, (check sof-tgl-max98357a-rt5682.png)
833- # find a SSP* from a SSP*, (check sof-tgl-max98373-rt5682.png)
834- # or find a ALH* from a ALH*, (check sof-tgl-sdw-max98373-rt5682-2ch.png)
835- # then these two pipeline are interweaved.
836- # should only use the first three char to match.
837- endpoints = TplgFormatter .find_connected_comp (head , head ["name" ][0 :3 ])
838- # if we find the second PCM*, SSP* or ALH*, end_points should contain 2 elements,
839- # one is the referenc widget, the other is the found widget.
840- if len (endpoints ) < 2 : continue
841- endpoints_nodes = [self .find_node_by_name (widget ["name" ], node_list ) for widget in endpoints ]
842- interweaved_endpoints = []
843- # find the other two endpoints
844- for ed in endpoints_nodes :
845- second_endpoint = TplgFormatter .find_second_end_point (ed , node_list )
846- interweaved_endpoints .append (self .find_node_by_name (second_endpoint ["name" ], node_list ))
847- interweaved_endpoints .extend (endpoints_nodes )
848- interweaved_list .append (interweaved_endpoints )
849- interweaved_dict = {}
850- for interweaved_endpoints in interweaved_list :
851- comp_found = [TplgFormatter .find_connected_comp (node , comp ) for node in interweaved_endpoints ]
852- if any (comp_found ):
853- interweaved_dict ["name" ] = [node ["name" ] for node in interweaved_endpoints if node ["name" ].startswith ("PCM" )]
854- interweaved_dict ["sname" ] = [node ["widget" ]["sname" ] for node in interweaved_endpoints if node ["name" ].startswith ("PCM" )]
855- comp_name = list (set ([comp [0 ]["name" ] for comp in comp_found if comp != []]))[0 ]
856- interweaved_dict [comp ] = comp_name
857- return interweaved_dict
858-
859806if __name__ == "__main__" :
860807 warnings .warn ("tplgtool.py is deprecated, use tplgtool2.py instead." , DeprecationWarning )
861808
0 commit comments