aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <Guangyu.Chen@freescale.com>2014-04-08 07:13:15 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:58:18 -0400
commitb6fca438dde1b4c0bbdee31729871d601f287dc9 (patch)
tree4cfb7fdda1e5607cbddf8963739afbd9221e1f00
parent8ecd9158728b846e2c13c7d81d33b4b277df1067 (diff)
ENGR00307635-5 ASoC: imx-wm8962: Add non-SSI cpu dai support
The current imx-wm8962 machine driver is designed for SSI as CPU DAI only while as its name we should make the driver more generic to any other CPU DAI on i.MX serires -- ESAI, SAI for example. So this patch makes the driver more general so as to support those non-SSI cases. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
-rw-r--r--Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt4
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6sl-evk-common.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts2
-rw-r--r--sound/soc/fsl/imx-wm8962.c30
5 files changed, 25 insertions, 15 deletions
diff --git a/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt b/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt
index 5d4222e72585..fe1e119d7572 100644
--- a/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt
+++ b/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt
@@ -3,7 +3,7 @@ Freescale i.MX audio complex with WM8962 codec
3Required properties: 3Required properties:
4- compatible : "fsl,imx-audio-wm8962" 4- compatible : "fsl,imx-audio-wm8962"
5- model : The user-visible name of this sound complex 5- model : The user-visible name of this sound complex
6- ssi-controller : The phandle of the i.MX SSI controller 6- cpu-dai : The phandle of CPU DAI
7- audio-codec : The phandle of the WM8962 audio codec 7- audio-codec : The phandle of the WM8962 audio codec
8- audio-routing : A list of the connections between audio components. 8- audio-routing : A list of the connections between audio components.
9 Each entry is a pair of strings, the first being the connection's sink, 9 Each entry is a pair of strings, the first being the connection's sink,
@@ -36,7 +36,7 @@ sound {
36 compatible = "fsl,imx6q-sabresd-wm8962", 36 compatible = "fsl,imx6q-sabresd-wm8962",
37 "fsl,imx-audio-wm8962"; 37 "fsl,imx-audio-wm8962";
38 model = "wm8962-audio"; 38 model = "wm8962-audio";
39 ssi-controller = <&ssi2>; 39 cpu-dai = <&ssi2>;
40 audio-codec = <&codec>; 40 audio-codec = <&codec>;
41 audio-routing = 41 audio-routing =
42 "Headphone Jack", "HPOUTL", 42 "Headphone Jack", "HPOUTL",
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 9cd552f9a01a..100b9c8364d4 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -129,7 +129,7 @@
129 compatible = "fsl,imx6q-sabresd-wm8962", 129 compatible = "fsl,imx6q-sabresd-wm8962",
130 "fsl,imx-audio-wm8962"; 130 "fsl,imx-audio-wm8962";
131 model = "wm8962-audio"; 131 model = "wm8962-audio";
132 ssi-controller = <&ssi2>; 132 cpu-dai = <&ssi2>;
133 audio-codec = <&codec>; 133 audio-codec = <&codec>;
134 audio-routing = 134 audio-routing =
135 "Headphone Jack", "HPOUTL", 135 "Headphone Jack", "HPOUTL",
diff --git a/arch/arm/boot/dts/imx6sl-evk-common.dtsi b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
index 0eb42954e80d..38be901cbac2 100644
--- a/arch/arm/boot/dts/imx6sl-evk-common.dtsi
+++ b/arch/arm/boot/dts/imx6sl-evk-common.dtsi
@@ -90,7 +90,7 @@
90 compatible = "fsl,imx6q-sabresd-wm8962", 90 compatible = "fsl,imx6q-sabresd-wm8962",
91 "fsl,imx-audio-wm8962"; 91 "fsl,imx-audio-wm8962";
92 model = "wm8962-audio"; 92 model = "wm8962-audio";
93 ssi-controller = <&ssi2>; 93 cpu-dai = <&ssi2>;
94 audio-codec = <&codec>; 94 audio-codec = <&codec>;
95 audio-routing = 95 audio-routing =
96 "Headphone Jack", "HPOUTL", 96 "Headphone Jack", "HPOUTL",
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 57046d179c7a..d4e68ededd3e 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -122,7 +122,7 @@
122 compatible = "fsl,imx6q-sabresd-wm8962", 122 compatible = "fsl,imx6q-sabresd-wm8962",
123 "fsl,imx-audio-wm8962"; 123 "fsl,imx-audio-wm8962";
124 model = "wm8962-audio"; 124 model = "wm8962-audio";
125 ssi-controller = <&ssi2>; 125 cpu-dai = <&ssi2>;
126 audio-codec = <&codec>; 126 audio-codec = <&codec>;
127 audio-routing = 127 audio-routing =
128 "Headphone Jack", "HPOUTL", 128 "Headphone Jack", "HPOUTL",
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 2776a08370c0..66cb2df64032 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -386,8 +386,8 @@ static int imx_wm8962_late_probe(struct snd_soc_card *card)
386static int imx_wm8962_probe(struct platform_device *pdev) 386static int imx_wm8962_probe(struct platform_device *pdev)
387{ 387{
388 struct device_node *np = pdev->dev.of_node; 388 struct device_node *np = pdev->dev.of_node;
389 struct device_node *ssi_np, *codec_np; 389 struct device_node *cpu_np, *codec_np;
390 struct platform_device *ssi_pdev; 390 struct platform_device *cpu_pdev;
391 struct imx_priv *priv = &card_priv; 391 struct imx_priv *priv = &card_priv;
392 struct i2c_client *codec_dev; 392 struct i2c_client *codec_dev;
393 struct imx_wm8962_data *data; 393 struct imx_wm8962_data *data;
@@ -397,6 +397,16 @@ static int imx_wm8962_probe(struct platform_device *pdev)
397 397
398 priv->pdev = pdev; 398 priv->pdev = pdev;
399 399
400 cpu_np = of_parse_phandle(pdev->dev.of_node, "cpu-dai", 0);
401 if (!cpu_np) {
402 dev_err(&pdev->dev, "cpu dai phandle missing or invalid\n");
403 ret = -EINVAL;
404 goto fail;
405 }
406
407 if (!strstr(cpu_np->name, "ssi"))
408 goto audmux_bypass;
409
400 ret = of_property_read_u32(np, "mux-int-port", &int_port); 410 ret = of_property_read_u32(np, "mux-int-port", &int_port);
401 if (ret) { 411 if (ret) {
402 dev_err(&pdev->dev, "mux-int-port missing or invalid\n"); 412 dev_err(&pdev->dev, "mux-int-port missing or invalid\n");
@@ -433,16 +443,16 @@ static int imx_wm8962_probe(struct platform_device *pdev)
433 return ret; 443 return ret;
434 } 444 }
435 445
436 ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0); 446audmux_bypass:
437 codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); 447 codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
438 if (!ssi_np || !codec_np) { 448 if (!codec_np) {
439 dev_err(&pdev->dev, "phandle missing or invalid\n"); 449 dev_err(&pdev->dev, "phandle missing or invalid\n");
440 ret = -EINVAL; 450 ret = -EINVAL;
441 goto fail; 451 goto fail;
442 } 452 }
443 453
444 ssi_pdev = of_find_device_by_node(ssi_np); 454 cpu_pdev = of_find_device_by_node(cpu_np);
445 if (!ssi_pdev) { 455 if (!cpu_pdev) {
446 dev_err(&pdev->dev, "failed to find SSI platform device\n"); 456 dev_err(&pdev->dev, "failed to find SSI platform device\n");
447 ret = -EINVAL; 457 ret = -EINVAL;
448 goto fail; 458 goto fail;
@@ -484,8 +494,8 @@ static int imx_wm8962_probe(struct platform_device *pdev)
484 data->dai.stream_name = "HiFi"; 494 data->dai.stream_name = "HiFi";
485 data->dai.codec_dai_name = "wm8962"; 495 data->dai.codec_dai_name = "wm8962";
486 data->dai.codec_of_node = codec_np; 496 data->dai.codec_of_node = codec_np;
487 data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev); 497 data->dai.cpu_dai_name = dev_name(&cpu_pdev->dev);
488 data->dai.platform_of_node = ssi_np; 498 data->dai.platform_of_node = cpu_np;
489 data->dai.ops = &imx_hifi_ops; 499 data->dai.ops = &imx_hifi_ops;
490 data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | 500 data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
491 SND_SOC_DAIFMT_CBM_CFM; 501 SND_SOC_DAIFMT_CBM_CFM;
@@ -544,8 +554,8 @@ fail_mic:
544fail_hp: 554fail_hp:
545 snd_soc_unregister_card(&data->card); 555 snd_soc_unregister_card(&data->card);
546fail: 556fail:
547 if (ssi_np) 557 if (cpu_np)
548 of_node_put(ssi_np); 558 of_node_put(cpu_np);
549 if (codec_np) 559 if (codec_np)
550 of_node_put(codec_np); 560 of_node_put(codec_np);
551 561