[PATCH 2.6.17-rc5 1/1] ALSA: fix duplicate control creation in AC97

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Takashi, Jaroslav,

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.

Thanks,
Jaya Kumar

Signed-off-by: Jaya Kumar <jayakumar.alsa@xxxxxxxxx>

---
 
 ac97_codec.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

---

diff -X usbvideo.dontdiff -X cs5535audio.dontdiff -X linux-2.6.17-rc5/Documentation/dontdiff -uprN linux-2.6.17-rc5-ltv/sound/pci/ac97/ac97_codec.c linux-2.6.17-rc5/sound/pci/ac97/ac97_codec.c
--- linux-2.6.17-rc5-ltv/sound/pci/ac97/ac97_codec.c	2006-05-25 19:27:30.000000000 +0800
+++ linux-2.6.17-rc5/sound/pci/ac97/ac97_codec.c	2006-06-10 17:17:15.000000000 +0800
@@ -1226,7 +1226,8 @@ static int snd_ac97_mixer_build(struct s
 	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)
@@ -1238,7 +1239,8 @@ static int snd_ac97_mixer_build(struct s
 	}
 
 	/* 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)
@@ -1250,7 +1252,8 @@ static int snd_ac97_mixer_build(struct s
 	}
 
 	/* 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;


_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux