]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ALSA: lola - Use SG-buffer
authorTakashi Iwai <tiwai@suse.de>
Tue, 3 May 2011 14:50:51 +0000 (16:50 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 May 2011 14:50:51 +0000 (16:50 +0200)
Completely switch to SG-buffer now, as it's working stably.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/lola/lola.c
sound/pci/lola/lola_pcm.c

index 7c13ace3c33bbf2d14db2847d59f1ca58be52719..3d2516b11f224a16f6a1a026102c26222b6e5777 100644 (file)
@@ -588,7 +588,6 @@ static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci,
        chip->irq = -1;
 
        chip->sample_rate_min = sample_rate_min[dev];
-
        chip->granularity = granularity[dev];
        /* FIXME */
        if (chip->granularity != LOLA_GRANULARITY_MAX) {
index ef738e6c991912aa5b322f5a0768b3d36e5754a8..dc2e811dcb3c3a7fd826fe2382a37df05568afa7 100644 (file)
 #include <sound/pcm.h>
 #include "lola.h"
 
-/* #define USE_SG_BUFFER */
-
 #define LOLA_MAX_BDL_ENTRIES   8
 #define LOLA_MAX_BUF_SIZE      (1024*1024*1024)
 #define LOLA_BDL_ENTRY_SIZE    (16 * 16)
 
-#ifdef USE_SG_BUFFER
-#define get_addr(substream, ofs) \
-       snd_pcm_sgbuf_get_addr(substream, ofs)
-#define get_size(substream, ofs, size) \
-       snd_pcm_sgbuf_get_chunk_size(substream, ofs, size)
-#define ops_page       snd_pcm_sgbuf_ops_page
-#define PREALLOC_TYPE  SNDRV_DMA_TYPE_DEV_SG
-#else
-#define get_addr(substream, ofs) \
-       ((substream)->runtime->dma_addr + ofs)
-#define get_size(substream, ofs, size) \
-       (size)
-#define ops_page       NULL
-#define PREALLOC_TYPE  SNDRV_DMA_TYPE_DEV
-#endif
-
 static struct lola_pcm *lola_get_pcm(struct snd_pcm_substream *substream)
 {
        struct lola *chip = snd_pcm_substream_chip(substream);
@@ -276,12 +258,12 @@ static int setup_bdle(struct snd_pcm_substream *substream,
                if (str->frags >= LOLA_MAX_BDL_ENTRIES)
                        return -EINVAL;
 
-               addr = get_addr(substream, ofs);
+               addr = snd_pcm_sgbuf_get_addr(substream, ofs);
                /* program the address field of the BDL entry */
                bdl[0] = cpu_to_le32((u32)addr);
                bdl[1] = cpu_to_le32(upper_32_bits(addr));
                /* program the size field of the BDL entry */
-               chunk = get_size(substream, ofs, size);
+               chunk = snd_pcm_sgbuf_get_chunk_size(substream, ofs, size);
                bdl[2] = cpu_to_le32(chunk);
                /* program the IOC to enable interrupt
                 * only when the whole fragment is processed
@@ -530,7 +512,7 @@ static struct snd_pcm_ops lola_pcm_ops = {
        .prepare = lola_pcm_prepare,
        .trigger = lola_pcm_trigger,
        .pointer = lola_pcm_pointer,
-       .page = ops_page,
+       .page = snd_pcm_sgbuf_ops_page,
 };
 
 int __devinit lola_create_pcm(struct lola *chip)
@@ -559,7 +541,7 @@ int __devinit lola_create_pcm(struct lola *chip)
                        snd_pcm_set_ops(pcm, i, &lola_pcm_ops);
        }
        /* buffer pre-allocation */
-       snd_pcm_lib_preallocate_pages_for_all(pcm, PREALLOC_TYPE,
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
                                              snd_dma_pci_data(chip->pci),
                                              1024 * 64, 32 * 1024 * 1024);
        return 0;