Commit a3b48c88 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - minor optimization in hda_set_power_state()

Check the target power-state before checking EAPD exception to reduce
unneeded verb executions.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b97bedcd
...@@ -2348,7 +2348,8 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, ...@@ -2348,7 +2348,8 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
if (wcaps & AC_WCAP_POWER) { if (wcaps & AC_WCAP_POWER) {
unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
AC_WCAP_TYPE_SHIFT; AC_WCAP_TYPE_SHIFT;
if (wid_type == AC_WID_PIN) { if (power_state == AC_PWRST_D3 &&
wid_type == AC_WID_PIN) {
unsigned int pincap; unsigned int pincap;
/* /*
* don't power down the widget if it controls * don't power down the widget if it controls
...@@ -2360,7 +2361,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, ...@@ -2360,7 +2361,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
nid, 0, nid, 0,
AC_VERB_GET_EAPD_BTLENABLE, 0); AC_VERB_GET_EAPD_BTLENABLE, 0);
eapd &= 0x02; eapd &= 0x02;
if (power_state == AC_PWRST_D3 && eapd) if (eapd)
continue; continue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment