All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] AWOOGA: Revert "ALSA: hda: Make use of core codec functions to sync power state"
@ 2018-02-13 19:29 Chris Wilson
  2018-02-13 19:29 ` [PATCH 2/2] redo Chris Wilson
  2018-02-13 19:55 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] AWOOGA: Revert "ALSA: hda: Make use of core codec functions to sync power state" Patchwork
  0 siblings, 2 replies; 13+ messages in thread
From: Chris Wilson @ 2018-02-13 19:29 UTC (permalink / raw)
  To: intel-gfx; +Cc: Takashi Iwai, Abhijeet Kumar

This reverts commit 3b5b899ca67db07a4c4825911072221f99e157e2.

Fixes: 3b5b899ca67d ("ALSA: hda: Make use of core codec functions to sync power state")
Cc: Abhijeet Kumar <abhijeet.kumar@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_codec.c | 28 +++++++++++++++++++++++++++-
 sound/pci/hda/hda_local.h |  6 +-----
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 5bc3a7468e17..e018ecbf78a8 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2702,6 +2702,32 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
 }
 EXPORT_SYMBOL_GPL(snd_hda_codec_set_power_to_all);
 
+/*
+ * wait until the state is reached, returns the current state
+ */
+static unsigned int hda_sync_power_state(struct hda_codec *codec,
+					 hda_nid_t fg,
+					 unsigned int power_state)
+{
+	unsigned long end_time = jiffies + msecs_to_jiffies(500);
+	unsigned int state, actual_state;
+
+	for (;;) {
+		state = snd_hda_codec_read(codec, fg, 0,
+					   AC_VERB_GET_POWER_STATE, 0);
+		if (state & AC_PWRST_ERROR)
+			break;
+		actual_state = (state >> 4) & 0x0f;
+		if (actual_state == power_state)
+			break;
+		if (time_after_eq(jiffies, end_time))
+			break;
+		/* wait until the codec reachs to the target state */
+		msleep(1);
+	}
+	return state;
+}
+
 /**
  * snd_hda_codec_eapd_power_filter - A power filter callback for EAPD
  * @codec: the HDA codec
@@ -2764,7 +2790,7 @@ static unsigned int hda_set_power_state(struct hda_codec *codec,
 						   state);
 			snd_hda_codec_set_power_to_all(codec, fg, power_state);
 		}
-		state = snd_hda_sync_power_state(codec, fg, power_state);
+		state = hda_sync_power_state(codec, fg, power_state);
 		if (!(state & AC_PWRST_ERROR))
 			break;
 	}
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 321e78baa63c..5b5c324c99b9 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -622,11 +622,7 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
 {
 	return snd_hdac_check_power_state(&codec->core, nid, target_state);
 }
-static inline bool snd_hda_sync_power_state(struct hda_codec *codec,
-			   hda_nid_t nid, unsigned int target_state)
-{
-	return snd_hdac_sync_power_state(&codec->core, nid, target_state);
-}
+
 unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
 					     hda_nid_t nid,
 					     unsigned int power_state);
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-04-18 15:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 19:29 [PATCH 1/2] AWOOGA: Revert "ALSA: hda: Make use of core codec functions to sync power state" Chris Wilson
2018-02-13 19:29 ` [PATCH 2/2] redo Chris Wilson
2018-02-13 20:44   ` Chris Wilson
2018-02-14  4:06   ` [PATCH 1/3] Revert "ALSA: hda: Make use of core codec functions to sync power state" abhijeet.kumar
2018-02-14  4:06     ` [PATCH 2/3] redo abhijeet.kumar
2018-02-14  4:06     ` [PATCH 3/3] just some guess work to findout the culprit. If this breaks then we know what do abhijeet.kumar
2018-02-14  4:53       ` Kumar, Abhijeet
2018-02-14  8:47         ` Chris Wilson
2018-02-14  9:06           ` Kumar, Abhijeet
2018-02-14 11:18             ` Takashi Iwai
2018-02-14 13:11               ` Kumar, Abhijeet
2018-04-18 15:16                 ` Jani Nikula
2018-02-13 19:55 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] AWOOGA: Revert "ALSA: hda: Make use of core codec functions to sync power state" Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.