Skip to contentSkip to conversation

ASoC: simple-card: Do not set cpu_dai.name for snd_link in case DT

PATCH In review Alexander Shiyan 2 participants 2 messages Jan 5, 2014 – Jan 7, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: simple-card: Do not set cpu_dai.name for snd_link in case DT

Using cpu_dai.name for DT case will result driver cannot be initialized. For example, device have name "ssi@10010000" in the DT and this value is returning for us by snd_soc_of_get_dai_name() but actual registered name of device is "10010000.ssi".

---
 sound/soc/generic/simple-card.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/generic/simple-card.c +2 -1
index 1d87db8..3a054c4 100644
@@ -219,7 +219,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	 */
 	cinfo->snd_link.name		= cinfo->name;
 	cinfo->snd_link.stream_name	= cinfo->name;
-	cinfo->snd_link.cpu_dai_name	= cinfo->cpu_dai.name;
+	if (!of_cpu)
+		cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name;
 	cinfo->snd_link.platform_name	= cinfo->platform;
 	cinfo->snd_link.codec_name	= cinfo->codec;
 	cinfo->snd_link.codec_dai_name	= cinfo->codec_dai.name;
Signature · 1 line
1.8.3.2
maintainer
#1 lore raw
Quoted 4 lines · Alexander Shiyan

Using cpu_dai.name for DT case will result driver cannot be initialized. For example, device have name "ssi@10010000" in the DT and this value is returning for us by snd_soc_of_get_dai_name() but actual registered name of device is "10010000.ssi".

This doesn't seem like a great fix, it will break systems that register more than one DAI per device and won't help any other machine drivers using the lookup. I'd have expected to fix either the registered name or the result of the lookup so that it can be used for matching.