diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-06-22 20:55:18 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-28 09:41:18 -0400 |
commit | ffb83e8cb14cace1b08ceb56695b580c808d8a41 (patch) | |
tree | a2a982646dbd6138fbe63c25e709fb5b5bac6248 | |
parent | 6f2a06cd42336c75c74181730a7c31c78e2be6fb (diff) |
ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
for snd_pcm_lib_preallocate_pages_for_all().
But, it came from original dma-sh7760.c,
and no longer needed.
This patch exchange its parameter, and removed
original dma mapping and un-needed
dma_sync_single_xxx() from driver.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | arch/arm/mach-shmobile/board-armadillo800eva.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-kzm9g.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 4 | ||||
-rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/fsi.c | 42 |
5 files changed, 17 insertions, 37 deletions
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 30fcac73a540..689c121157ec 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -998,6 +998,8 @@ static struct platform_device fsi_wm8978_device = { | |||
998 | .id = 0, | 998 | .id = 0, |
999 | .dev = { | 999 | .dev = { |
1000 | .platform_data = &fsi_wm8978_info, | 1000 | .platform_data = &fsi_wm8978_info, |
1001 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1002 | .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask, | ||
1001 | }, | 1003 | }, |
1002 | }; | 1004 | }; |
1003 | 1005 | ||
@@ -1021,6 +1023,8 @@ static struct platform_device fsi_hdmi_device = { | |||
1021 | .id = 1, | 1023 | .id = 1, |
1022 | .dev = { | 1024 | .dev = { |
1023 | .platform_data = &fsi2_hdmi_info, | 1025 | .platform_data = &fsi2_hdmi_info, |
1026 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1027 | .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask, | ||
1024 | }, | 1028 | }, |
1025 | }; | 1029 | }; |
1026 | 1030 | ||
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index f94ec8ca42c1..01e0d1386db7 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = { | |||
603 | .name = "asoc-simple-card", | 603 | .name = "asoc-simple-card", |
604 | .dev = { | 604 | .dev = { |
605 | .platform_data = &fsi2_ak4648_info, | 605 | .platform_data = &fsi2_ak4648_info, |
606 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
607 | .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask, | ||
606 | }, | 608 | }, |
607 | }; | 609 | }; |
608 | 610 | ||
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 0ff4d8e45cf7..112553f0f9bf 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -523,6 +523,8 @@ static struct platform_device fsi_hdmi_device = { | |||
523 | .id = 1, | 523 | .id = 1, |
524 | .dev = { | 524 | .dev = { |
525 | .platform_data = &fsi2_hdmi_info, | 525 | .platform_data = &fsi2_hdmi_info, |
526 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
527 | .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask, | ||
526 | }, | 528 | }, |
527 | }; | 529 | }; |
528 | 530 | ||
@@ -919,6 +921,8 @@ static struct platform_device fsi_ak4643_device = { | |||
919 | .name = "asoc-simple-card", | 921 | .name = "asoc-simple-card", |
920 | .dev = { | 922 | .dev = { |
921 | .platform_data = &fsi2_ak4643_info, | 923 | .platform_data = &fsi2_ak4643_info, |
924 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
925 | .dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask, | ||
922 | }, | 926 | }, |
923 | }; | 927 | }; |
924 | 928 | ||
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 85d5255d259f..0d3049244cd3 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = { | |||
874 | .name = "asoc-simple-card", | 874 | .name = "asoc-simple-card", |
875 | .dev = { | 875 | .dev = { |
876 | .platform_data = &fsi_da7210_info, | 876 | .platform_data = &fsi_da7210_info, |
877 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
878 | .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask, | ||
877 | }, | 879 | }, |
878 | }; | 880 | }; |
879 | 881 | ||
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 710a079a7377..7a6b632c3db8 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -233,7 +233,6 @@ struct fsi_stream { | |||
233 | */ | 233 | */ |
234 | struct dma_chan *chan; | 234 | struct dma_chan *chan; |
235 | struct work_struct work; | 235 | struct work_struct work; |
236 | dma_addr_t dma; | ||
237 | int dma_id; | 236 | int dma_id; |
238 | int loop_cnt; | 237 | int loop_cnt; |
239 | int additional_pos; | 238 | int additional_pos; |
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data) | |||
1279 | */ | 1278 | */ |
1280 | static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) | 1279 | static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) |
1281 | { | 1280 | { |
1282 | struct snd_pcm_runtime *runtime = io->substream->runtime; | ||
1283 | struct snd_soc_dai *dai = fsi_get_dai(io->substream); | ||
1284 | enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? | ||
1285 | DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
1286 | |||
1287 | /* | 1281 | /* |
1288 | * 24bit data : 24bit bus / package in back | 1282 | * 24bit data : 24bit bus / package in back |
1289 | * 16bit data : 16bit bus / stream mode | 1283 | * 16bit data : 16bit bus / stream mode |
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) | |||
1293 | 1287 | ||
1294 | io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */ | 1288 | io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */ |
1295 | io->additional_pos = 0; | 1289 | io->additional_pos = 0; |
1296 | io->dma = dma_map_single(dai->dev, runtime->dma_area, | ||
1297 | snd_pcm_lib_buffer_bytes(io->substream), dir); | ||
1298 | return 0; | ||
1299 | } | ||
1300 | |||
1301 | static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io) | ||
1302 | { | ||
1303 | struct snd_soc_dai *dai = fsi_get_dai(io->substream); | ||
1304 | enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? | ||
1305 | DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
1306 | 1290 | ||
1307 | dma_unmap_single(dai->dev, io->dma, | ||
1308 | snd_pcm_lib_buffer_bytes(io->substream), dir); | ||
1309 | return 0; | 1291 | return 0; |
1310 | } | 1292 | } |
1311 | 1293 | ||
@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional) | |||
1317 | if (period >= runtime->periods) | 1299 | if (period >= runtime->periods) |
1318 | period = 0; | 1300 | period = 0; |
1319 | 1301 | ||
1320 | return io->dma + samples_to_bytes(runtime, period * io->period_samples); | 1302 | return runtime->dma_addr + |
1303 | samples_to_bytes(runtime, period * io->period_samples); | ||
1321 | } | 1304 | } |
1322 | 1305 | ||
1323 | static void fsi_dma_complete(void *data) | 1306 | static void fsi_dma_complete(void *data) |
@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data) | |||
1325 | struct fsi_stream *io = (struct fsi_stream *)data; | 1308 | struct fsi_stream *io = (struct fsi_stream *)data; |
1326 | struct fsi_priv *fsi = fsi_stream_to_priv(io); | 1309 | struct fsi_priv *fsi = fsi_stream_to_priv(io); |
1327 | struct snd_pcm_runtime *runtime = io->substream->runtime; | 1310 | struct snd_pcm_runtime *runtime = io->substream->runtime; |
1328 | struct snd_soc_dai *dai = fsi_get_dai(io->substream); | ||
1329 | enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? | ||
1330 | DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
1331 | |||
1332 | dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0), | ||
1333 | samples_to_bytes(runtime, io->period_samples), dir); | ||
1334 | 1311 | ||
1335 | io->buff_sample_pos += io->period_samples; | 1312 | io->buff_sample_pos += io->period_samples; |
1336 | io->period_pos++; | 1313 | io->period_pos++; |
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work) | |||
1369 | for (i = 0; i < io->loop_cnt; i++) { | 1346 | for (i = 0; i < io->loop_cnt; i++) { |
1370 | buf = fsi_dma_get_area(io, io->additional_pos); | 1347 | buf = fsi_dma_get_area(io, io->additional_pos); |
1371 | 1348 | ||
1372 | dma_sync_single_for_device(dai->dev, buf, len, dir); | ||
1373 | |||
1374 | desc = dmaengine_prep_slave_single(io->chan, buf, len, dir, | 1349 | desc = dmaengine_prep_slave_single(io->chan, buf, len, dir, |
1375 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1350 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1376 | if (!desc) { | 1351 | if (!desc) { |
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) | |||
1495 | 1470 | ||
1496 | static struct fsi_stream_handler fsi_dma_push_handler = { | 1471 | static struct fsi_stream_handler fsi_dma_push_handler = { |
1497 | .init = fsi_dma_init, | 1472 | .init = fsi_dma_init, |
1498 | .quit = fsi_dma_quit, | ||
1499 | .probe = fsi_dma_probe, | 1473 | .probe = fsi_dma_probe, |
1500 | .transfer = fsi_dma_transfer, | 1474 | .transfer = fsi_dma_transfer, |
1501 | .remove = fsi_dma_remove, | 1475 | .remove = fsi_dma_remove, |
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm) | |||
1850 | 1824 | ||
1851 | static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd) | 1825 | static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd) |
1852 | { | 1826 | { |
1853 | struct snd_pcm *pcm = rtd->pcm; | ||
1854 | |||
1855 | /* | ||
1856 | * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel | ||
1857 | * in MMAP mode (i.e. aplay -M) | ||
1858 | */ | ||
1859 | return snd_pcm_lib_preallocate_pages_for_all( | 1827 | return snd_pcm_lib_preallocate_pages_for_all( |
1860 | pcm, | 1828 | rtd->pcm, |
1861 | SNDRV_DMA_TYPE_CONTINUOUS, | 1829 | SNDRV_DMA_TYPE_DEV, |
1862 | snd_dma_continuous_data(GFP_KERNEL), | 1830 | rtd->card->snd_card->dev, |
1863 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); | 1831 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); |
1864 | } | 1832 | } |
1865 | 1833 | ||