mirror of https://gitee.com/openkylin/linux.git
ASoC: nuc900: No need to track the dma buffer in the driver state struct
The DMA buffer and address can be accessed through the snd_pcm_runtime. There is no need to manually track them in the driver's state struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c517d838eb
commit
fa41181fe3
|
@ -100,10 +100,7 @@
|
|||
struct nuc900_audio {
|
||||
void __iomem *mmio;
|
||||
spinlock_t lock;
|
||||
dma_addr_t dma_addr[2];
|
||||
unsigned long buffersize[2];
|
||||
unsigned long irq_num;
|
||||
struct snd_pcm_substream *substream;
|
||||
struct resource *res;
|
||||
struct clk *clk;
|
||||
struct device *dev;
|
||||
|
|
|
@ -42,29 +42,10 @@ static const struct snd_pcm_hardware nuc900_pcm_hardware = {
|
|||
static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct nuc900_audio *nuc900_audio = runtime->private_data;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&nuc900_audio->lock, flags);
|
||||
|
||||
nuc900_audio->substream = substream;
|
||||
nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
|
||||
nuc900_audio->buffersize[substream->stream] =
|
||||
params_buffer_bytes(params);
|
||||
|
||||
spin_unlock_irqrestore(&nuc900_audio->lock, flags);
|
||||
|
||||
return ret;
|
||||
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
}
|
||||
|
||||
static void nuc900_update_dma_register(struct snd_pcm_substream *substream,
|
||||
dma_addr_t dma_addr, size_t count)
|
||||
static void nuc900_update_dma_register(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct nuc900_audio *nuc900_audio = runtime->private_data;
|
||||
|
@ -78,8 +59,8 @@ static void nuc900_update_dma_register(struct snd_pcm_substream *substream,
|
|||
mmio_len = nuc900_audio->mmio + ACTL_RDST_LENGTH;
|
||||
}
|
||||
|
||||
AUDIO_WRITE(mmio_addr, dma_addr);
|
||||
AUDIO_WRITE(mmio_len, count);
|
||||
AUDIO_WRITE(mmio_addr, runtime->dma_addr);
|
||||
AUDIO_WRITE(mmio_len, runtime->dma_bytes);
|
||||
}
|
||||
|
||||
static void nuc900_dma_start(struct snd_pcm_substream *substream)
|
||||
|
@ -170,9 +151,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
|
|||
|
||||
spin_lock_irqsave(&nuc900_audio->lock, flags);
|
||||
|
||||
nuc900_update_dma_register(substream,
|
||||
nuc900_audio->dma_addr[substream->stream],
|
||||
nuc900_audio->buffersize[substream->stream]);
|
||||
nuc900_update_dma_register(substream);
|
||||
|
||||
val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET);
|
||||
|
||||
|
|
Loading…
Reference in New Issue