ALSA: hda - Check the activity of the NID to be powered down
When an inactive path is powered down with spec->power_down_unused flag, we should check the activity of each widget in the path whether it's still referred from any active path. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -606,6 +606,10 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check whether the NID is referred by any active paths */
|
||||||
|
#define is_active_nid_for_any(codec, nid) \
|
||||||
|
is_active_nid(codec, nid, HDA_OUTPUT, 0)
|
||||||
|
|
||||||
/* get the default amp value for the target state */
|
/* get the default amp value for the target state */
|
||||||
static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
|
static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
|
||||||
int dir, unsigned int caps, bool enable)
|
int dir, unsigned int caps, bool enable)
|
||||||
@@ -759,7 +763,8 @@ static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
|
|||||||
|
|
||||||
for (i = 0; i < path->depth; i++) {
|
for (i = 0; i < path->depth; i++) {
|
||||||
hda_nid_t nid = path->path[i];
|
hda_nid_t nid = path->path[i];
|
||||||
if (!snd_hda_check_power_state(codec, nid, AC_PWRST_D3)) {
|
if (!snd_hda_check_power_state(codec, nid, AC_PWRST_D3) &&
|
||||||
|
!is_active_nid_for_any(codec, nid)) {
|
||||||
snd_hda_codec_write(codec, nid, 0,
|
snd_hda_codec_write(codec, nid, 0,
|
||||||
AC_VERB_SET_POWER_STATE,
|
AC_VERB_SET_POWER_STATE,
|
||||||
AC_PWRST_D3);
|
AC_PWRST_D3);
|
||||||
@@ -4157,7 +4162,7 @@ static unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
|
|||||||
return power_state;
|
return power_state;
|
||||||
if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER)
|
if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER)
|
||||||
return power_state;
|
return power_state;
|
||||||
if (is_active_nid(codec, nid, HDA_OUTPUT, 0))
|
if (is_active_nid_for_any(codec, nid))
|
||||||
return power_state;
|
return power_state;
|
||||||
return AC_PWRST_D3;
|
return AC_PWRST_D3;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user