Commit bcb55067 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Fix stereo mutes on Surround volume control

AC97 Codec
Fix stereo mutes on Surround volume control.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 715e5683
......@@ -1184,7 +1184,7 @@ snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97
/*
* create mute switch(es) for normal stereo controls
*/
static int snd_ac97_cmute_new(snd_card_t *card, char *name, int reg, ac97_t *ac97)
static int snd_ac97_cmute_new_stereo(snd_card_t *card, char *name, int reg, int check_stereo, ac97_t *ac97)
{
snd_kcontrol_t *kctl;
int err;
......@@ -1195,7 +1195,7 @@ static int snd_ac97_cmute_new(snd_card_t *card, char *name, int reg, ac97_t *ac9
mute_mask = 0x8000;
val = snd_ac97_read(ac97, reg);
if (ac97->flags & AC97_STEREO_MUTES) {
if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) {
/* check whether both mute bits work */
val1 = val | 0x8080;
snd_ac97_write(ac97, reg, val1);
......@@ -1253,7 +1253,7 @@ static int snd_ac97_cvol_new(snd_card_t *card, char *name, int reg, unsigned int
/*
* create a mute-switch and a volume for normal stereo/mono controls
*/
static int snd_ac97_cmix_new(snd_card_t *card, const char *pfx, int reg, ac97_t *ac97)
static int snd_ac97_cmix_new_stereo(snd_card_t *card, const char *pfx, int reg, int check_stereo, ac97_t *ac97)
{
int err;
char name[44];
......@@ -1264,7 +1264,7 @@ static int snd_ac97_cmix_new(snd_card_t *card, const char *pfx, int reg, ac97_t
if (snd_ac97_try_bit(ac97, reg, 15)) {
sprintf(name, "%s Switch", pfx);
if ((err = snd_ac97_cmute_new(card, name, reg, ac97)) < 0)
if ((err = snd_ac97_cmute_new_stereo(card, name, reg, check_stereo, ac97)) < 0)
return err;
}
check_volume_resolution(ac97, reg, &lo_max, &hi_max);
......@@ -1276,6 +1276,8 @@ static int snd_ac97_cmix_new(snd_card_t *card, const char *pfx, int reg, ac97_t
return 0;
}
#define snd_ac97_cmix_new(card, pfx, reg, ac97) snd_ac97_cmix_new_stereo(card, pfx, reg, 0, ac97)
#define snd_ac97_cmute_new(card, name, reg, ac97) snd_ac97_cmute_new_stereo(card, name, reg, 0, ac97)
static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97);
......@@ -1326,7 +1328,8 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
/* build surround controls */
if (snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER)) {
if ((err = snd_ac97_cmix_new(card, "Surround Playback", AC97_SURROUND_MASTER, ac97)) < 0)
/* 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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment