Skip to contentSkip to conversation

ASoC: simple-card: Add multi-CODEC support

PATCH Superseded Jean-Francois Moine 2 participants 8 messages Nov 8, 2014 – Nov 10, 2014

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover ASoC: simple-card: Add multi-CODEC support

This patch set adds multi-CODEC support to the simple card.

v4: (Mark Brown)
- document the new core function
- calculation of the number of codecs moved to the core function
- split the patch about simple-card.c
- less code changes
- remove the cast of pointers
- less changes in the DT binding example 2
v3: rebase on broonie git 2014/11/03
v2: accept list of CODECs in 'sound-dais' (Benoit Cousson)

Jean-Francois Moine (4):
ASoC: core: add multi-codec support in DT
ASoC: simple-card: Remove useless function argument
ASoC: simple-card: add multi-CODECs in DT
ASoC: simple-card: Remove useless check

 .../devicetree/bindings/sound/simple-card.txt      |  20 ++--
 include/sound/soc.h                                |   3 +
 sound/soc/generic/simple-card.c                    |  87 ++++++++--------
 sound/soc/soc-core.c                               | 113 ++++++++++++++++++---
 4 files changed, 154 insertions(+), 69 deletions(-)
Signature · 6 lines
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v4 1/4 ASoC: core: add multi-codec support in DT

SoC audio cards may have many CODECs per DAI link.

This patch exports a core function handling such links in the DT (as: "sound-dais = <&hdmi 0>, <&spdif_codec>;") and creating a CODEC component array in the DAI link.

---
 include/sound/soc.h  |   3 ++
 sound/soc/soc-core.c | 113 ++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 101 insertions(+), 15 deletions(-)
include/sound/soc.h +3 -0
index 405f967..0f4f895 100644
@@ -1451,6 +1451,9 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 				     struct device_node **framemaster);
 int snd_soc_of_get_dai_name(struct device_node *of_node,
 			    const char **dai_name);
+int snd_soc_of_get_dai_link_codecs(struct device *dev,
+				   struct device_node *of_node,
+				   struct snd_soc_dai_link *dai_link);
 
 #include <sound/soc-dai.h>
 
sound/soc/soc-core.c +98 -15

146 lines not on this page · raw message

Signature · 1 line
2.1.3
#2 lore raw

PATCH v4 2/4 ASoC: simple-card: Remove useless function argument

In reply to Jean-Francois Moine

The device node pointer 'cpu' is not used in the function asoc_simple_card_parse_daifmt().

---
 sound/soc/generic/simple-card.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/generic/simple-card.c +1 -2
index 3e3fec4..ece22d5 100644
@@ -232,7 +232,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 
 static int asoc_simple_card_parse_daifmt(struct device_node *node,
 					 struct simple_card_data *priv,
-					 struct device_node *cpu,
 					 struct device_node *codec,
 					 char *prefix, int idx)
 {
@@ -309,7 +308,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	}
 
 	ret = asoc_simple_card_parse_daifmt(node, priv,
-					    cpu, codec, prefix, idx);
+					    codec, prefix, idx);
 	if (ret < 0)
 		goto dai_link_of_err;
 
Signature · 1 line
2.1.3
#3 lore raw

PATCH v4 3/4 ASoC: simple-card: add multi-CODECs in DT

In reply to Jean-Francois Moine

This patch allows many CODECs per link to be defined in the device tree.

---
 .../devicetree/bindings/sound/simple-card.txt      | 20 ++----
 sound/soc/generic/simple-card.c                    | 81 ++++++++++++----------
 2 files changed, 53 insertions(+), 48 deletions(-)
Documentation/devicetree/bindings/sound/simple-card.txt +7 -13
index c3cba60..debe35c 100644
@@ -65,7 +65,10 @@ properties should also be placed in the codec node if needed.
 
 Required CPU/CODEC subnodes properties:
 
-- sound-dai				: phandle and port of CPU/CODEC
+either
+  - sound-dai				: phandle and port of CPU/CODEC
+or
+  - sound-dais				: list of phandle and port of CODECs
 
 Optional CPU/CODEC subnodes properties:
 
@@ -119,7 +122,7 @@ sh_fsi2: sh_fsi2@ec230000 {
 	interrupts = <0 146 0x4>;
 };
 
-Example 2 - many DAI links:
+Example 2 - many DAI links and multi-CODECs:
 
 sound {
 	compatible = "simple-audio-card";
@@ -135,21 +138,12 @@ sound {
 		};
 	};
 
