aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-02-18 07:06:49 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:12 -0400
commit49c88b85b53767f97eb8c9171cb0b976c62a0114 (patch)
treebdf175c7a17e0bd6df76d23353238331799f342b
parent1c82ed1bc531746a8fa9b46c593ddce546f28026 (diff)
[ALSA] ca0106 - Add master volume controls
Added master volume and switch controls for ca0106 using vmaster. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/Kconfig1
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c51
2 files changed, 52 insertions, 0 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 48296d97bf33..b05435cfee1e 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -162,6 +162,7 @@ config SND_CA0106
162 depends on SND 162 depends on SND
163 select SND_AC97_CODEC 163 select SND_AC97_CODEC
164 select SND_RAWMIDI 164 select SND_RAWMIDI
165 select SND_VMASTER
165 help 166 help
166 Say Y here to include support for the Sound Blaster Audigy LS 167 Say Y here to include support for the Sound Blaster Audigy LS
167 and Live 24bit. 168 and Live 24bit.
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index af736869d9b1..94618ecaab65 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -658,11 +658,47 @@ static int __devinit rename_ctl(struct snd_card *card, const char *src, const ch
658 } \ 658 } \
659 } while (0) 659 } while (0)
660 660
661static __devinitdata
662DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 50, 1);
663
664static char *slave_vols[] __devinitdata = {
665 "Analog Front Playback Volume",
666 "Analog Rear Playback Volume",
667 "Analog Center/LFE Playback Volume",
668 "Analog Side Playback Volume",
669 "IEC958 Front Playback Volume",
670 "IEC958 Rear Playback Volume",
671 "IEC958 Center/LFE Playback Volume",
672 "IEC958 Unknown Playback Volume",
673 "CAPTURE feedback Playback Volume",
674 NULL
675};
676
677static char *slave_sws[] __devinitdata = {
678 "Analog Front Playback Switch",
679 "Analog Rear Playback Switch",
680 "Analog Center/LFE Playback Switch",
681 "Analog Side Playback Switch",
682 "IEC958 Playback Switch",
683 NULL
684};
685
686static void __devinit add_slaves(struct snd_card *card,
687 struct snd_kcontrol *master, char **list)
688{
689 for (; *list; list++) {
690 struct snd_kcontrol *slave = ctl_find(card, *list);
691 if (slave)
692 snd_ctl_add_slave(master, slave);
693 }
694}
695
661int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) 696int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
662{ 697{
663 int err; 698 int err;
664 struct snd_card *card = emu->card; 699 struct snd_card *card = emu->card;
665 char **c; 700 char **c;
701 struct snd_kcontrol *vmaster;
666 static char *ca0106_remove_ctls[] = { 702 static char *ca0106_remove_ctls[] = {
667 "Master Mono Playback Switch", 703 "Master Mono Playback Switch",
668 "Master Mono Playback Volume", 704 "Master Mono Playback Volume",
@@ -719,6 +755,21 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
719 } 755 }
720 if (emu->details->spi_dac == 1) 756 if (emu->details->spi_dac == 1)
721 ADD_CTLS(emu, snd_ca0106_volume_spi_dac_ctls); 757 ADD_CTLS(emu, snd_ca0106_volume_spi_dac_ctls);
758
759 /* Create virtual master controls */
760 vmaster = snd_ctl_make_virtual_master("Master Playback Volume",
761 snd_ca0106_master_db_scale);
762 if (!vmaster)
763 return -ENOMEM;
764 add_slaves(card, vmaster, slave_vols);
765
766 if (emu->details->spi_dac == 1) {
767 vmaster = snd_ctl_make_virtual_master("Master Playback Switch",
768 NULL);
769 if (!vmaster)
770 return -ENOMEM;
771 add_slaves(card, vmaster, slave_sws);
772 }
722 return 0; 773 return 0;
723} 774}
724 775