]> err.no Git - linux-2.6/blobdiff - sound/soc/codecs/wm9712.c
Merge branch 'release-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/ak...
[linux-2.6] / sound / soc / codecs / wm9712.c
index e26cfcf0b4fc2b81be29f2361ca0aba02145bfc0..1fb7f9a7aecd63dfa6ae6c71414e3702047a5c5a 100644 (file)
@@ -22,6 +22,7 @@
 #include <sound/initval.h>
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
+#include "wm9712.h"
 
 #define WM9712_VERSION "0.4"
 
@@ -348,7 +349,7 @@ SND_SOC_DAPM_INPUT("MIC1"),
 SND_SOC_DAPM_INPUT("MIC2"),
 };
 
-static const char *audio_map[][3] = {
+static const struct snd_soc_dapm_route audio_map[] = {
        /* virtual mixer - mixes left & right channels for spk and mono */
        {"AC97 Mixer", NULL, "Left DAC"},
        {"AC97 Mixer", NULL, "Right DAC"},
@@ -426,38 +427,31 @@ static const char *audio_map[][3] = {
        {"HPOUTR", NULL, "Headphone PGA"},
        {"Headphone PGA", NULL, "Right HP Mixer"},
 
-       /* mono hp mixer */
-       {"Mono HP Mixer", NULL, "Left HP Mixer"},
-       {"Mono HP Mixer", NULL, "Right HP Mixer"},
+       /* mono mixer */
+       {"Mono Mixer", NULL, "Left HP Mixer"},
+       {"Mono Mixer", NULL, "Right HP Mixer"},
 
        /* Out3 Mux */
        {"Out3 Mux", "Left", "Left HP Mixer"},
        {"Out3 Mux", "Mono", "Phone Mixer"},
-       {"Out3 Mux", "Left + Right", "Mono HP Mixer"},
+       {"Out3 Mux", "Left + Right", "Mono Mixer"},
        {"Out 3 PGA", NULL, "Out3 Mux"},
        {"OUT3", NULL, "Out 3 PGA"},
 
        /* speaker Mux */
        {"Speaker Mux", "Speaker Mix", "Speaker Mixer"},
-       {"Speaker Mux", "Headphone Mix", "Mono HP Mixer"},
+       {"Speaker Mux", "Headphone Mix", "Mono Mixer"},
        {"Speaker PGA", NULL, "Speaker Mux"},
        {"LOUT2", NULL, "Speaker PGA"},
        {"ROUT2", NULL, "Speaker PGA"},
-
-       {NULL, NULL, NULL},
 };
 
 static int wm9712_add_widgets(struct snd_soc_codec *codec)
 {
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(wm9712_dapm_widgets); i++)
-               snd_soc_dapm_new_control(codec, &wm9712_dapm_widgets[i]);
+       snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets,
+                                 ARRAY_SIZE(wm9712_dapm_widgets));
 
-       /* set up audio path connects */
-       for (i = 0; audio_map[i][0] != NULL; i++)
-               snd_soc_dapm_connect_input(codec, audio_map[i][0],
-                                          audio_map[i][1], audio_map[i][2]);
+       snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
 
        snd_soc_dapm_new_widgets(codec);
        return 0;
@@ -538,7 +532,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream)
                SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\
                SNDRV_PCM_RATE_48000)
 
-struct snd_soc_codec_dai wm9712_dai[] = {
+struct snd_soc_dai wm9712_dai[] = {
 {
        .name = "AC97 HiFi",
        .type = SND_SOC_DAI_AC97_BUS,
@@ -595,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
 {
        if (try_warm && soc_ac97_ops.warm_reset) {
                soc_ac97_ops.warm_reset(codec->ac97);
-               if (!(ac97_read(codec, 0) & 0x8000))
+               if (ac97_read(codec, 0) == wm9712_reg[0])
                        return 1;
        }
 
        soc_ac97_ops.reset(codec->ac97);
-       if (ac97_read(codec, 0) & 0x8000)
+       if (ac97_read(codec, 0) != wm9712_reg[0])
                goto err;
        return 0;