Skip to content

Commit

Permalink
ALSA: hda/via - Fix wrong checks of power state bits
Browse files Browse the repository at this point in the history
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: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Jan 24, 2013
1 parent 7dddf2a commit 25368c4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
unsigned int parm)
{
if (snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0) == parm)
unsigned int state = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0);
state = (state >> 4) & 0x0f;
if (state == parm)
return;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
}
Expand All @@ -251,8 +253,10 @@ static void update_conv_power_state(struct hda_codec *codec, hda_nid_t nid,
{
struct via_spec *spec = codec->spec;
unsigned int format;
if (snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0) == parm)
unsigned int state = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0);
state = (state >> 4) & 0x0f;
if (state == parm)
return;
format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
if (format && (spec->dac_stream_tag[index] != format))
Expand Down

0 comments on commit 25368c4

Please sign in to comment.