All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] ALSA: hda - use usleep_range in link reset and change timeout check
@ 2012-12-12 14:16 mengdong.lin
  2012-12-12  7:26 ` Intel HD: ALC662 noise-bug on FitPC2i Bent Bisballe Nyeng
  2012-12-13  9:32 ` [PATCH v2 1/1] ALSA: hda - use usleep_range in link reset and change timeout check Lin, Mengdong
  0 siblings, 2 replies; 13+ messages in thread
From: mengdong.lin @ 2012-12-12 14:16 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Mengdong Lin, Xingchao Wang

From: Mengdong Lin <mengdong.lin@intel.com>

Reducing the time on HDA link reset can help to reduce the driver loading
time. So we replace msleep with usleep_range to get more accurate time
control and change the value to a smaller one. And a 100ms timeout is set
for both entering and exiting the link reset.

Signed-off-by: Xingchao Wang <xingchao.wang@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 72b085a..ed3a290 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1041,7 +1041,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up);
 /* reset codec link */
 static int azx_reset(struct azx *chip, int full_reset)
 {
-	int count;
+	unsigned long timeout;
 
 	if (!full_reset)
 		goto __skip;
@@ -1052,24 +1052,26 @@ static int azx_reset(struct azx *chip, int full_reset)
 	/* reset controller */
 	azx_writel(chip, GCTL, azx_readl(chip, GCTL) & ~ICH6_GCTL_RESET);
 
-	count = 50;
-	while (azx_readb(chip, GCTL) && --count)
-		msleep(1);
+	timeout = jiffies + msecs_to_jiffies(100);
+	while (azx_readb(chip, GCTL) &&
+			time_before(jiffies, timeout))
+		usleep_range(500, 1000);
 
 	/* delay for >= 100us for codec PLL to settle per spec
 	 * Rev 0.9 section 5.5.1
 	 */
-	msleep(1);
+	usleep_range(500, 1000);
 
 	/* Bring controller out of reset */
 	azx_writeb(chip, GCTL, azx_readb(chip, GCTL) | ICH6_GCTL_RESET);
 
-	count = 50;
-	while (!azx_readb(chip, GCTL) && --count)
-		msleep(1);
+	timeout = jiffies + msecs_to_jiffies(100);
+	while (!azx_readb(chip, GCTL) &&
+			time_before(jiffies, timeout))
+		usleep_range(500, 1000);
 
 	/* Brent Chartrand said to wait >= 540us for codecs to initialize */
-	msleep(1);
+	usleep_range(1000, 1200);
 
       __skip:
 	/* check to see if controller is ready */
-- 
1.7.9.5

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

end of thread, other threads:[~2012-12-13  9:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12 14:16 [PATCH v2 1/1] ALSA: hda - use usleep_range in link reset and change timeout check mengdong.lin
2012-12-12  7:26 ` Intel HD: ALC662 noise-bug on FitPC2i Bent Bisballe Nyeng
2012-12-12 13:05   ` Clemens Ladisch
2012-12-12 13:14     ` Bent Bisballe Nyeng
2012-12-12 14:25       ` Takashi Iwai
2012-12-12 14:45         ` Bent Bisballe Nyeng
2012-12-12 14:51           ` Takashi Iwai
2012-12-12 18:30             ` Bent Bisballe Nyeng
2012-12-12 19:11               ` Takashi Iwai
2012-12-13  7:58                 ` Bent Bisballe Nyeng
2012-12-13  8:08                   ` Takashi Iwai
2012-12-13  9:32 ` [PATCH v2 1/1] ALSA: hda - use usleep_range in link reset and change timeout check Lin, Mengdong
2012-12-13  9:38   ` Takashi Iwai

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.