Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216694
b: refs/heads/master
c: 9907790
h: refs/heads/master
v: v3
  • Loading branch information
Charles Chin authored and Takashi Iwai committed Sep 17, 2010
1 parent 2665ccf commit f950d5d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30ea098fc000bb05081a1999269658f1a88af36a
refs/heads/master: 9907790aa06bfc04bf78b445e732ea10039c61e4
40 changes: 29 additions & 11 deletions trunk/sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ struct sigmatel_spec {

struct sigmatel_mic_route ext_mic;
struct sigmatel_mic_route int_mic;
struct sigmatel_mic_route dock_mic;

const char **spdif_labels;

Expand Down Expand Up @@ -3488,23 +3489,30 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
}

static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *fixed, hda_nid_t *ext)
hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
{
unsigned int cfg;

if (!nid)
return 0;
cfg = snd_hda_codec_get_pincfg(codec, nid);
switch (get_defcfg_connect(cfg)) {
case AC_JACK_PORT_BOTH:
case AC_JACK_PORT_FIXED:
if (*fixed)
return 1; /* already occupied */
*fixed = nid;
break;
case AC_JACK_PORT_COMPLEX:
if (*ext)
return 1; /* already occupied */
*ext = nid;
if ((get_defcfg_location(cfg) & 0xF0) == AC_JACK_LOC_SEPARATE) {
if (*dock)
return 1; /* already occupied */
*dock = nid;
} else {
if (*ext)
return 1; /* already occupied */
*ext = nid;
}
break;
}
return 0;
Expand All @@ -3519,6 +3527,8 @@ static int set_mic_route(struct hda_codec *codec,
int i;

mic->pin = pin;
if (pin == 0)
return 0;
for (i = 0; i < cfg->num_inputs; i++) {
if (pin == cfg->inputs[i].pin)
break;
Expand Down Expand Up @@ -3554,26 +3564,29 @@ static int stac_check_auto_mic(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg;
hda_nid_t fixed, ext;
hda_nid_t fixed, ext, dock;
int i;

for (i = 0; i < cfg->num_inputs; i++) {
if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
return 0; /* must be exclusively mics */
}
fixed = ext = 0;
fixed = ext = dock = 0;
for (i = 0; i < cfg->num_inputs; i++)
if (check_mic_pin(codec, cfg->inputs[i].pin, &fixed, &ext))
if (check_mic_pin(codec, cfg->inputs[i].pin,
&fixed, &ext, &dock))
return 0;
for (i = 0; i < spec->num_dmics; i++)
if (check_mic_pin(codec, spec->dmic_nids[i], &fixed, &ext))
if (check_mic_pin(codec, spec->dmic_nids[i],
&fixed, &ext, &dock))
return 0;
if (!fixed || !ext)
return 0;
if (!fixed && !ext && !dock)
return 0; /* no input to switch */
if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
return 0; /* no unsol support */
if (set_mic_route(codec, &spec->ext_mic, ext) ||
set_mic_route(codec, &spec->int_mic, fixed))
set_mic_route(codec, &spec->int_mic, fixed) ||
set_mic_route(codec, &spec->dock_mic, dock))
return 0; /* something is wrong */
return 1;
}
Expand Down Expand Up @@ -4281,6 +4294,9 @@ static int stac92xx_init(struct hda_codec *codec)
AC_VERB_SET_CONNECT_SEL, 0);
if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT))
stac_issue_unsol_event(codec, spec->ext_mic.pin);
if (enable_pin_detect(codec, spec->dock_mic.pin,
STAC_MIC_EVENT))
stac_issue_unsol_event(codec, spec->dock_mic.pin);
}
for (i = 0; i < cfg->num_inputs; i++) {
hda_nid_t nid = cfg->inputs[i].pin;
Expand Down Expand Up @@ -4698,6 +4714,8 @@ static void stac92xx_mic_detect(struct hda_codec *codec)

if (get_pin_presence(codec, spec->ext_mic.pin))
mic = &spec->ext_mic;
else if (get_pin_presence(codec, spec->dock_mic.pin))
mic = &spec->dock_mic;
else
mic = &spec->int_mic;
if (mic->dmux_idx >= 0)
Expand Down

0 comments on commit f950d5d

Please sign in to comment.