diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-23 10:21:36 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-23 10:24:15 -0400 |
commit | a23b688f4d5c2490a50677b30011a677d8edf3d0 (patch) | |
tree | 5353f6876843cf8b9a011fa8d5b57f28a036811e /sound/pci | |
parent | e82c025b501a1ca62dec40989817dbb17c0b9167 (diff) |
ALSA: hda - Don't create empty/single-item input source
In patch_realtek.c, don't create empty or single-item "Input Source"
control elements that are simply superfluous.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8dcbb04e57b5..7a3c6db6d5be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1595,8 +1595,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |||
1595 | snd_hda_mixer_amp_switch_put); | 1595 | snd_hda_mixer_amp_switch_put); |
1596 | } | 1596 | } |
1597 | 1597 | ||
1598 | #define DEFINE_CAPMIX(num) \ | 1598 | #define _DEFINE_CAPMIX(num) \ |
1599 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | ||
1600 | { \ | 1599 | { \ |
1601 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 1600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1602 | .name = "Capture Switch", \ | 1601 | .name = "Capture Switch", \ |
@@ -1617,7 +1616,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |||
1617 | .get = alc_cap_vol_get, \ | 1616 | .get = alc_cap_vol_get, \ |
1618 | .put = alc_cap_vol_put, \ | 1617 | .put = alc_cap_vol_put, \ |
1619 | .tlv = { .c = alc_cap_vol_tlv }, \ | 1618 | .tlv = { .c = alc_cap_vol_tlv }, \ |
1620 | }, \ | 1619 | } |
1620 | |||
1621 | #define _DEFINE_CAPSRC(num) \ | ||
1621 | { \ | 1622 | { \ |
1622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 1623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1623 | /* .name = "Capture Source", */ \ | 1624 | /* .name = "Capture Source", */ \ |
@@ -1626,15 +1627,28 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |||
1626 | .info = alc_mux_enum_info, \ | 1627 | .info = alc_mux_enum_info, \ |
1627 | .get = alc_mux_enum_get, \ | 1628 | .get = alc_mux_enum_get, \ |
1628 | .put = alc_mux_enum_put, \ | 1629 | .put = alc_mux_enum_put, \ |
1629 | }, \ | 1630 | } |
1630 | { } /* end */ \ | 1631 | |
1632 | #define DEFINE_CAPMIX(num) \ | ||
1633 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | ||
1634 | _DEFINE_CAPMIX(num), \ | ||
1635 | _DEFINE_CAPSRC(num), \ | ||
1636 | { } /* end */ \ | ||
1637 | } | ||
1638 | |||
1639 | #define DEFINE_CAPMIX_NOSRC(num) \ | ||
1640 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | ||
1641 | _DEFINE_CAPMIX(num), \ | ||
1642 | { } /* end */ \ | ||
1631 | } | 1643 | } |
1632 | 1644 | ||
1633 | /* up to three ADCs */ | 1645 | /* up to three ADCs */ |
1634 | DEFINE_CAPMIX(1); | 1646 | DEFINE_CAPMIX(1); |
1635 | DEFINE_CAPMIX(2); | 1647 | DEFINE_CAPMIX(2); |
1636 | DEFINE_CAPMIX(3); | 1648 | DEFINE_CAPMIX(3); |
1637 | 1649 | DEFINE_CAPMIX_NOSRC(1); | |
1650 | DEFINE_CAPMIX_NOSRC(2); | ||
1651 | DEFINE_CAPMIX_NOSRC(3); | ||
1638 | 1652 | ||
1639 | /* | 1653 | /* |
1640 | * ALC880 5-stack model | 1654 | * ALC880 5-stack model |
@@ -4298,13 +4312,22 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
4298 | 4312 | ||
4299 | static void set_capture_mixer(struct alc_spec *spec) | 4313 | static void set_capture_mixer(struct alc_spec *spec) |
4300 | { | 4314 | { |
4301 | static struct snd_kcontrol_new *caps[3] = { | 4315 | static struct snd_kcontrol_new *caps[2][3] = { |
4302 | alc_capture_mixer1, | 4316 | { alc_capture_mixer_nosrc1, |
4303 | alc_capture_mixer2, | 4317 | alc_capture_mixer_nosrc2, |
4304 | alc_capture_mixer3, | 4318 | alc_capture_mixer_nosrc3 }, |
4319 | { alc_capture_mixer1, | ||
4320 | alc_capture_mixer2, | ||
4321 | alc_capture_mixer3 }, | ||
4305 | }; | 4322 | }; |
4306 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) | 4323 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4307 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; | 4324 | int mux; |
4325 | if (spec->input_mux && spec->input_mux->num_items > 1) | ||
4326 | mux = 1; | ||
4327 | else | ||
4328 | mux = 0; | ||
4329 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | ||
4330 | } | ||
4308 | } | 4331 | } |
4309 | 4332 | ||
4310 | #define set_beep_amp(spec, nid, idx, dir) \ | 4333 | #define set_beep_amp(spec, nid, idx, dir) \ |