aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-04-17 03:39:41 -0400
committerTakashi Iwai <tiwai@suse.de>2016-04-17 03:39:41 -0400
commit50fd4987c4f3c3ebf0ce94d932732011bbdc7c71 (patch)
tree104aebcb7c9bb293fdf1aa0c38ddf4da1c871455
parentc44da62b55bb453052869ab095bcda7aa0bd6bba (diff)
ALSA: hda - Don't trust the reported actual power state
We've got a regression report that the recording on Mac with a cirrus codec doesn't work any longer. This turned out to be the missing power up to D0 by power_save_node enablement. After analyzing the traces, we found out that the culprit is that the codec advertises the "actual" power state of a few nodes to be D0 while the "target" power state is D3. This inconsistency is usually OK, as it implies the power transition. But in the case of cirrus codec, this seems to be stuck to D3 while it's not actually D0. This patch addresses the issue by checking the power state difference more strictly. It sends the power-state change verb unless both the target and the actual power states show the given value. We may introduce yet another flag indicating the possible broken hardware power state, but it's anyway safer to set the proper power state even in a transition (at least it's harmless as long as the target state is same). So this simpler change was applied now. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116171 Cc: <stable@vger.kernel.org> # v4.4+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_generic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 7ca5b89f088a..dfaf1a93fb8a 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -826,7 +826,7 @@ static hda_nid_t path_power_update(struct hda_codec *codec,
826 bool allow_powerdown) 826 bool allow_powerdown)
827{ 827{
828 hda_nid_t nid, changed = 0; 828 hda_nid_t nid, changed = 0;
829 int i, state; 829 int i, state, power;
830 830
831 for (i = 0; i < path->depth; i++) { 831 for (i = 0; i < path->depth; i++) {
832 nid = path->path[i]; 832 nid = path->path[i];
@@ -838,7 +838,9 @@ static hda_nid_t path_power_update(struct hda_codec *codec,
838 state = AC_PWRST_D0; 838 state = AC_PWRST_D0;
839 else 839 else
840 state = AC_PWRST_D3; 840 state = AC_PWRST_D3;
841 if (!snd_hda_check_power_state(codec, nid, state)) { 841 power = snd_hda_codec_read(codec, nid, 0,
842 AC_VERB_GET_POWER_STATE, 0);
843 if (power != (state | (state << 4))) {
842 snd_hda_codec_write(codec, nid, 0, 844 snd_hda_codec_write(codec, nid, 0,
843 AC_VERB_SET_POWER_STATE, state); 845 AC_VERB_SET_POWER_STATE, state);
844 changed = nid; 846 changed = nid;