提交 25368c47 编写于 作者: T Takashi Iwai

ALSA: hda/via - Fix wrong checks of power state bits

AC_VERB_GET_POWER_STATE returns the combined bits of the actual state
and the target state.  Thus, comparing the obtained value directly
with the target value can't work.  The value has to be shifted and
masked properly.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 7dddf2ae
...@@ -240,8 +240,10 @@ static void set_widgets_power_state(struct hda_codec *codec) ...@@ -240,8 +240,10 @@ static void set_widgets_power_state(struct hda_codec *codec)
static void update_power_state(struct hda_codec *codec, hda_nid_t nid, static void update_power_state(struct hda_codec *codec, hda_nid_t nid,
unsigned int parm) unsigned int parm)
{ {
if (snd_hda_codec_read(codec, nid, 0, unsigned int state = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0) == parm) AC_VERB_GET_POWER_STATE, 0);
state = (state >> 4) & 0x0f;
if (state == parm)
return; return;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm); snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
} }
...@@ -251,8 +253,10 @@ static void update_conv_power_state(struct hda_codec *codec, hda_nid_t nid, ...@@ -251,8 +253,10 @@ static void update_conv_power_state(struct hda_codec *codec, hda_nid_t nid,
{ {
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
unsigned int format; unsigned int format;
if (snd_hda_codec_read(codec, nid, 0, unsigned int state = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0) == parm) AC_VERB_GET_POWER_STATE, 0);
state = (state >> 4) & 0x0f;
if (state == parm)
return; return;
format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
if (format && (spec->dac_stream_tag[index] != format)) if (format && (spec->dac_stream_tag[index] != format))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册