Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > media > contrib-testing-src > by-pkgid > 3798058a248fdc18b2de3ca3c884cb11 > files > 30

kernel-netbook-2.6.33.7-3mdv2010.1.src.rpm

--- linux-2.6.33-t1/sound/pci/hda/hda_intel.c.orig	2010-02-24 20:52:17.000000000 +0200
+++ linux-2.6.33-t1/sound/pci/hda/hda_intel.c	2010-02-24 22:09:15.681387028 +0200
@@ -1982,6 +1982,7 @@ azx_attach_pcm_stream(struct hda_bus *bu
 	struct azx_pcm *apcm;
 	int pcm_dev = cpcm->device;
 	int s, err;
+	size_t prealloc_min = 64*1024;	/* 64KB */
 
 	if (pcm_dev >= AZX_MAX_PCMS) {
 		snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n",
@@ -2015,10 +2016,21 @@ azx_attach_pcm_stream(struct hda_bus *bu
 		if (cpcm->stream[s].substreams)
 			snd_pcm_set_ops(pcm, s, &azx_pcm_ops);
 	}
+
 	/* buffer pre-allocation */
+
+	/* subtle, don't allocate a big buffer for modems...
+	 * also, don't just test 32BIT_MASK, since azx supports
+	 * 64-bit DMA in some cases.
+	 */
+	/* lennart wants a 2.2MB buffer for 2sec of 48khz */
+	if (pcm->dev_class == SNDRV_PCM_CLASS_GENERIC &&
+	    chip->pci->dma_mask >= DMA_32BIT_MASK)
+		prealloc_min = 4 * 1024 * 1024;	/* 4MB */
+
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
 					      snd_dma_pci_data(chip->pci),
-					      1024 * 64, 32 * 1024 * 1024);
+					      prealloc_min, 32 * 1024 * 1024);
 	return 0;
 }