-	simple-audio-card,dai-link@1 {		/* S/PDIF - HDMI */
+	simple-audio-card,dai-link@1 {		/* S/PDIF - HDMI & S/PDIF */
 		cpu {
 			sound-dai = <&audio1 1>;
 		};
 		codec {
-			sound-dai = <&tda998x 1>;
-		};
-	};
-
-	simple-audio-card,dai-link@2 {		/* S/PDIF - S/PDIF */
-		cpu {
-			sound-dai = <&audio1 1>;
-		};
-		codec {
-			sound-dai = <&spdif_codec>;
+			sound-dais = <&tda998x 1>, <&spdif_codec>;
 		};
 	};
 };
sound/soc/generic/simple-card.c +46 -35

151 lines not on this page · raw message

Signature · 1 line
2.1.3
#4 lore raw

Re: [PATCH v4 3/4] ASoC: simple-card: add multi-CODECs in DT

Documentation/devicetree/bindings/sound/simple-card.txt properties should also be placed in the codec node if needed. · line 71

Quoted 5 lines · On Sunday 09 November 2014 12:22:21 Jean-Francois Moine wrote:

-- sound-dai : phandle and port of CPU/CODEC

Documentation/devicetree/bindings/sound/simple-card.txt +4 -0
+either
+  - sound-dai                          : phandle and port of CPU/CODEC
+or
+  - sound-dais                         : list of phandle and port of CODECs

Is it really necessary to change the property name here? I woudl think that you can make it all work more consistently with just the existing 'sound-dai' property, just extend it to allow multiple codecs

Arnd

#5 lore raw

Re: [PATCH v4 3/4] ASoC: simple-card: add multi-CODECs in DT

Quoted 10 lines · On Mon, 10 Nov 2014 09:39:57 +0100 Arnd Bergmann <[email protected]> wrote:

Documentation/devicetree/bindings/sound/simple-card.txt properties should also be placed in the codec node if needed. · line 71

Quoted 5 lines · On Sunday 09 November 2014 12:22:21 Jean-Francois Moine wrote:

-- sound-dai : phandle and port of CPU/CODEC

Documentation/devicetree/bindings/sound/simple-card.txt +4 -0
+either
+  - sound-dai                          : phandle and port of CPU/CODEC
+or
+  - sound-dais                         : list of phandle and port of CODECs

Is it really necessary to change the property name here? I woudl think that you can make it all work more consistently with just the existing 'sound-dai' property, just extend it to allow multiple codecs

This was an idea from Benoit Cousson:

"Something like that:

   sound-dais = <&spdif_codec 1>, <&hdmi 0>;

That being said, it will require changing the name with a plural form,"

As I coded it, both names are accepted for a single or many codecs.

Signature · 2 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
#6 lore raw

Re: [PATCH v4 3/4] ASoC: simple-card: add multi-CODECs in DT

Quoted 16 lines · On Monday 10 November 2014 10:05:26 Jean-Francois Moine wrote:
Quoted 10 lines · On Mon, 10 Nov 2014 09:39:57 +0100 Arnd Bergmann <[email protected]> wrote:

Documentation/devicetree/bindings/sound/simple-card.txt properties should also be placed in the codec node if needed. · line 71

Quoted 5 lines · On Sunday 09 November 2014 12:22:21 Jean-Francois Moine wrote:

-- sound-dai : phandle and port of CPU/CODEC

Documentation/devicetree/bindings/sound/simple-card.txt +4 -0
+either
+  - sound-dai                          : phandle and port of CPU/CODEC
+or
+  - sound-dais                         : list of phandle and port of CODECs

Is it really necessary to change the property name here? I woudl think that you can make it all work more consistently with just the existing 'sound-dai' property, just extend it to allow multiple codecs

This was an idea from Benoit Cousson:

Quoted 7 lines

"Something like that:

   sound-dais = <&spdif_codec 1>, <&hdmi 0>;

That being said, it will require changing the name with a plural form,"

As I coded it, both names are accepted for a single or many codecs.

I don't see a strong reason for coming up with a plural form. If you really have to, then please list the old form as a deprecated alias and make the document talk about "sound-dais" as the preferred form independent of the number of arguments.

Arnd

#7 lore raw

PATCH v4 4/4 ASoC: simple-card: Remove useless check

In reply to Jean-Francois Moine

The CPU and CODEC names are checked when getting the DAI names. There is no need to check them once more.

---
 sound/soc/generic/simple-card.c | 5 -----
 1 file changed, 5 deletions(-)
sound/soc/generic/simple-card.c +0 -5
index 61f9500..c1ba78b 100644
@@ -319,11 +319,6 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-		ret = -EINVAL;
-		goto dai_link_of_err;
-	}
-
 	/* Simple Card assumes platform == cpu */
 	dai_link->platform_of_node = dai_link->cpu_of_node;
 
Signature · 1 line
2.1.3