mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ALSA: hda/via - Don't create duplicated boost controls
The driver may create duplicated mic boost controls when there are multiple mics with the very same type / location, and this leads to the error at actual kcontrol creation. It needs to check the validity of the created control and add a proper index if it's duplicated. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
070cff4cfd
commit
8d8bbc6f17
1 changed files with 8 additions and 1 deletions
|
@ -2474,6 +2474,8 @@ static int create_mic_boost_ctls(struct hda_codec *codec)
|
||||||
{
|
{
|
||||||
struct via_spec *spec = codec->spec;
|
struct via_spec *spec = codec->spec;
|
||||||
const struct auto_pin_cfg *cfg = &spec->autocfg;
|
const struct auto_pin_cfg *cfg = &spec->autocfg;
|
||||||
|
const char *prev_label = NULL;
|
||||||
|
int type_idx = 0;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
for (i = 0; i < cfg->num_inputs; i++) {
|
for (i = 0; i < cfg->num_inputs; i++) {
|
||||||
|
@ -2488,8 +2490,13 @@ static int create_mic_boost_ctls(struct hda_codec *codec)
|
||||||
if (caps == -1 || !(caps & AC_AMPCAP_NUM_STEPS))
|
if (caps == -1 || !(caps & AC_AMPCAP_NUM_STEPS))
|
||||||
continue;
|
continue;
|
||||||
label = hda_get_autocfg_input_label(codec, cfg, i);
|
label = hda_get_autocfg_input_label(codec, cfg, i);
|
||||||
|
if (prev_label && !strcmp(label, prev_label))
|
||||||
|
type_idx++;
|
||||||
|
else
|
||||||
|
type_idx = 0;
|
||||||
|
prev_label = label;
|
||||||
snprintf(name, sizeof(name), "%s Boost Volume", label);
|
snprintf(name, sizeof(name), "%s Boost Volume", label);
|
||||||
err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
|
err = __via_add_control(spec, VIA_CTL_WIDGET_VOL, name, type_idx,
|
||||||
HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_INPUT));
|
HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_INPUT));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in a new issue