diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-05 13:09:27 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-05 13:09:27 +0100 |
commit | 12dde4c6d6e9092cf63094e84dc1fe4e505dd6d0 (patch) | |
tree | a4ff353b79e346d663be73200a00385591e46722 /sound | |
parent | e6e3ea25b1679b55728a8a470a50a8fff61e8a45 (diff) | |
download | talos-obmc-linux-12dde4c6d6e9092cf63094e84dc1fe4e505dd6d0.tar.gz talos-obmc-linux-12dde4c6d6e9092cf63094e84dc1fe4e505dd6d0.zip |
ALSA: hda - Proper power-map toggling for input pins
The current code overrides the event type on input pins always to
PWR_EVENT. Although this still works (PWR_EVENT and INSERT_EVENT
are handled samely), it'd be better to avoid such overrides.
Also, currently the unsol events are registered even for fixed pins
which will never raise the pin-detection event.
This patch fixes both issues.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 08170dff75e0..4c851fd55565 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3915,24 +3915,36 @@ static int stac92xx_init(struct hda_codec *codec) } else { stac92xx_auto_init_multi_out(codec); stac92xx_auto_init_hp_out(codec); + for (i = 0; i < cfg->hp_outs; i++) + stac_toggle_power_map(codec, cfg->hp_pins[i], 1); } for (i = 0; i < AUTO_PIN_LAST; i++) { hda_nid_t nid = cfg->input_pins[i]; if (nid) { - unsigned int pinctl; + unsigned int pinctl, conf; if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { /* for mic pins, force to initialize */ pinctl = stac92xx_get_vref(codec, nid); + pinctl |= AC_PINCTL_IN_EN; + stac92xx_auto_set_pinctl(codec, nid, pinctl); } else { pinctl = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); /* if PINCTL already set then skip */ - if (pinctl & AC_PINCTL_IN_EN) - continue; + if (!(pinctl & AC_PINCTL_IN_EN)) { + pinctl |= AC_PINCTL_IN_EN; + stac92xx_auto_set_pinctl(codec, nid, + pinctl); + } + } + conf = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_CONFIG_DEFAULT, 0); + if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { + enable_pin_detect(codec, nid, + STAC_INSERT_EVENT); + stac_issue_unsol_event(codec, nid, + STAC_INSERT_EVENT); } - pinctl |= AC_PINCTL_IN_EN; - stac92xx_auto_set_pinctl(codec, nid, pinctl); - enable_pin_detect(codec, nid, STAC_INSERT_EVENT); } } for (i = 0; i < spec->num_dmics; i++) @@ -3969,8 +3981,10 @@ static int stac92xx_init(struct hda_codec *codec) stac_toggle_power_map(codec, nid, 1); continue; } - enable_pin_detect(codec, nid, STAC_PWR_EVENT); - stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); + if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { + enable_pin_detect(codec, nid, STAC_PWR_EVENT); + stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); + } } if (spec->dac_list) stac92xx_power_down(codec); |