aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-24 11:47:17 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-24 11:47:17 -0500
commit9040d102da5635abc306372bb4dbffaba92c478e (patch)
treeb6674ae2c98ab64d78c78b7623e51e676bacd55f /sound/pci/hda/hda_codec.c
parentb9c590bbf1d7621c3f9feb6ac0992d638244d0b1 (diff)
ALSA: hda - Add snd_hda_check_power_state() helper function
... for small refactoring. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 2311114bf52c..f82a64da2f1b 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3779,18 +3779,13 @@ static void sync_power_up_states(struct hda_codec *codec)
3779 3779
3780 for (i = 0; i < codec->num_nodes; i++, nid++) { 3780 for (i = 0; i < codec->num_nodes; i++, nid++) {
3781 unsigned int wcaps = get_wcaps(codec, nid); 3781 unsigned int wcaps = get_wcaps(codec, nid);
3782 unsigned int state, target; 3782 unsigned int target;
3783 if (!(wcaps & AC_WCAP_POWER)) 3783 if (!(wcaps & AC_WCAP_POWER))
3784 continue; 3784 continue;
3785 target = codec->power_filter(codec, nid, AC_PWRST_D0); 3785 target = codec->power_filter(codec, nid, AC_PWRST_D0);
3786 if (target == AC_PWRST_D0) 3786 if (target == AC_PWRST_D0)
3787 continue; 3787 continue;
3788 state = snd_hda_codec_read(codec, nid, 0, 3788 if (!snd_hda_check_power_state(codec, nid, target))
3789 AC_VERB_GET_POWER_STATE, 0);
3790 if (state & AC_PWRST_ERROR)
3791 continue;
3792 state = (state >> 4) & 0x0f;
3793 if (state != target)
3794 snd_hda_codec_write(codec, nid, 0, 3789 snd_hda_codec_write(codec, nid, 0,
3795 AC_VERB_SET_POWER_STATE, target); 3790 AC_VERB_SET_POWER_STATE, target);
3796 } 3791 }