[alsa-devel] [PATCH v4 5/9] ASoC: soc-core: enable "dai-name" on snd_soc_of_parse_daifmt()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Mar 13 06:53:30 CET 2017


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Current snd_soc_of_parse_daifmt() detects [prefix]format, but
"format" was unclear. This patch expand it to [prefix]dai-format, too
This patch update simple-xx-card.txt which uses this feature

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v3 -> v4

 - expand format

 Documentation/devicetree/bindings/sound/simple-card.txt     | 2 +-
 Documentation/devicetree/bindings/sound/simple-scu-card.txt | 3 ++-
 sound/soc/soc-core.c                                        | 9 +++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index f34a810..6e8a8a3 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -48,7 +48,7 @@ Required dai-link subnodes:
 
 Optional dai-link subnode properties:
 
-- format				: CPU/CODEC common audio format.
+- dai-format / format			: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
 - frame-master				: Indicates dai-link frame master.
diff --git a/Documentation/devicetree/bindings/sound/simple-scu-card.txt b/Documentation/devicetree/bindings/sound/simple-scu-card.txt
index 01eb56e..47b4677 100644
--- a/Documentation/devicetree/bindings/sound/simple-scu-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-scu-card.txt
@@ -17,9 +17,10 @@ Optional properties:
 
 Optional subnode properties:
 
-- simple-audio-card,format		: CPU/CODEC common audio format.
+- simple-audio-card,dai-format		: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
+- simple-audio-card,format		: see simple-audio-card,dai-format
 - simple-audio-card,frame-master	: Indicates dai-link frame master.
 					  phandle to a cpu or codec subnode.
 - simple-audio-card,bitclock-master	: Indicates dai-link bit clock master.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6dca408..175ade0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3951,11 +3951,16 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 		prefix = "";
 
 	/*
-	 * check "[prefix]format = xxx"
+	 * check "[prefix]dai-format = xxx"
+	 * or    "[prefix]format = xxx"
 	 * SND_SOC_DAIFMT_FORMAT_MASK area
 	 */
-	snprintf(prop, sizeof(prop), "%sformat", prefix);
+	snprintf(prop, sizeof(prop), "%sdai-format", prefix);
 	ret = of_property_read_string(np, prop, &str);
+	if (ret < 0) {
+		snprintf(prop, sizeof(prop), "%sformat", prefix);
+		ret = of_property_read_string(np, prop, &str);
+	}
 	if (ret == 0) {
 		for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) {
 			if (strcmp(str, of_fmt_table[i].name) == 0) {
-- 
1.9.1



More information about the Alsa-devel mailing list