aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-01-10 10:53:55 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:54 -0500
commit2134ea4f37d36addbe86d4901f6c67a22a5db006 (patch)
tree804d187d5c46d71246db2d8919a59e2e7feef956 /sound/pci/hda/patch_sigmatel.c
parent3b0a5f22d4649433a5842ffc7313803292e95718 (diff)
[ALSA] hda-codec - Add virtual master controls
Add master controls using vmaster to codecs that have no real hardware master volume registers. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a0af8680dd0d..190e112f2f8e 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -170,6 +170,9 @@ struct sigmatel_spec {
170 struct snd_kcontrol_new *kctl_alloc; 170 struct snd_kcontrol_new *kctl_alloc;
171 struct hda_input_mux private_dimux; 171 struct hda_input_mux private_dimux;
172 struct hda_input_mux private_imux; 172 struct hda_input_mux private_imux;
173
174 /* virtual master */
175 unsigned int vmaster_tlv[4];
173}; 176};
174 177
175static hda_nid_t stac9200_adc_nids[1] = { 178static hda_nid_t stac9200_adc_nids[1] = {
@@ -794,6 +797,34 @@ static struct snd_kcontrol_new stac_dmux_mixer = {
794 .put = stac92xx_dmux_enum_put, 797 .put = stac92xx_dmux_enum_put,
795}; 798};
796 799
800static const char *slave_vols[] = {
801 "Front Playback Volume",
802 "Surround Playback Volume",
803 "Center Playback Volume",
804 "LFE Playback Volume",
805 "Side Playback Volume",
806 "Headphone Playback Volume",
807 "Headphone Playback Volume",
808 "Speaker Playback Volume",
809 "External Speaker Playback Volume",
810 "Speaker2 Playback Volume",
811 NULL
812};
813
814static const char *slave_sws[] = {
815 "Front Playback Switch",
816 "Surround Playback Switch",
817 "Center Playback Switch",
818 "LFE Playback Switch",
819 "Side Playback Switch",
820 "Headphone Playback Switch",
821 "Headphone Playback Switch",
822 "Speaker Playback Switch",
823 "External Speaker Playback Switch",
824 "Speaker2 Playback Switch",
825 NULL
826};
827
797static int stac92xx_build_controls(struct hda_codec *codec) 828static int stac92xx_build_controls(struct hda_codec *codec)
798{ 829{
799 struct sigmatel_spec *spec = codec->spec; 830 struct sigmatel_spec *spec = codec->spec;
@@ -827,6 +858,23 @@ static int stac92xx_build_controls(struct hda_codec *codec)
827 if (err < 0) 858 if (err < 0)
828 return err; 859 return err;
829 } 860 }
861
862 /* if we have no master control, let's create it */
863 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
864 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0],
865 HDA_OUTPUT, spec->vmaster_tlv);
866 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
867 spec->vmaster_tlv, slave_vols);
868 if (err < 0)
869 return err;
870 }
871 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
872 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
873 NULL, slave_sws);
874 if (err < 0)
875 return err;
876 }
877
830 return 0; 878 return 0;
831} 879}
832 880