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>
This commit is contained in:
parent
e82c025b50
commit
a23b688f4d
1 changed files with 35 additions and 12 deletions
|
@ -1595,8 +1595,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
snd_hda_mixer_amp_switch_put);
|
snd_hda_mixer_amp_switch_put);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_CAPMIX(num) \
|
#define _DEFINE_CAPMIX(num) \
|
||||||
static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
|
|
||||||
{ \
|
{ \
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||||
.name = "Capture Switch", \
|
.name = "Capture Switch", \
|
||||||
|
@ -1617,7 +1616,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
|
||||||
.get = alc_cap_vol_get, \
|
.get = alc_cap_vol_get, \
|
||||||
.put = alc_cap_vol_put, \
|
.put = alc_cap_vol_put, \
|
||||||
.tlv = { .c = alc_cap_vol_tlv }, \
|
.tlv = { .c = alc_cap_vol_tlv }, \
|
||||||
}, \
|
}
|
||||||
|
|
||||||
|
#define _DEFINE_CAPSRC(num) \
|
||||||
{ \
|
{ \
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||||
/* .name = "Capture Source", */ \
|
/* .name = "Capture Source", */ \
|
||||||
|
@ -1626,7 +1627,18 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
|
||||||
.info = alc_mux_enum_info, \
|
.info = alc_mux_enum_info, \
|
||||||
.get = alc_mux_enum_get, \
|
.get = alc_mux_enum_get, \
|
||||||
.put = alc_mux_enum_put, \
|
.put = alc_mux_enum_put, \
|
||||||
}, \
|
}
|
||||||
|
|
||||||
|
#define DEFINE_CAPMIX(num) \
|
||||||
|
static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
|
||||||
|
_DEFINE_CAPMIX(num), \
|
||||||
|
_DEFINE_CAPSRC(num), \
|
||||||
|
{ } /* end */ \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEFINE_CAPMIX_NOSRC(num) \
|
||||||
|
static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
|
||||||
|
_DEFINE_CAPMIX(num), \
|
||||||
{ } /* end */ \
|
{ } /* end */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1634,7 +1646,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
|
||||||
DEFINE_CAPMIX(1);
|
DEFINE_CAPMIX(1);
|
||||||
DEFINE_CAPMIX(2);
|
DEFINE_CAPMIX(2);
|
||||||
DEFINE_CAPMIX(3);
|
DEFINE_CAPMIX(3);
|
||||||
|
DEFINE_CAPMIX_NOSRC(1);
|
||||||
|
DEFINE_CAPMIX_NOSRC(2);
|
||||||
|
DEFINE_CAPMIX_NOSRC(3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ALC880 5-stack model
|
* ALC880 5-stack model
|
||||||
|
@ -4298,13 +4312,22 @@ static void alc880_auto_init(struct hda_codec *codec)
|
||||||
|
|
||||||
static void set_capture_mixer(struct alc_spec *spec)
|
static void set_capture_mixer(struct alc_spec *spec)
|
||||||
{
|
{
|
||||||
static struct snd_kcontrol_new *caps[3] = {
|
static struct snd_kcontrol_new *caps[2][3] = {
|
||||||
alc_capture_mixer1,
|
{ alc_capture_mixer_nosrc1,
|
||||||
|
alc_capture_mixer_nosrc2,
|
||||||
|
alc_capture_mixer_nosrc3 },
|
||||||
|
{ alc_capture_mixer1,
|
||||||
alc_capture_mixer2,
|
alc_capture_mixer2,
|
||||||
alc_capture_mixer3,
|
alc_capture_mixer3 },
|
||||||
};
|
};
|
||||||
if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
|
if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
|
||||||
spec->cap_mixer = caps[spec->num_adc_nids - 1];
|
int mux;
|
||||||
|
if (spec->input_mux && spec->input_mux->num_items > 1)
|
||||||
|
mux = 1;
|
||||||
|
else
|
||||||
|
mux = 0;
|
||||||
|
spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define set_beep_amp(spec, nid, idx, dir) \
|
#define set_beep_amp(spec, nid, idx, dir) \
|
||||||
|
|
Loading…
Add table
Reference in a new issue