]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ASoC: fsl: add audio routing for imx-sgtl5000
authorShawn Guo <shawn.guo@linaro.org>
Thu, 29 Mar 2012 16:13:03 +0000 (00:13 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 1 Apr 2012 10:28:31 +0000 (11:28 +0100)
Add DAPM widgets and audio routing support for imx-sgtl5000 machine
driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt
sound/soc/fsl/imx-sgtl5000.c

index 421a374790b3c7d199645096e41177a3d1c1c884..d09b4e31461cca3ee7c00234213db952731f77db 100644 (file)
@@ -5,6 +5,27 @@ Required properties:
 - model : The user-visible name of this sound complex
 - ssi-controller : The phandle of the i.MX SSI controller
 - 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,
+  the second being the connection's source. Valid names could be power
+  supplies, SGTL5000 pins, and the jacks on the board:
+
+  Power supplies:
+   * Mic Bias
+
+  SGTL5000 pins:
+   * MIC_IN
+   * LINE_IN
+   * HP_OUT
+   * LINE_OUT
+
+  Board connectors:
+   * Mic Jack
+   * Line In Jack
+   * Headphone Jack
+   * Line Out Jack
+   * Ext Spk
+
 - mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
 - mux-ext-port : The external port of the i.MX audio muxer
 
@@ -19,6 +40,10 @@ sound {
        model = "imx51-babbage-sgtl5000";
        ssi-controller = <&ssi1>;
        audio-codec = <&sgtl5000>;
+       audio-routing =
+               "Mic Jack", "Mic Bias",
+               "MIC_IN", "Mic Bias",
+               "Headphone Jack", "HP_OUT";
        mux-int-port = <1>;
        mux-ext-port = <3>;
 };
index 3786b61b4fea02148b22418ff94e7ce273b7f4c9..e1a7441ec1337dcba454fd6a8c2e91b732cba371 100644 (file)
@@ -45,6 +45,14 @@ static int imx_sgtl5000_dai_init(struct snd_soc_pcm_runtime *rtd)
        return 0;
 }
 
+static const struct snd_soc_dapm_widget imx_sgtl5000_dapm_widgets[] = {
+       SND_SOC_DAPM_MIC("Mic Jack", NULL),
+       SND_SOC_DAPM_LINE("Line In Jack", NULL),
+       SND_SOC_DAPM_HP("Headphone Jack", NULL),
+       SND_SOC_DAPM_SPK("Line Out Jack", NULL),
+       SND_SOC_DAPM_SPK("Ext Spk", NULL),
+};
+
 static int __devinit imx_sgtl5000_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
@@ -127,10 +135,15 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev)
 
        data->card.dev = &pdev->dev;
        ret = snd_soc_of_parse_card_name(&data->card, "model");
+       if (ret)
+               return ret;
+       ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing");
        if (ret)
                return ret;
        data->card.num_links = 1;
        data->card.dai_link = &data->dai;
+       data->card.dapm_widgets = imx_sgtl5000_dapm_widgets;
+       data->card.num_dapm_widgets = ARRAY_SIZE(imx_sgtl5000_dapm_widgets);
 
        ret = snd_soc_register_card(&data->card);
        if (ret) {