From: qjb Date: Tue, 10 Jun 2014 01:17:55 +0000 (+0800) Subject: audio soc dma : add audio getposition dma X-Git-Tag: firefly_0821_release~5161 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0774031f52744ac63a96f9ded32030e381fcbe76;p=firefly-linux-kernel-4.4.55.git audio soc dma : add audio getposition dma --- diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 6cebbd10c9b1..3eba20adcccc 100755 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -3188,6 +3188,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pd->device_prep_slave_sg = pl330_prep_slave_sg; pd->device_control = pl330_control; pd->device_issue_pending = pl330_issue_pending; +#ifdef drivers/dma/pl330.c + pd->dma_getposition = pl330_dma_getposition; +#endif ret = dma_async_device_register(pd); if (ret) { diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 637f2130cf28..00d2addf22e5 100755 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -601,6 +601,10 @@ struct dma_device { enum dma_status (*device_tx_status)(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate); +#ifdef CONFIG_ARCH_ROCKCHIP + int (*dma_getposition)(struct dma_chan *chan, + dma_addr_t *src, dma_addr_t *dst); +#endif void (*device_issue_pending)(struct dma_chan *chan); }; diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c index a6f73312e508..858be3227799 100755 --- a/sound/soc/soc-dmaengine-pcm.c +++ b/sound/soc/soc-dmaengine-pcm.c @@ -180,7 +180,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream) flags |= DMA_PREP_INTERRUPT; prtd->pos = 0; -#if CONFIG_ARCH_ROCKCHIP +#ifdef CONFIG_ARCH_ROCKCHIP //printk("soc dma buffersize = %d , periodsize=%d, periods=%d\n", // snd_pcm_lib_buffer_bytes(substream), // snd_pcm_lib_period_bytes(substream), @@ -259,6 +259,15 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_trigger); snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream *substream) { struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); +#ifdef CONFIG_ARCH_ROCKCHIP + dma_addr_t src, dst; + + prtd->dma_chan->device->dma_getposition(prtd->dma_chan, &src, &dst); + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + prtd->pos = dst - substream->runtime->dma_addr; + else + prtd->pos = src - substream->runtime->dma_addr; +#endif return bytes_to_frames(substream->runtime, prtd->pos); } EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_pointer_no_residue);