Jesse Keating 7a32965
From c69fcbd1f60b0842f7c1ad2c95692ffd19c4932b Mon Sep 17 00:00:00 2001
Jesse Keating 7a32965
From: Kyle McMartin <kyle@phobos.i.jkkm.org>
Jesse Keating 7a32965
Date: Mon, 29 Mar 2010 23:56:08 -0400
Jesse Keating 7a32965
Subject: hda_intel-prealloc-4mb-dmabuffer
Jesse Keating 7a32965
Jesse Keating 7a32965
---
Jesse Keating 7a32965
 sound/pci/hda/hda_intel.c |   14 +++++++++++++-
Jesse Keating 7a32965
 1 files changed, 13 insertions(+), 1 deletions(-)
Jesse Keating 7a32965
Jesse Keating 7a32965
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
Jesse Keating 7a32965
index 4bb9067..37db515 100644
Jesse Keating 7a32965
--- a/sound/pci/hda/hda_intel.c
Jesse Keating 7a32965
+++ b/sound/pci/hda/hda_intel.c
Jesse Keating 7a32965
@@ -1986,6 +1986,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
Jesse Keating 7a32965
 	struct azx_pcm *apcm;
Jesse Keating 7a32965
 	int pcm_dev = cpcm->device;
Jesse Keating 7a32965
 	int s, err;
Jesse Keating 7a32965
+	size_t prealloc_min = 64*1024;	/* 64KB */
Jesse Keating 7a32965
 
Jesse Keating 7a32965
 	if (pcm_dev >= HDA_MAX_PCMS) {
Jesse Keating 7a32965
 		snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n",
Jesse Keating 7a32965
@@ -2019,10 +2020,21 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
Jesse Keating 7a32965
 		if (cpcm->stream[s].substreams)
Jesse Keating 7a32965
 			snd_pcm_set_ops(pcm, s, &azx_pcm_ops);
Jesse Keating 7a32965
 	}
Jesse Keating 7a32965
+
Jesse Keating 7a32965
 	/* buffer pre-allocation */
Jesse Keating 7a32965
+
Jesse Keating 7a32965
+	/* subtle, don't allocate a big buffer for modems...
Jesse Keating 7a32965
+	 * also, don't just test 32BIT_MASK, since azx supports
Jesse Keating 7a32965
+	 * 64-bit DMA in some cases.
Jesse Keating 7a32965
+	 */
Jesse Keating 7a32965
+	/* lennart wants a 2.2MB buffer for 2sec of 48khz */
Jesse Keating 7a32965
+	if (pcm->dev_class == SNDRV_PCM_CLASS_GENERIC &&
Jesse Keating 7a32965
+	    chip->pci->dma_mask >= DMA_32BIT_MASK)
Jesse Keating 7a32965
+		prealloc_min = 4 * 1024 * 1024;	/* 4MB */
Jesse Keating 7a32965
+
Jesse Keating 7a32965
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
Jesse Keating 7a32965
 					      snd_dma_pci_data(chip->pci),
Jesse Keating 7a32965
-					      1024 * 64, 32 * 1024 * 1024);
Jesse Keating 7a32965
+					      prealloc_min, 32 * 1024 * 1024);
Jesse Keating 7a32965
 	return 0;
Jesse Keating 7a32965
 }
Jesse Keating 7a32965
 
Jesse Keating 7a32965
-- 
Jesse Keating 7a32965
1.7.0.1
Jesse Keating 7a32965