On Wed, 2021-07-07 at 10:19 +0900, Kuninori Morimoto wrote:
Hi Robert
Thank you for your reporting
asoc-simple-card irxs-audio: parse error -22 asoc-simple-card: probe of irxs-audio failed with error -22
(snip)
Inside snd_soc_get_dai_name, snd_soc_component_of_xlate_dai_name is called and returns -ENOTSUPP, so we fall into the if block and end up failing out here:
if (id < 0 || id >= pos->num_dai) { ret = -EINVAL; continue; }
Platform support was added to simple-audio-card by someone (I forgot detail), and I have never use it unfortunately. But in my quick check, the purpose of asoc_simple_parse_platform() is setup dlc->of_node
asoc_simple_parse_dai(...) { ... => dlc->of_node = args.np; ... }
and it will be checked at asoc_simple_canonicalize_platform()
asoc_simple_canonicalize_platform(...) { /* Assumes platform == cpu */ => if (!dai_link->platforms->of_node) => dai_link->platforms->of_node = dai_link->cpus->of_node; ... }
and will be used at soc-core
(A) soc_dai_link_sanity_check(...) { ... for_each_link_platforms(link, i, platform) { => if (!!platform->name == !!platform->of_node) { ... }
snd_soc_add_pcm_runtime(...) { ... (A) ret = soc_dai_link_sanity_check(); ...
for_each_link_cpus(dai_link, i, cpu) {
(X) asoc_rtd_to_cpu(rtd, i) = snd_soc_find_dai(cpu); ... }
for_each_link_codecs(dai_link, i, codec) {
(X) asoc_rtd_to_codec(rtd, i) = snd_soc_find_dai(codec); ... }
for_each_link_platforms(dai_link, i, platform) {
(Y) for_each_component(component) { => if (!snd_soc_is_matching_component(platform, component)) ... }
But, at snd_soc_add_pcm_runtime(), CPU/Codec needs of_node and DAI name (= X) Platform needs of_node (= Y)
So maybe (I didn't confirm) for platform, asoc_simple_parse_dai() don't need to call snd_soc_of_get_dai_name() ?
I think you're probably right - I made a change to basically ignore a failure of snd_soc_of_get_dai_name in the platform case and the driver seems to probe OK. Possibly it should just skip the call entirely and not even try to populate the name for platform if it's never needed?
I have some other issues to work through to try and get a working setup, but once I get things working in my test setup I can put a patch together.