Gitweb: http://git.kernel.org/linus/b880c74adf7e79b97de710a152ea82f292f9abc7
Commit: b880c74adf7e79b97de710a152ea82f292f9abc7
Parent: dd5746a85cb21ea5b3afca0b569586a05aa56846
Author: Takashi Iwai <tiwai@suse.de>
AuthorDate: Tue Mar 10 14:41:05 2009 +0100
Committer: Takashi Iwai <tiwai@suse.de>
CommitDate: Tue Mar 10 15:13:23 2009 +0100
ALSA: hda - Create "Capture Source" control dynamically in patch_conexant.c
Create "Capture Source" control dynamically for Conexant codecs.
If only one capture item is available, don't create such a control
since it's just useless.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/patch_conexant.c | 61 +++++++++++----------------------------
1 files changed, 17 insertions(+), 44 deletions(-)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e1476d6..d5d736f 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -463,6 +463,17 @@ static void conexant_free(struct hda_codec *codec)
kfree(codec->spec);
}
+static struct snd_kcontrol_new cxt_capture_mixers[] = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Capture Source",
+ .info = conexant_mux_enum_info,
+ .get = conexant_mux_enum_get,
+ .put = conexant_mux_enum_put
+ },
+ {}
+};
+
static const char *slave_vols[] = {
"Headphone Playback Volume",
"Speaker Playback Volume",
@@ -522,6 +533,12 @@ static int conexant_build_controls(struct hda_codec *codec)
return err;
}
+ if (spec->input_mux) {
+ err = snd_hda_add_new_ctls(codec, cxt_capture_mixers);
+ if (err < 0)
+ return err;
+ }
+
return 0;
}
@@ -753,13 +770,6 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec,
}
static struct snd_kcontrol_new cxt5045_mixers[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Capture Source",
- .info = conexant_mux_enum_info,
- .get = conexant_mux_enum_get,
- .put = ...