diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-05-29 02:29:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-03 08:06:39 -0400 |
commit | 5514efdfe0384576ef38c66b1672b6826696fbf3 (patch) | |
tree | 8aa4471857c197e6cac672d19ea1402d0d405bae /sound/soc/sh | |
parent | 01a0c1139c2bd075d005253093e7060022c5d0cb (diff) |
ASoC: fsi: use dmaengine helper functions
This patch used dmaengine helper functions instead of using hand setting.
And reduced local variables
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/fsi.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 2ef98536f1da..fcaa6b8abb0c 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1089,13 +1089,10 @@ static void fsi_dma_do_tasklet(unsigned long data) | |||
1089 | { | 1089 | { |
1090 | struct fsi_stream *io = (struct fsi_stream *)data; | 1090 | struct fsi_stream *io = (struct fsi_stream *)data; |
1091 | struct fsi_priv *fsi = fsi_stream_to_priv(io); | 1091 | struct fsi_priv *fsi = fsi_stream_to_priv(io); |
1092 | struct dma_chan *chan; | ||
1093 | struct snd_soc_dai *dai; | 1092 | struct snd_soc_dai *dai; |
1094 | struct dma_async_tx_descriptor *desc; | 1093 | struct dma_async_tx_descriptor *desc; |
1095 | struct scatterlist sg; | ||
1096 | struct snd_pcm_runtime *runtime; | 1094 | struct snd_pcm_runtime *runtime; |
1097 | enum dma_data_direction dir; | 1095 | enum dma_data_direction dir; |
1098 | dma_cookie_t cookie; | ||
1099 | int is_play = fsi_stream_is_play(fsi, io); | 1096 | int is_play = fsi_stream_is_play(fsi, io); |
1100 | int len; | 1097 | int len; |
1101 | dma_addr_t buf; | 1098 | dma_addr_t buf; |
@@ -1104,7 +1101,6 @@ static void fsi_dma_do_tasklet(unsigned long data) | |||
1104 | return; | 1101 | return; |
1105 | 1102 | ||
1106 | dai = fsi_get_dai(io->substream); | 1103 | dai = fsi_get_dai(io->substream); |
1107 | chan = io->chan; | ||
1108 | runtime = io->substream->runtime; | 1104 | runtime = io->substream->runtime; |
1109 | dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | 1105 | dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; |
1110 | len = samples_to_bytes(runtime, io->period_samples); | 1106 | len = samples_to_bytes(runtime, io->period_samples); |
@@ -1112,14 +1108,8 @@ static void fsi_dma_do_tasklet(unsigned long data) | |||
1112 | 1108 | ||
1113 | dma_sync_single_for_device(dai->dev, buf, len, dir); | 1109 | dma_sync_single_for_device(dai->dev, buf, len, dir); |
1114 | 1110 | ||
1115 | sg_init_table(&sg, 1); | 1111 | desc = dmaengine_prep_slave_single(io->chan, buf, len, dir, |
1116 | sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)), | 1112 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1117 | len , offset_in_page(buf)); | ||
1118 | sg_dma_address(&sg) = buf; | ||
1119 | sg_dma_len(&sg) = len; | ||
1120 | |||
1121 | desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir, | ||
1122 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
1123 | if (!desc) { | 1113 | if (!desc) { |
1124 | dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n"); | 1114 | dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n"); |
1125 | return; | 1115 | return; |
@@ -1128,13 +1118,12 @@ static void fsi_dma_do_tasklet(unsigned long data) | |||
1128 | desc->callback = fsi_dma_complete; | 1118 | desc->callback = fsi_dma_complete; |
1129 | desc->callback_param = io; | 1119 | desc->callback_param = io; |
1130 | 1120 | ||
1131 | cookie = desc->tx_submit(desc); | 1121 | if (dmaengine_submit(desc) < 0) { |
1132 | if (cookie < 0) { | ||
1133 | dev_err(dai->dev, "tx_submit() fail\n"); | 1122 | dev_err(dai->dev, "tx_submit() fail\n"); |
1134 | return; | 1123 | return; |
1135 | } | 1124 | } |
1136 | 1125 | ||
1137 | dma_async_issue_pending(chan); | 1126 | dma_async_issue_pending(io->chan); |
1138 | 1127 | ||
1139 | /* | 1128 | /* |
1140 | * FIXME | 1129 | * FIXME |