Commit c96f0bf4 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Create individual mute switches for shared DAC

Even if the outputs are using shared DACs, we can still create individual
mute siwtches since they are assigned per pin.  This allows to create,
e.g. Speaker and Bass Speaker mute switches while the single volume is
used for these outputs.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 5803a326
...@@ -3717,41 +3717,31 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, ...@@ -3717,41 +3717,31 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0); return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
} }
if (dacs[num_pins - 1]) {
/* OK, we have a multi-output system with individual volumes */
for (i = 0; i < num_pins; i++) {
if (num_pins >= 3) {
snprintf(name, sizeof(name), "%s %s",
pfx, channel_name[i]);
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
name, 0);
} else {
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
pfx, i);
}
if (err < 0)
return err;
}
return 0;
}
/* Let's create a bind-controls */
ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_sw);
if (!ctl)
return -ENOMEM;
n = 0;
for (i = 0; i < num_pins; i++) { for (i = 0; i < num_pins; i++) {
if (get_wcaps(codec, pins[i]) & AC_WCAP_OUT_AMP) hda_nid_t dac;
ctl->values[n++] = if (dacs[num_pins - 1])
HDA_COMPOSE_AMP_VAL(pins[i], 3, 0, HDA_OUTPUT); dac = dacs[i]; /* with individual volumes */
} else
if (n) { dac = 0;
snprintf(name, sizeof(name), "%s Playback Switch", pfx); if (num_pins == 2 && i == 1 && !strcmp(pfx, "Speaker")) {
err = add_control(spec, ALC_CTL_BIND_SW, name, 0, (long)ctl); err = alc_auto_create_extra_out(codec, pins[i], dac,
"Bass Speaker", 0);
} else if (num_pins >= 3) {
snprintf(name, sizeof(name), "%s %s",
pfx, channel_name[i]);
err = alc_auto_create_extra_out(codec, pins[i], dac,
name, 0);
} else {
err = alc_auto_create_extra_out(codec, pins[i], dac,
pfx, i);
}
if (err < 0) if (err < 0)
return err; return err;
} }
if (dacs[num_pins - 1])
return 0;
/* Let's create a bind-controls for volumes */
ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_vol); ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_vol);
if (!ctl) if (!ctl)
return -ENOMEM; return -ENOMEM;
......
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