aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-02-21 06:12:57 -0500
committerTakashi Iwai <tiwai@suse.de>2012-02-21 06:12:57 -0500
commitc96f0bf4adc0663a69cdb0e2b73d33e6be312d1c (patch)
treea5bc38fa308883514df5af18b881f5abdf0cb339 /sound/pci
parent5803a326465e38ee3cab8badbd8947732a8277f5 (diff)
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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 997cc8127a08..3cedb26f9cf5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3717,41 +3717,31 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
3717 return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0); 3717 return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
3718 } 3718 }
3719 3719
3720 if (dacs[num_pins - 1]) {
3721 /* OK, we have a multi-output system with individual volumes */
3722 for (i = 0; i < num_pins; i++) {
3723 if (num_pins >= 3) {
3724 snprintf(name, sizeof(name), "%s %s",
3725 pfx, channel_name[i]);
3726 err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3727 name, 0);
3728 } else {
3729 err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3730 pfx, i);
3731 }
3732 if (err < 0)
3733 return err;
3734 }
3735 return 0;
3736 }
3737
3738 /* Let's create a bind-controls */
3739 ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_sw);
3740 if (!ctl)
3741 return -ENOMEM;
3742 n = 0;
3743 for (i = 0; i < num_pins; i++) { 3720 for (i = 0; i < num_pins; i++) {
3744 if (get_wcaps(codec, pins[i]) & AC_WCAP_OUT_AMP) 3721 hda_nid_t dac;
3745 ctl->values[n++] = 3722 if (dacs[num_pins - 1])
3746 HDA_COMPOSE_AMP_VAL(pins[i], 3, 0, HDA_OUTPUT); 3723 dac = dacs[i]; /* with individual volumes */
3747 } 3724 else
3748 if (n) { 3725 dac = 0;
3749 snprintf(name, sizeof(name), "%s Playback Switch", pfx); 3726 if (num_pins == 2 && i == 1 && !strcmp(pfx, "Speaker")) {
3750 err = add_control(spec, ALC_CTL_BIND_SW, name, 0, (long)ctl); 3727 err = alc_auto_create_extra_out(codec, pins[i], dac,
3728 "Bass Speaker", 0);
3729 } else if (num_pins >= 3) {
3730 snprintf(name, sizeof(name), "%s %s",
3731 pfx, channel_name[i]);
3732 err = alc_auto_create_extra_out(codec, pins[i], dac,
3733 name, 0);
3734 } else {
3735 err = alc_auto_create_extra_out(codec, pins[i], dac,
3736 pfx, i);
3737 }
3751 if (err < 0) 3738 if (err < 0)
3752 return err; 3739 return err;
3753 } 3740 }
3741 if (dacs[num_pins - 1])
3742 return 0;
3754 3743
3744 /* Let's create a bind-controls for volumes */
3755 ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_vol); 3745 ctl = new_bind_ctl(codec, num_pins, &snd_hda_bind_vol);
3756 if (!ctl) 3746 if (!ctl)
3757 return -ENOMEM; 3747 return -ENOMEM;