aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-05-14 06:58:47 -0400
committerTakashi Iwai <tiwai@suse.de>2013-05-16 01:18:05 -0400
commitb1b9fbd0507aac4ddce14f513d52332f50be89dc (patch)
treeba4c2850727eb85cf6342ec7ce8d584a66ff7c53 /sound
parenta62ee234a572b4c98fe98cf5fb18e4e8b0f6e43d (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_generic.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index ac079f93c535..ae85bbd2e6f8 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -606,6 +606,10 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
606 return false; 606 return false;
607} 607}
608 608
609/* check whether the NID is referred by any active paths */
610#define is_active_nid_for_any(codec, nid) \
611 is_active_nid(codec, nid, HDA_OUTPUT, 0)
612
609/* get the default amp value for the target state */ 613/* get the default amp value for the target state */
610static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, 614static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
611 int dir, unsigned int caps, bool enable) 615 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)
759 763
760 for (i = 0; i < path->depth; i++) { 764 for (i = 0; i < path->depth; i++) {
761 hda_nid_t nid = path->path[i]; 765 hda_nid_t nid = path->path[i];
762 if (!snd_hda_check_power_state(codec, nid, AC_PWRST_D3)) { 766 if (!snd_hda_check_power_state(codec, nid, AC_PWRST_D3) &&
767 !is_active_nid_for_any(codec, nid)) {
763 snd_hda_codec_write(codec, nid, 0, 768 snd_hda_codec_write(codec, nid, 0,
764 AC_VERB_SET_POWER_STATE, 769 AC_VERB_SET_POWER_STATE,
765 AC_PWRST_D3); 770 AC_PWRST_D3);
@@ -4157,7 +4162,7 @@ static unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec,
4157 return power_state; 4162 return power_state;
4158 if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER) 4163 if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER)
4159 return power_state; 4164 return power_state;
4160 if (is_active_nid(codec, nid, HDA_OUTPUT, 0)) 4165 if (is_active_nid_for_any(codec, nid))
4161 return power_state; 4166 return power_state;
4162 return AC_PWRST_D3; 4167 return AC_PWRST_D3;
4163} 4168}