Skip to content

Commit

Permalink
ALSA: hda/idt - Clean up power-map check code
Browse files Browse the repository at this point in the history
Turn off the power-map for unused ports and check the jack-detection
capability in the first place.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed May 15, 2012
1 parent f153c6a commit bfc89de
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -4365,10 +4365,18 @@ static int stac92xx_init(struct hda_codec *codec)
hda_nid_t nid = spec->pwr_nids[i];
int pinctl, def_conf;

def_conf = snd_hda_codec_get_pincfg(codec, nid);
def_conf = get_defcfg_connect(def_conf);
if (def_conf == AC_JACK_PORT_NONE) {
/* power off unused ports */
stac_toggle_power_map(codec, nid, 0);
continue;
}
/* power on when no jack detection is available */
/* or when the VREF is used for controlling LED */
if (!spec->hp_detect ||
spec->vref_mute_led_nid == nid) {
spec->vref_mute_led_nid == nid ||
!is_jack_detectable(codec, nid)) {
stac_toggle_power_map(codec, nid, 1);
continue;
}
Expand All @@ -4386,15 +4394,6 @@ static int stac92xx_init(struct hda_codec *codec)
stac_toggle_power_map(codec, nid, 1);
continue;
}
def_conf = snd_hda_codec_get_pincfg(codec, nid);
def_conf = get_defcfg_connect(def_conf);
/* skip any ports that don't have jacks since presence
* detection is useless */
if (def_conf != AC_JACK_PORT_NONE &&
!is_jack_detectable(codec, nid)) {
stac_toggle_power_map(codec, nid, 1);
continue;
}
if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
stac_issue_unsol_event(codec, nid);
continue;
Expand Down

0 comments on commit bfc89de

Please sign in to comment.