ASoC: pxa: Add .owner to struct snd_soc_card
[linux-2.6-block.git] / sound / soc / samsung / littlemill.c
index d2a44ab3c207309ba680e0e3747d41b0d07425c4..5cea59beec9f6c6d664855ee186df7c2e8df809b 100644 (file)
@@ -147,15 +147,28 @@ static struct snd_soc_dai_link littlemill_dai[] = {
 
 static struct snd_soc_dapm_widget widgets[] = {
        SND_SOC_DAPM_HP("Headphone", NULL),
+
+       SND_SOC_DAPM_MIC("AMIC", NULL),
+       SND_SOC_DAPM_MIC("DMIC", NULL),
 };
 
 static struct snd_soc_dapm_route audio_paths[] = {
        { "Headphone", NULL, "HPOUT1L" },
        { "Headphone", NULL, "HPOUT1R" },
+
+       { "AMIC", NULL, "MICBIAS1" },   /* Default for AMICBIAS jumper */
+       { "IN1LN", NULL, "AMIC" },
+
+       { "DMIC", NULL, "MICBIAS2" },   /* Default for DMICBIAS jumper */
+       { "DMIC1DAT", NULL, "DMIC" },
+       { "DMIC2DAT", NULL, "DMIC" },
 };
 
+static struct snd_soc_jack littlemill_headset;
+
 static int littlemill_late_probe(struct snd_soc_card *card)
 {
+       struct snd_soc_codec *codec = card->rtd[0].codec;
        struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
        int ret;
 
@@ -164,6 +177,18 @@ static int littlemill_late_probe(struct snd_soc_card *card)
        if (ret < 0)
                return ret;
 
+       ret = snd_soc_jack_new(codec, "Headset",
+                              SND_JACK_HEADSET | SND_JACK_MECHANICAL |
+                              SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+                              SND_JACK_BTN_2 | SND_JACK_BTN_3 |
+                              SND_JACK_BTN_4 | SND_JACK_BTN_5,
+                              &littlemill_headset);
+       if (ret)
+               return ret;
+
+       /* This will check device compatibility itself */
+       wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL);
+
        return 0;
 }