diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:12:09 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:14:35 +0100 |
commit | 25368c47aee6d909923001918041f2e94bfa02ef (patch) | |
tree | 0aa575fbe760eaf795c4aebe724ca550a2c5e7e9 | |
parent | 7dddf2aed8ffc1fa30df92b57981dea146cdfc0f (diff) | |
download | linux-3.10-25368c47aee6d909923001918041f2e94bfa02ef.tar.gz linux-3.10-25368c47aee6d909923001918041f2e94bfa02ef.tar.bz2 linux-3.10-25368c47aee6d909923001918041f2e94bfa02ef.zip |
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: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_via.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 9d9583ca5f5..5bd4b0c1000 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -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); } @@ -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)) |