| 1 |
From fc546201dfe40d09c1a1e82384dc3774025984da Mon Sep 17 00:00:00 2001
|
| 2 |
From: Takashi Iwai <tiwai@suse.de>
|
| 3 |
Date: Wed, 18 Mar 2009 15:15:37 +0100
|
| 4 |
Subject: ALSA: hda - Don't reset stream at each prepare callback
|
| 5 |
|
| 6 |
Don't reset the stream at each prepare callback but do it only once
|
| 7 |
after the open.
|
| 8 |
|
| 9 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
| 10 |
---
|
| 11 |
sound/pci/hda/hda_intel.c | 33 ++++++++++++++++++++++-----------
|
| 12 |
1 files changed, 22 insertions(+), 11 deletions(-)
|
| 13 |
|
| 14 |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
|
| 15 |
index b7a61a1..931a62d 100644
|
| 16 |
--- a/sound/pci/hda/hda_intel.c
|
| 17 |
+++ b/sound/pci/hda/hda_intel.c
|
| 18 |
@@ -858,13 +858,18 @@ static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev)
|
| 19 |
SD_CTL_DMA_START | SD_INT_MASK);
|
| 20 |
}
|
| 21 |
|
| 22 |
-/* stop a stream */
|
| 23 |
-static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev)
|
| 24 |
+/* stop DMA */
|
| 25 |
+static void azx_stream_clear(struct azx *chip, struct azx_dev *azx_dev)
|
| 26 |
{
|
| 27 |
- /* stop DMA */
|
| 28 |
azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) &
|
| 29 |
~(SD_CTL_DMA_START | SD_INT_MASK));
|
| 30 |
azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */
|
| 31 |
+}
|
| 32 |
+
|
| 33 |
+/* stop a stream */
|
| 34 |
+static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev)
|
| 35 |
+{
|
| 36 |
+ azx_stream_clear(chip, azx_dev);
|
| 37 |
/* disable SIE */
|
| 38 |
azx_writeb(chip, INTCTL,
|
| 39 |
azx_readb(chip, INTCTL) & ~(1 << azx_dev->index));
|
| 40 |
@@ -1125,18 +1130,14 @@ static int azx_setup_periods(struct azx *chip,
|
| 41 |
return -EINVAL;
|
| 42 |
}
|
| 43 |
|
| 44 |
-/*
|
| 45 |
- * set up the SD for streaming
|
| 46 |
- */
|
| 47 |
-static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
|
| 48 |
+/* reset stream */
|
| 49 |
+static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev)
|
| 50 |
{
|
| 51 |
unsigned char val;
|
| 52 |
int timeout;
|
| 53 |
|
| 54 |
- /* make sure the run bit is zero for SD */
|
| 55 |
- azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) &
|
| 56 |
- ~SD_CTL_DMA_START);
|
| 57 |
- /* reset stream */
|
| 58 |
+ azx_stream_clear(chip, azx_dev);
|
| 59 |
+
|
| 60 |
azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) |
|
| 61 |
SD_CTL_STREAM_RESET);
|
| 62 |
udelay(3);
|
| 63 |
@@ -1153,7 +1154,15 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
|
| 64 |
while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) &&
|
| 65 |
--timeout)
|
| 66 |
;
|
| 67 |
+}
|
| 68 |
|
| 69 |
+/*
|
| 70 |
+ * set up the SD for streaming
|
| 71 |
+ */
|
| 72 |
+static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
|
| 73 |
+{
|
| 74 |
+ /* make sure the run bit is zero for SD */
|
| 75 |
+ azx_stream_clear(chip, azx_dev);
|
| 76 |
/* program the stream_tag */
|
| 77 |
azx_sd_writel(azx_dev, SD_CTL,
|
| 78 |
(azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)|
|
| 79 |
@@ -1399,6 +1408,8 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
|
| 80 |
runtime->private_data = azx_dev;
|
| 81 |
snd_pcm_set_sync(substream);
|
| 82 |
mutex_unlock(&chip->open_mutex);
|
| 83 |
+
|
| 84 |
+ azx_stream_reset(chip, azx_dev);
|
| 85 |
return 0;
|
| 86 |
}
|
| 87 |
|
| 88 |
--
|
| 89 |
1.6.2.2
|
| 90 |
|