Skip to content

Commit

Permalink
ALSA: hda - minor optimization in hda_set_power_state()
Browse files Browse the repository at this point in the history
Check the target power-state before checking EAPD exception to reduce
unneeded verb executions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Apr 21, 2009
1 parent b97bedc commit a3b48c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,8 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
if (wcaps & AC_WCAP_POWER) {
unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
AC_WCAP_TYPE_SHIFT;
if (wid_type == AC_WID_PIN) {
if (power_state == AC_PWRST_D3 &&
wid_type == AC_WID_PIN) {
unsigned int pincap;
/*
* don't power down the widget if it controls
Expand All @@ -2360,7 +2361,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
nid, 0,
AC_VERB_GET_EAPD_BTLENABLE, 0);
eapd &= 0x02;
if (power_state == AC_PWRST_D3 && eapd)
if (eapd)
continue;
}
}
Expand Down

0 comments on commit a3b48c8

Please sign in to comment.