Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c7f46ad authored by Wang Xingchao's avatar Wang Xingchao Committed by Takashi Iwai
Browse files

ALSA: hda - check supported power states



Add function to check whether power states supported by specific
codec node.

Signed-off-by: default avatarWang Xingchao <xingchao.wang@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 167d2d55
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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
 */