Skip to contentSkip to conversation

ASoC: make snd_soc_dai_link more symmetrical

PATCH In review Jean-Francois Moine 2 participants 4 messages Dec 12, 2013 – Jan 1, 2014

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

PATCH 1/1 ASoC: make snd_soc_dai_link more symmetrical

This patch renders optional the CODEC name / OF node on sound card register, as it is done for the CPU side, in the case the CODEC DAI name is unique.

This simplifies the definition of CODECs with multiple DAIs, especially in DTs, while keeping compatibility.

---
 include/sound/soc.h  |  6 ++++--
 sound/soc/soc-core.c | 73 ++++++++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 51 insertions(+), 28 deletions(-)
include/sound/soc.h +4 -2
index 1f741cb..67c382e 100644
@@ -852,8 +852,10 @@ struct snd_soc_dai_link {
 	 */
 	const char *cpu_dai_name;
 	/*
-	 * You MUST specify the link's codec, either by device name, or by
-	 * DT/OF node, but not both.
+	 * You MAY specify the link's codec, either by device name, or by
+	 * DT/OF node, but not both. If this information is omitted,
+	 * the CODEC DAI is matched using .codec_dai_name only, which hence
+	 * must be globally unique.
 	 */
 	const char *codec_name;
 	const struct device_node *codec_of_node;
sound/soc/soc-core.c +47 -26

99 lines not on this page · raw message

Signature · 6 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer
#1 lore raw
Quoted 5 lines · Jean-Francois Moine

This patch renders optional the CODEC name / OF node on sound card register, as it is done for the CPU side, in the case the CODEC DAI name is unique.

This simplifies the definition of CODECs with multiple DAIs, especially in DTs, while keeping compatibility.

So, this is similar to one of the comments I made on the DT patch you sent today: you're saying that this makes things better but you're not saying why it makes things better. I've been sitting on this partly because I've been wanting to sit down and try to work out what the benefit is. This information should be readily avaiable and omiting it seems like it will make things more fragile.

If anything I'd expect DT to want to move towards specifying things by CODEC plus optional DAI index rather than anything else, that's the more common pattern for DT based things (really phandle plus index) and it's what the current generic card is doing.

It's possible there is a benefit I'm just not seeing but you'll need to tell me.

#2 lore raw
Quoted 15 lines · On Tue, 31 Dec 2013 16:55:33 +0000 Mark Brown <[email protected]> wrote:
Quoted 5 lines · Jean-Francois Moine

This patch renders optional the CODEC name / OF node on sound card register, as it is done for the CPU side, in the case the CODEC DAI name is unique.

This simplifies the definition of CODECs with multiple DAIs, especially in DTs, while keeping compatibility.

So, this is similar to one of the comments I made on the DT patch you sent today: you're saying that this makes things better but you're not saying why it makes things better. I've been sitting on this partly because I've been wanting to sit down and try to work out what the benefit is. This information should be readily avaiable and omiting it seems like it will make things more fragile.

Quoted 7 lines

If anything I'd expect DT to want to move towards specifying things by CODEC plus optional DAI index rather than anything else, that's the more common pattern for DT based things (really phandle plus index) and it's what the current generic card is doing.

It's possible there is a benefit I'm just not seeing but you'll need to tell me.

The first benefit I got was in the front-end definition: the codec side is the dummy codec, and this one has no phandle.

Then, finding the CODEC DAI from phandle asks for more code (of_xlate_dai_name in the CODEC drivers) and finding it from the CODEC name asks for a double loop in soc_bind_dai_link. On the other way, a simple loop without any more change may be used when the DAI is simply specified by its name. I would say that the DAI name is more meaningful than a DAI index and that it is less subject to internal changes of the CODEC driver.

Eventually, I don't think that, using only the name of the CODEC side DAI to identify it, is not more fragile than identifying the CPU side of the DAI link by its name.

Signature · 2 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
maintainer
#3 lore raw
Quoted 7 lines · Jean-Francois Moine
Quoted 2 lines · Mark Brown

It's possible there is a benefit I'm just not seeing but you'll need to tell me.

The first benefit I got was in the front-end definition: the codec side is the dummy codec, and this one has no phandle.

That's a sign that you're putting Linux implementation details into your DT - remember, DT is supposed to be implementation neutral.

Quoted 2 lines

Then, finding the CODEC DAI from phandle asks for more code (of_xlate_dai_name in the CODEC drivers) and finding it from the CODEC

They should be able to use a default there; I'd expect that just to be making the IDs the same as the index into the array or the ID field.

Quoted 3 lines

name asks for a double loop in soc_bind_dai_link. On the other way, a simple loop without any more change may be used when the DAI is simply specified by its name. I would say that the DAI name is more meaningful

Then as soon as anything else starts using the same name for some reason the binding stops being useful.

Quoted 2 lines

than a DAI index and that it is less subject to internal changes of the CODEC driver.

Obviously the numbers that get assigned become a part of the ABI and can't be changed. Now that we have preprocessor support for DT the plain text can be done with that, though for a lot of devices that won't be needed as the devices are just numbered anyway.

Quoted 3 lines

Eventually, I don't think that, using only the name of the CODEC side DAI to identify it, is not more fragile than identifying the CPU side of the DAI link by its name.

This doesn't mean it's a good idea to do it - as you will remember I said I expected things to want to go more towards using phandle plus ID for everything.