If a codec has both a front and a rear Line In, two controls both
named "Line Jack" will be created, which causes parsing to fail.
While a long term solution might be to name the jacks differently,
this extra check is consistent with what is already being done in many
auto-parsers, and will also protect against other cases when two
inputs have the same label.
If a codec has both a front and a rear Line In, two controls both
named "Line Jack" will be created, which causes parsing to fail.
While a long term solution might be to name the jacks differently,
this extra check is consistent with what is already being done in many
auto-parsers, and will also protect against other cases when two
inputs have the same label.
BugLink: https:/ /bugs.launchpad .net/bugs/ 923409 pci/hda/ hda_jack. c | 24 +++++++ +++++++ +------ ---
Signed-off-by: David Henningsson <email address hidden>
---
sound/
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/sound/ pci/hda/ hda_jack. c b/sound/ pci/hda/ hda_jack. c pci/hda/ hda_jack. c pci/hda/ hda_jack. c jack_add_ kctl(struct hda_codec *codec, hda_nid_t nid, SYMBOL_ HDA(snd_ hda_jack_ add_kctl) ;
index d8a35da..9d819c4 100644
--- a/sound/
+++ b/sound/
@@ -282,7 +282,8 @@ int snd_hda_
EXPORT_
static int add_jack_ kctl(struct hda_codec *codec, hda_nid_t nid, kctl(struct hda_codec *codec, hda_nid_t nid,
- const struct auto_pin_cfg *cfg)
+ const struct auto_pin_cfg *cfg,
+ char *lastname, int *lastidx)
{
unsigned int def_conf, conn;
char name[44];
@@ -298,6 +299,10 @@ static int add_jack_
return 0;
snd_hda_ get_pin_ label(codec, nid, cfg, name, sizeof(name), &idx); jack_add_ kctl(codec, nid, name, idx); jack_add_ kctls(struct hda_codec *codec,
+ if (!strcmp(name, lastname) && idx == *lastidx)
+ idx++;
+ strncpy(lastname, name, 44);
+ *lastidx = idx;
err = snd_hda_
if (err < 0)
return err;
@@ -311,41 +316,42 @@ int snd_hda_
const struct auto_pin_cfg *cfg)
{
const hda_nid_t *p;
- int i, err;
+ int i, err, lastidx = 0;
+ char lastname[44] = "";
for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { kctl(codec, *p, cfg); kctl(codec, *p, cfg, lastname, &lastidx); out_pins) /* might be duplicated */ kctl(codec, *p, cfg); kctl(codec, *p, cfg, lastname, &lastidx); out_pins) /* might be duplicated */ kctl(codec, *p, cfg); kctl(codec, *p, cfg, lastname, &lastidx); kctl(codec, cfg->inputs[i].pin, cfg); kctl(codec, cfg->inputs[i].pin, cfg, lastname, &lastidx); kctl(codec, *p, cfg); kctl(codec, *p, cfg, lastname, &lastidx); kctl(codec, cfg->dig_in_pin, cfg); kctl(codec, cfg->dig_in_pin, cfg, lastname, &lastidx); kctl(codec, cfg->mono_out_pin, cfg); kctl(codec, cfg->mono_out_pin, cfg, lastname, &lastidx);
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
}
for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) {
if (*p == *cfg->line_
break;
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
}
for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
if (*p == *cfg->line_
break;
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
}
for (i = 0; i < cfg->num_inputs; i++) {
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
}
for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) {
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
}
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
- err = add_jack_
+ err = add_jack_
if (err < 0)
return err;
return 0;
--
1.7.8.3