Skip to content

Commit

Permalink
ALSA: lola - Use SG-buffer
Browse files Browse the repository at this point in the history
Completely switch to SG-buffer now, as it's working stably.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed May 3, 2011
1 parent fe3d393 commit 972505c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
1 change: 0 additions & 1 deletion sound/pci/lola/lola.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
26 changes: 4 additions & 22 deletions sound/pci/lola/lola_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,10 @@
#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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 972505c

Please sign in to comment.