Thread (2 messages) 2 messages, 2 authors, 2013-02-27

[PATCH 5/5 v7][RFC] ASoC: fsi: add .of_xlate_dai_name support

STALE4965d

From: Kuninori Morimoto <hidden>
Date: 2013-02-25 08:57:59
Also in: alsa-devel
Subsystem: open firmware and flattened device tree bindings, sound, sound - soc layer / dynamic audio power management (asoc), the rest · Maintainers: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Linus Torvalds

fsi driver can be used from simple-card driver
which requires .of_xlate_dai_name, and snd_soc_register_cpu()
This patch supports these.

Signed-off-by: Kuninori Morimoto <redacted>
---
v6 -> v7

 - used snd_soc_register_cpu()
 - of_xlate_dai_name is on cpu driver

 .../devicetree/bindings/sound/renesas,fsi.txt      |    9 ++++++++
 sound/soc/sh/fsi.c                                 |   22 ++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/renesas,fsi.txt b/Documentation/devicetree/bindings/sound/renesas,fsi.txt
index c5be003..a403ec1 100644
--- a/Documentation/devicetree/bindings/sound/renesas,fsi.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,fsi.txt
@@ -13,9 +13,18 @@ Required properties:
 - fsib,stream-mode-support	: same as fsia
 - fsib,use-internal-clock	: same as fsia
 
+Optional
+
+  #sound-dai-cells		: enable DAI specifier, it must be 1
+
+  Valid values for the DAI specifier are:
+  0: FSI port A
+  1: FSI port B
+
 Example:
 
 sh_fsi2: sh_fsi2@0xec230000 {
+	#sound-dai-cells = <1>;
 	compatible = "renesas,sh_fsi2";
 	reg = <0xec230000 0x400>;
 	interrupts = <0 146 0x4>;
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index c724026a..f40f731 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1886,6 +1886,24 @@ static struct snd_soc_platform_driver fsi_soc_platform = {
 	.pcm_free	= fsi_pcm_free,
 };
 
+static int fsi_of_xlate_dai_name(struct snd_soc_cpu *codec,
+				 const struct of_phandle_args *spec,
+				 const char **dai_name)
+{
+	int id = spec->args[0];
+
+	if (ARRAY_SIZE(fsi_soc_dai) <= id)
+		return -ENODEV;
+
+	*dai_name = fsi_soc_dai[id].name;
+
+	return 0;
+}
+
+static const struct snd_soc_cpu_driver fsi_soc_cpu = {
+	.of_xlate_dai_name = fsi_of_xlate_dai_name,
+};
+
 /*
  *		platform function
  */
@@ -2046,8 +2064,8 @@ static int fsi_probe(struct platform_device *pdev)
 		goto exit_fsib;
 	}
 
-	ret = snd_soc_register_dais(&pdev->dev, fsi_soc_dai,
-				    ARRAY_SIZE(fsi_soc_dai));
+	ret = snd_soc_register_cpu(&pdev->dev, &fsi_soc_cpu,
+				   fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai));
 	if (ret < 0) {
 		dev_err(&pdev->dev, "cannot snd dai register\n");
 		goto exit_snd_soc;
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help