ALSA: hda - check supported power states
authorWang Xingchao <[email protected]>
Wed, 6 Jun 2012 14:02:48 +0000 (22:02 +0800)
committerTakashi Iwai <[email protected]>
Thu, 7 Jun 2012 09:39:52 +0000 (11:39 +0200)
Add function to check whether power states supported by specific
codec node.

Signed-off-by: Wang Xingchao <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
sound/pci/hda/hda_codec.c

index 41ca803a1fff9d1a4c60baa3889cc3171a990bf2..b89c8ecc819a7cb10692a5dc895411d142535949 100644 (file)
@@ -3504,6 +3504,22 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
 }
 EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all);
 
+/*
+ *  supported power states check
+ */
+static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg,
+                               unsigned int power_state)
+{
+       int sup = snd_hda_param_read(codec, fg, AC_PAR_POWER_STATE);
+
+       if (sup < 0)
+               return false;
+       if (sup & power_state)
+               return true;
+       else
+               return false;
+}
+
 /*
  * set power state of the codec
  */