ASoC topology loading vs card bind

Srinivas Kandagatla srinivas.kandagatla at linaro.org
Thu Mar 18 13:04:10 CET 2021



On 17/03/2021 17:00, Amadeusz Sławiński wrote:
> On 3/17/2021 4:16 PM, Srinivas Kandagatla wrote:
>> Hi All,
>>
>> Am trying to load a FrontEnd/pcm dai definition from ASoC topology 
>> however I hit a catch 22 situation here. Topology is loaded as part of 
>> component probe() but component probe is only called as part of 
>> sound-card bind().
>>
>> Any pointers on how is this supposed to work?
>>
>>
>> Thanks,
>> srini
>>
> 
> Hi,
> 
> I would say I partially described how it works, when writing topology 
> kunit tests, here is link to cover letter:
> https://lore.kernel.org/alsa-devel/20210120152846.1703655-1-amadeuszx.slawinski@linux.intel.com/ 
> 

Thanks for the link.

> 
> To sum it up, there is no predefined order in which component and card 
> should be created. After each one of them is created ASoC tries to 
> rebind everything together and it should call component probe if 
> everything connects correctly.

Probe defer is not the issue here. All the relevant components are 
successfully probed, however the FE dais did not get chance to register 
from topology due to the below situation.

> 
> I'm not sure what problem you are seeing, but if you look at topology 
> test cases I only define BE in it, no FEs. So I guess you can look at it.
> 

This will work because BE dais are not defined in topology file.


Am trying to load FE dais from topology file along with the graph 
definition.

Ex:
Lets say we have a dai link in soundcard which has cpus->dai_name 
pointing to an FE dai ("MultiMedia1") available in topology file.

In this situation, sound card will be probed defered unless 
"MultiMedia1" dai is registered! However "MultiMedia1" dai can only be 
registered when the ASoC component("X") responsible for loading/reading 
tplg firmware is component->probed. This component("X") is only 
component->probed as part of soc_probe_link_components() during card bind.

So we are in catch 22 situation where in dai will not be registered 
because soc_probe_link_components() will not be called as dai is not 
registered.


> You can also look at skylake (sound/soc/intel/skylake) or SOF 
> (sound/soc/sof/) driver code which are real use cases of topology.
> 
> skylake and SOF code have pcm part which creates component and registers 
> probe function responsible for loading topology. Separate part are 
> machine drivers which create card (sound/soc/intel/boards).

Sure, I will dig in and see if I can find anything interesting  :-)

--srini
> 


More information about the Alsa-devel mailing list