diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-04-08 19:13:15 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 08:58:18 -0500 |
commit | b6fca438dde1b4c0bbdee31729871d601f287dc9 (patch) | |
tree | 4cfb7fdda1e5607cbddf8963739afbd9221e1f00 | |
parent | 8ecd9158728b846e2c13c7d81d33b4b277df1067 (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.txt | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6sl-evk-common.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6sx-sdb.dts | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-wm8962.c | 30 |
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 Required properties: - compatible : "fsl,imx-audio-wm8962" - model : The user-visible name of this sound complex -- ssi-controller : The phandle of the i.MX SSI controller +- cpu-dai : The phandle of CPU DAI - audio-codec : The phandle of the WM8962 audio codec - audio-routing : A list of the connections between audio components. Each entry is a pair of strings, the first being the connection's sink, @@ -36,7 +36,7 @@ sound { compatible = "fsl,imx6q-sabresd-wm8962", "fsl,imx-audio-wm8962"; model = "wm8962-audio"; - ssi-controller = <&ssi2>; + cpu-dai = <&ssi2>; audio-codec = <&codec>; audio-routing = "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 @@ compatible = "fsl,imx6q-sabresd-wm8962", "fsl,imx-audio-wm8962"; model = "wm8962-audio"; - ssi-controller = <&ssi2>; + cpu-dai = <&ssi2>; audio-codec = <&codec>; audio-routing = "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 @@ compatible = "fsl,imx6q-sabresd-wm8962", "fsl,imx-audio-wm8962"; model = "wm8962-audio"; - ssi-controller = <&ssi2>; + cpu-dai = <&ssi2>; audio-codec = <&codec>; audio-routing = "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 @@ compatible = "fsl,imx6q-sabresd-wm8962", "fsl,imx-audio-wm8962"; model = "wm8962-audio"; - ssi-controller = <&ssi2>; + cpu-dai = <&ssi2>; audio-codec = <&codec>; audio-routing = "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) static int imx_wm8962_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct device_node *ssi_np, *codec_np; - struct platform_device *ssi_pdev; + struct device_node *cpu_np, *codec_np; + struct platform_device *cpu_pdev; struct imx_priv *priv = &card_priv; struct i2c_client *codec_dev; struct imx_wm8962_data *data; @@ -397,6 +397,16 @@ static int imx_wm8962_probe(struct platform_device *pdev) priv->pdev = pdev; + cpu_np = of_parse_phandle(pdev->dev.of_node, "cpu-dai", 0); + if (!cpu_np) { + dev_err(&pdev->dev, "cpu dai phandle missing or invalid\n"); + ret = -EINVAL; + goto fail; + } + + if (!strstr(cpu_np->name, "ssi")) + goto audmux_bypass; + ret = of_property_read_u32(np, "mux-int-port", &int_port); if (ret) { dev_err(&pdev->dev, "mux-int-port missing or invalid\n"); @@ -433,16 +443,16 @@ static int imx_wm8962_probe(struct platform_device *pdev) return ret; } - ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0); +audmux_bypass: codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); - if (!ssi_np || !codec_np) { + if (!codec_np) { dev_err(&pdev->dev, "phandle missing or invalid\n"); ret = -EINVAL; goto fail; } - ssi_pdev = of_find_device_by_node(ssi_np); - if (!ssi_pdev) { + cpu_pdev = of_find_device_by_node(cpu_np); + if (!cpu_pdev) { dev_err(&pdev->dev, "failed to find SSI platform device\n"); ret = -EINVAL; goto fail; @@ -484,8 +494,8 @@ static int imx_wm8962_probe(struct platform_device *pdev) data->dai.stream_name = "HiFi"; data->dai.codec_dai_name = "wm8962"; data->dai.codec_of_node = codec_np; - data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev); - data->dai.platform_of_node = ssi_np; + data->dai.cpu_dai_name = dev_name(&cpu_pdev->dev); + data->dai.platform_of_node = cpu_np; data->dai.ops = &imx_hifi_ops; data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM; @@ -544,8 +554,8 @@ fail_mic: fail_hp: snd_soc_unregister_card(&data->card); fail: - if (ssi_np) - of_node_put(ssi_np); + if (cpu_np) + of_node_put(cpu_np); if (codec_np) of_node_put(codec_np); |