ALSA: hda - Fix conflicting volume controls on ALC260
ALC260 auto-parsing mode may create multiple controls for the same volume widget (0x08 and 0x09) depending on the pin. For example, Front and Headphone volumes may control the same volume, just the latter one wins. This patch adds a proper check of the existing of the volume control and avoid the doulbed creation of the same volume controls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
ec4e86ba06
Коммит
863b45180e
|
@ -4996,7 +4996,7 @@ static struct hda_verb alc260_test_init_verbs[] = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
|
static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
|
||||||
const char *pfx)
|
const char *pfx, int *vol_bits)
|
||||||
{
|
{
|
||||||
hda_nid_t nid_vol;
|
hda_nid_t nid_vol;
|
||||||
unsigned long vol_val, sw_val;
|
unsigned long vol_val, sw_val;
|
||||||
|
@ -5018,10 +5018,14 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
|
||||||
} else
|
} else
|
||||||
return 0; /* N/A */
|
return 0; /* N/A */
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "%s Playback Volume", pfx);
|
if (!(*vol_bits & (1 << nid_vol))) {
|
||||||
err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
|
/* first control for the volume widget */
|
||||||
if (err < 0)
|
snprintf(name, sizeof(name), "%s Playback Volume", pfx);
|
||||||
return err;
|
err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
*vol_bits |= (1 << nid_vol);
|
||||||
|
}
|
||||||
snprintf(name, sizeof(name), "%s Playback Switch", pfx);
|
snprintf(name, sizeof(name), "%s Playback Switch", pfx);
|
||||||
err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
|
err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
@ -5035,6 +5039,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
|
||||||
{
|
{
|
||||||
hda_nid_t nid;
|
hda_nid_t nid;
|
||||||
int err;
|
int err;
|
||||||
|
int vols = 0;
|
||||||
|
|
||||||
spec->multiout.num_dacs = 1;
|
spec->multiout.num_dacs = 1;
|
||||||
spec->multiout.dac_nids = spec->private_dac_nids;
|
spec->multiout.dac_nids = spec->private_dac_nids;
|
||||||
|
@ -5042,21 +5047,22 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
|
||||||
|
|
||||||
nid = cfg->line_out_pins[0];
|
nid = cfg->line_out_pins[0];
|
||||||
if (nid) {
|
if (nid) {
|
||||||
err = alc260_add_playback_controls(spec, nid, "Front");
|
err = alc260_add_playback_controls(spec, nid, "Front", &vols);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
nid = cfg->speaker_pins[0];
|
nid = cfg->speaker_pins[0];
|
||||||
if (nid) {
|
if (nid) {
|
||||||
err = alc260_add_playback_controls(spec, nid, "Speaker");
|
err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
nid = cfg->hp_pins[0];
|
nid = cfg->hp_pins[0];
|
||||||
if (nid) {
|
if (nid) {
|
||||||
err = alc260_add_playback_controls(spec, nid, "Headphone");
|
err = alc260_add_playback_controls(spec, nid, "Headphone",
|
||||||
|
&vols);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче