Merge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/mxs', 'asoc/topic/mxs...
[sfrench/cifs-2.6.git] / sound / soc / mxs / mxs-sgtl5000.c
index 5a871f25f438f4d091b79e3fc68fe418da0ad940..2b3f2408301af2132ae09759ae96f7d73160f1a4 100644 (file)
@@ -93,6 +93,14 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
        },
 };
 
+static const struct snd_soc_dapm_widget mxs_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 struct snd_soc_card mxs_sgtl5000 = {
        .name           = "mxs_sgtl5000",
        .owner          = THIS_MODULE,
@@ -141,6 +149,18 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev)
 
        card->dev = &pdev->dev;
 
+       if (of_find_property(np, "audio-routing", NULL)) {
+               card->dapm_widgets = mxs_sgtl5000_dapm_widgets;
+               card->num_dapm_widgets = ARRAY_SIZE(mxs_sgtl5000_dapm_widgets);
+
+               ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
+               if (ret) {
+                       dev_err(&pdev->dev, "failed to parse audio-routing (%d)\n",
+                               ret);
+                       return ret;
+               }
+       }
+
        ret = devm_snd_soc_register_card(&pdev->dev, card);
        if (ret) {
                if (ret != -EPROBE_DEFER)