[alsa-devel] [PATCH 4/5 v7][RFC] ASoC: ak4642: add .of_xlate_dai_name support

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Feb 25 09:57:16 CET 2013


ak4642 driver can be used from simple-card driver
which requires .of_xlate_dai_name.
This patch supports it.

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

 - .of_xlate_dai_name is on codec driver

 Documentation/devicetree/bindings/sound/ak4642.txt |    5 +++++
 sound/soc/codecs/ak4642.c                          |   11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/ak4642.txt b/Documentation/devicetree/bindings/sound/ak4642.txt
index 623d4e7..8b6df4d 100644
--- a/Documentation/devicetree/bindings/sound/ak4642.txt
+++ b/Documentation/devicetree/bindings/sound/ak4642.txt
@@ -7,10 +7,15 @@ Required properties:
   - compatible : "asahi-kasei,ak4642" or "asahi-kasei,ak4643" or "asahi-kasei,ak4648"
   - reg : The chip select number on the I2C bus
 
+Optional
+
+  #sound-dai-cells : enable DAI specifier, it must be 0
+
 Example:
 
 &i2c {
 	ak4648: ak4648 at 0x12 {
+		#sound-dai-cells = <0>;
 		compatible = "asahi-kasei,ak4642";
 		reg = <0x12>;
 	};
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index c78794d..5772af1 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -485,6 +485,15 @@ static int ak4642_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+static int ak4642_of_xlate_dai_name(struct snd_soc_codec *codec,
+				    struct of_phandle_args *spec,
+				    const char **dai_name)
+{
+	*dai_name = ak4642_dai.name;
+
+	return 0;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
 	.probe			= ak4642_probe,
 	.remove			= ak4642_remove,
@@ -497,6 +506,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
 	.num_dapm_widgets	= ARRAY_SIZE(ak4642_dapm_widgets),
 	.dapm_routes		= ak4642_intercon,
 	.num_dapm_routes	= ARRAY_SIZE(ak4642_intercon),
+	.of_xlate_dai_name	= ak4642_of_xlate_dai_name,
 };
 
 static struct snd_soc_codec_driver soc_codec_dev_ak4648 = {
@@ -511,6 +521,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4648 = {
 	.num_dapm_widgets	= ARRAY_SIZE(ak4642_dapm_widgets),
 	.dapm_routes		= ak4642_intercon,
 	.num_dapm_routes	= ARRAY_SIZE(ak4642_intercon),
+	.of_xlate_dai_name	= ak4642_of_xlate_dai_name,
 };
 
 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
-- 
1.7.9.5



More information about the Alsa-devel mailing list