]> err.no Git - linux-2.6/commitdiff
[ALSA] ac97_codec - fix duplicate control creation in AC97
authorJaya Kumar <jayakumar.alsa@gmail.com>
Mon, 12 Jun 2006 08:08:02 +0000 (10:08 +0200)
committerJaroslav Kysela <perex@suse.cz>
Thu, 22 Jun 2006 19:34:20 +0000 (21:34 +0200)
This patch conditions AC97 control creation by whether or not the
codec is an AD18xx codec. This fixes the case where the default control
would get created and then snd_ac97_mixer_build fails out when creation
of ad18xx specific control would get attempted. This problem was found
and debuged by Marcelo Tosatti.

Signed-off-by: Jaya Kumar <jayakumar.alsa@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/ac97/ac97_codec.c

index 72e33b9532f078f73d27c8b667d04b374cfb5b14..f8389c2d3e60b1444a3308e8ee87d51f3ea4368a 100644 (file)
@@ -1236,7 +1236,8 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
        ac97->regs[AC97_CENTER_LFE_MASTER] = 0x8080;
 
        /* build center controls */
-       if (snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER)) {
+       if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER)) 
+               && !(ac97->flags & AC97_AD_MULTI)) {
                if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97))) < 0)
                        return err;
                if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_center[1], ac97))) < 0)
@@ -1248,7 +1249,8 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
        }
 
        /* build LFE controls */
-       if (snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER+1)) {
+       if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER+1))
+               && !(ac97->flags & AC97_AD_MULTI)) {
                if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_lfe[0], ac97))) < 0)
                        return err;
                if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_lfe[1], ac97))) < 0)
@@ -1260,7 +1262,8 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
        }
 
        /* build surround controls */
-       if (snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER)) {
+       if ((snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER)) 
+               && !(ac97->flags & AC97_AD_MULTI)) {
                /* Surround Master (0x38) is with stereo mutes */
                if ((err = snd_ac97_cmix_new_stereo(card, "Surround Playback", AC97_SURROUND_MASTER, 1, ac97)) < 0)
                        return err;