Just to make this point stronger, with the recent support of the ES8336 codecs, we had to generate the following topologies to account for all permutations:
sof-apl-es8336-ssp0.tplg sof-apl-es8336-ssp2.tplg sof-cml-es8336-dmic2ch-ssp0.tplg sof-cml-es8336-dmic2ch-ssp2.tplg sof-cml-es8336-dmic4ch-ssp0.tplg sof-cml-es8336-dmic4ch-ssp2.tplg sof-cml-es8336-ssp0.tplg sof-cml-es8336-ssp2.tplg sof-glk-es8336-ssp0.tplg sof-glk-es8336-ssp2.tplg sof-jsl-es8336-dmic2ch-ssp0.tplg sof-jsl-es8336-dmic2ch-ssp2.tplg sof-jsl-es8336-dmic4ch-ssp0.tplg sof-jsl-es8336-dmic4ch-ssp2.tplg sof-jsl-es8336-ssp0.tplg sof-jsl-es8336-ssp2.tplg sof-tgl-es8336-dmic2ch-ssp0.tplg sof-tgl-es8336-dmic2ch-ssp2.tplg sof-tgl-es8336-dmic4ch-ssp0.tplg sof-tgl-es8336-dmic4ch-ssp2.tplg sof-tgl-es8336-ssp0.tplg sof-tgl-es8336-ssp2.tplg
All these topologies come from the same file, and generated using macros. That makes no sense to me, this should be the same topology that is remapped at run-time.
What Amadeo is explaining here is that AVS driver already addresses this too - at least in our opinion - see parse_link_formatted_string() in sound/soc/intel/avs/topology.c.
User is allowed to specify widget name as: ssp%d within the topology file, leaving kernel with responsibility to fill the missing index. And this is something I (perhaps we all) would like to see within the framework in the future.
Wow. I don't think anyone saw that concept in the code or comments....
That's not a bad idea, but is this really what the definition of SND_SOC_TPLG_TUPLE_TYPE_STRING meant?
That's a de-facto ABI or strong convention between kernel and topology, we'd probably need framework extensions to be on the safe side and deal with variability in more 'controlled' way.
In the AVS example, the 'i2s_link_mask' is used, but in practice there are cases where the information is only known by checking a package in the DSDT (baytrail), a DMI quirk, an NHLT information, etc. We should really plan for extensions with a callback into the topology parser.
In consequence, avs-driver user does NOT need to define N identical topologies. For example, SSP-test board [1] and its definition in board_selection.c [2] clearly show that all 6 SSP boards look at the exact same file. The same approach is used when speaking of other, simple i2s codecs, e.g.: rt274, rt286, rt298. Difference between rt298 on APL and GML comes down to SSP port number. Here, board_selection.c shows different prefixes (apl- vs gml-) but the reality is that both files are symlinks looking at the exact same actual topology file with ssp%d specified as widget names.
ok, but why even consider symlinks? Why not using the same topology name?
We are making things too hard for package maintainers, e.g. for SOF we released 198 topologies already, that's not sustainable.
At the same time, compound machine boards are still permitted and made use of, example being TDF8532/Dirana board for Automotive (not yet present on the list).
Really, flexibility is key here. As long as devices found on given platform are not connected or dependent on each other, there are no major objections preventing card split. Such code scales better and has good reuseability.
I don't disagree here but you combined two capabilities in one. The major simplification comes from the remapping or 'dynamic naming' to quote your code, the split is a refinement.
Thanks for all the comments so far, good discussion indeed.