diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-03-25 20:56:18 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-09-17 08:59:21 -0500 |
commit | 63b1a4f4827e73606f4f6bc7462060ced1a5eb03 (patch) | |
tree | 703a1bea98f37d2ea7fd930338fa313cd73648ee | |
parent | 36f91320e6d13368089818332788c1e96d1cdbf5 (diff) |
ENGR00305648-1 ASoC: imx-sgtl5000: Support non-ssi cpu-dai
The current imx-sgtl5000 driver always attaches the cpu-dai to ssi while
in fact it could be attached to other cpu-dais like SAI. Thus this patch
use a general code to support another cpu-dai. And meanwhile update the
devicetree for i.MX6 Series.
Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
(cherry picked from commit cb5dfaf44d2fdbce4329c2e4762e8450c8cd3b3c)
-rw-r--r-- | Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6q-sabrelite.dts | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-sgtl5000.c | 43 |
3 files changed, 31 insertions, 18 deletions
diff --git a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt index e4acdd891e49..04bb62b20dd2 100644 --- a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt @@ -3,7 +3,7 @@ Freescale i.MX audio complex with SGTL5000 codec Required properties: - compatible : "fsl,imx-audio-sgtl5000" - 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 SGTL5000 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, @@ -38,7 +38,7 @@ sound { compatible = "fsl,imx51-babbage-sgtl5000", "fsl,imx-audio-sgtl5000"; model = "imx51-babbage-sgtl5000"; - ssi-controller = <&ssi1>; + cpu-dai = <&ssi1>; audio-codec = <&sgtl5000>; audio-routing = "MIC_IN", "Mic Jack", diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts index 9e6852bfaa33..4d9d8a84a02e 100644 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts @@ -59,7 +59,7 @@ compatible = "fsl,imx6q-sabrelite-sgtl5000", "fsl,imx-audio-sgtl5000"; model = "imx6q-sabrelite-sgtl5000"; - ssi-controller = <&ssi1>; + cpu-dai = <&ssi1>; audio-codec = <&codec>; audio-routing = "MIC_IN", "Mic Jack", diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 1cb22dd034eb..7ab525501641 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012, 2014 Freescale Semiconductor, Inc. * Copyright 2012 Linaro Ltd. * * The code contained herein is licensed under the GNU General Public @@ -55,13 +55,9 @@ static const struct snd_soc_dapm_widget imx_sgtl5000_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", NULL), }; -static int imx_sgtl5000_probe(struct platform_device *pdev) +static int imx_sgtl5000_audmux_config(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 i2c_client *codec_dev; - struct imx_sgtl5000_data *data = NULL; int int_port, ext_port; int ret; @@ -101,16 +97,33 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) return ret; } - ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0); + return 0; +} + +static int imx_sgtl5000_probe(struct platform_device *pdev) +{ + struct device_node *cpu_np, *codec_np; + struct platform_device *cpu_pdev; + struct i2c_client *codec_dev; + struct imx_sgtl5000_data *data = NULL; + int ret; + + cpu_np = of_parse_phandle(pdev->dev.of_node, "cpu-dai", 0); codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); - if (!ssi_np || !codec_np) { + if (!cpu_np || !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) { + if (strstr(cpu_np->name, "ssi")) { + ret = imx_sgtl5000_audmux_config(pdev); + if (ret) + goto fail; + } + + cpu_pdev = of_find_device_by_node(cpu_np); + if (!cpu_pdev) { dev_err(&pdev->dev, "failed to find SSI platform device\n"); ret = -EPROBE_DEFER; goto fail; @@ -139,8 +152,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) data->dai.stream_name = "HiFi"; data->dai.codec_dai_name = "sgtl5000"; data->dai.codec_of_node = codec_np; - data->dai.cpu_of_node = ssi_np; - data->dai.platform_of_node = ssi_np; + data->dai.cpu_of_node = cpu_np; + data->dai.platform_of_node = cpu_np; data->dai.init = &imx_sgtl5000_dai_init; data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM; @@ -167,7 +180,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) goto fail; } - of_node_put(ssi_np); + of_node_put(cpu_np); of_node_put(codec_np); return 0; @@ -175,8 +188,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) fail: if (data && !IS_ERR(data->codec_clk)) clk_put(data->codec_clk); - if (ssi_np) - of_node_put(ssi_np); + if (cpu_np) + of_node_put(cpu_np); if (codec_np) of_node_put(codec_np); |