diff options
author | Wang Xingchao <xingchao.wang@intel.com> | 2012-06-07 22:26:08 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-06-08 03:00:37 -0400 |
commit | 09617ce4774ebf30a55b8451f4b35031f626f763 (patch) | |
tree | c8222f08cb8593478603170401a27ab07e401aeb /sound/pci/hda/hda_codec.c | |
parent | e076eb5c952c0f724980b44a77902a2ff93d098c (diff) |
ALSA: hda - power setting error check
codec may reject power state transition requests(reporting PS-ERROR set),
in that case we re-issue a power state setting and check error bit again.
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index fedbfae978af..851e6ecfa011 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3526,6 +3526,9 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg | |||
3526 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 3526 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
3527 | unsigned int power_state) | 3527 | unsigned int power_state) |
3528 | { | 3528 | { |
3529 | int count; | ||
3530 | unsigned int state; | ||
3531 | |||
3529 | if (codec->patch_ops.set_power_state) { | 3532 | if (codec->patch_ops.set_power_state) { |
3530 | codec->patch_ops.set_power_state(codec, fg, power_state); | 3533 | codec->patch_ops.set_power_state(codec, fg, power_state); |
3531 | return; | 3534 | return; |
@@ -3537,9 +3540,17 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
3537 | bool epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS); | 3540 | bool epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS); |
3538 | msleep(epss ? 10 : 100); | 3541 | msleep(epss ? 10 : 100); |
3539 | } | 3542 | } |
3540 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, | 3543 | |
3541 | power_state); | 3544 | /* repeat power states setting at most 10 times*/ |
3542 | snd_hda_codec_set_power_to_all(codec, fg, power_state, true); | 3545 | for (count = 0; count < 10; count++) { |
3546 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, | ||
3547 | power_state); | ||
3548 | snd_hda_codec_set_power_to_all(codec, fg, power_state, true); | ||
3549 | state = snd_hda_codec_read(codec, fg, 0, | ||
3550 | AC_VERB_GET_POWER_STATE, 0); | ||
3551 | if (!(state & AC_PWRST_ERROR)) | ||
3552 | break; | ||
3553 | } | ||
3543 | } | 3554 | } |
3544 | 3555 | ||
3545 | #ifdef CONFIG_SND_HDA_HWDEP | 3556 | #ifdef CONFIG_SND_HDA_HWDEP |