Commit 5514efdf authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: fsi: use dmaengine helper functions

This patch used dmaengine helper functions instead of using hand setting.
And reduced local variables
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 01a0c113
...@@ -1089,13 +1089,10 @@ static void fsi_dma_do_tasklet(unsigned long data) ...@@ -1089,13 +1089,10 @@ static void fsi_dma_do_tasklet(unsigned long data)
{ {
struct fsi_stream *io = (struct fsi_stream *)data; struct fsi_stream *io = (struct fsi_stream *)data;
struct fsi_priv *fsi = fsi_stream_to_priv(io); struct fsi_priv *fsi = fsi_stream_to_priv(io);
struct dma_chan *chan;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
struct scatterlist sg;
struct snd_pcm_runtime *runtime; struct snd_pcm_runtime *runtime;
enum dma_data_direction dir; enum dma_data_direction dir;
dma_cookie_t cookie;
int is_play = fsi_stream_is_play(fsi, io); int is_play = fsi_stream_is_play(fsi, io);
int len; int len;
dma_addr_t buf; dma_addr_t buf;
...@@ -1104,7 +1101,6 @@ static void fsi_dma_do_tasklet(unsigned long data) ...@@ -1104,7 +1101,6 @@ static void fsi_dma_do_tasklet(unsigned long data)
return; return;
dai = fsi_get_dai(io->substream); dai = fsi_get_dai(io->substream);
chan = io->chan;
runtime = io->substream->runtime; runtime = io->substream->runtime;
dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
len = samples_to_bytes(runtime, io->period_samples); len = samples_to_bytes(runtime, io->period_samples);
...@@ -1112,13 +1108,7 @@ static void fsi_dma_do_tasklet(unsigned long data) ...@@ -1112,13 +1108,7 @@ static void fsi_dma_do_tasklet(unsigned long data)
dma_sync_single_for_device(dai->dev, buf, len, dir); dma_sync_single_for_device(dai->dev, buf, len, dir);
sg_init_table(&sg, 1); desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
len , offset_in_page(buf));
sg_dma_address(&sg) = buf;
sg_dma_len(&sg) = len;
desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n"); dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
...@@ -1128,13 +1118,12 @@ static void fsi_dma_do_tasklet(unsigned long data) ...@@ -1128,13 +1118,12 @@ static void fsi_dma_do_tasklet(unsigned long data)
desc->callback = fsi_dma_complete; desc->callback = fsi_dma_complete;
desc->callback_param = io; desc->callback_param = io;
cookie = desc->tx_submit(desc); if (dmaengine_submit(desc) < 0) {
if (cookie < 0) {
dev_err(dai->dev, "tx_submit() fail\n"); dev_err(dai->dev, "tx_submit() fail\n");
return; return;
} }
dma_async_issue_pending(chan); dma_async_issue_pending(io->chan);
/* /*
* FIXME * FIXME
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment