diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:47:17 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:47:17 +0100 |
commit | 9040d102da5635abc306372bb4dbffaba92c478e (patch) | |
tree | b6674ae2c98ab64d78c78b7623e51e676bacd55f /sound/pci/hda/hda_local.h | |
parent | b9c590bbf1d7621c3f9feb6ac0992d638244d0b1 (diff) | |
download | talos-op-linux-9040d102da5635abc306372bb4dbffaba92c478e.tar.gz talos-op-linux-9040d102da5635abc306372bb4dbffaba92c478e.zip |
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_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 2ff62dcf2fcb..05f1d594d17b 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -657,6 +657,19 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, struct hda_loopback_check *check, hda_nid_t nid); +/* check whether the actual power state matches with the target state */ +static inline bool +snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid, + unsigned int target_state) +{ + unsigned int state = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_POWER_STATE, 0); + if (state & AC_PWRST_ERROR) + return true; + state = (state >> 4) & 0x0f; + return (state != target_state); +} + /* * AMP control callbacks */ |