aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/fsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sh/fsi.c')
-rw-r--r--sound/soc/sh/fsi.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index b33ca7cd085b..1967f44e7cd4 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -232,9 +232,9 @@ struct fsi_stream {
232 * these are for DMAEngine 232 * these are for DMAEngine
233 */ 233 */
234 struct dma_chan *chan; 234 struct dma_chan *chan;
235 struct sh_dmae_slave slave; /* see fsi_handler_init() */
236 struct work_struct work; 235 struct work_struct work;
237 dma_addr_t dma; 236 dma_addr_t dma;
237 int dma_id;
238 int loop_cnt; 238 int loop_cnt;
239 int additional_pos; 239 int additional_pos;
240}; 240};
@@ -1410,15 +1410,6 @@ static void fsi_dma_do_work(struct work_struct *work)
1410 } 1410 }
1411} 1411}
1412 1412
1413static bool fsi_dma_filter(struct dma_chan *chan, void *param)
1414{
1415 struct sh_dmae_slave *slave = param;
1416
1417 chan->private = slave;
1418
1419 return true;
1420}
1421
1422static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) 1413static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
1423{ 1414{
1424 schedule_work(&io->work); 1415 schedule_work(&io->work);
@@ -1446,15 +1437,34 @@ static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
1446static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev) 1437static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct device *dev)
1447{ 1438{
1448 dma_cap_mask_t mask; 1439 dma_cap_mask_t mask;
1440 int is_play = fsi_stream_is_play(fsi, io);
1449 1441
1450 dma_cap_zero(mask); 1442 dma_cap_zero(mask);
1451 dma_cap_set(DMA_SLAVE, mask); 1443 dma_cap_set(DMA_SLAVE, mask);
1452 1444
1453 io->chan = dma_request_channel(mask, fsi_dma_filter, &io->slave); 1445 io->chan = dma_request_slave_channel_compat(mask,
1446 shdma_chan_filter, (void *)io->dma_id,
1447 dev, is_play ? "tx" : "rx");
1448 if (io->chan) {
1449 struct dma_slave_config cfg;
1450 int ret;
1451
1452 cfg.slave_id = io->dma_id;
1453 cfg.dst_addr = 0; /* use default addr */
1454 cfg.src_addr = 0; /* use default addr */
1455 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
1456
1457 ret = dmaengine_slave_config(io->chan, &cfg);
1458 if (ret < 0) {
1459 dma_release_channel(io->chan);
1460 io->chan = NULL;
1461 }
1462 }
1463
1454 if (!io->chan) { 1464 if (!io->chan) {
1455 1465
1456 /* switch to PIO handler */ 1466 /* switch to PIO handler */
1457 if (fsi_stream_is_play(fsi, io)) 1467 if (is_play)
1458 fsi->playback.handler = &fsi_pio_push_handler; 1468 fsi->playback.handler = &fsi_pio_push_handler;
1459 else 1469 else
1460 fsi->capture.handler = &fsi_pio_pop_handler; 1470 fsi->capture.handler = &fsi_pio_pop_handler;
@@ -1777,12 +1787,6 @@ static struct snd_pcm_hardware fsi_pcm_hardware = {
1777 SNDRV_PCM_INFO_MMAP | 1787 SNDRV_PCM_INFO_MMAP |
1778 SNDRV_PCM_INFO_MMAP_VALID | 1788 SNDRV_PCM_INFO_MMAP_VALID |
1779 SNDRV_PCM_INFO_PAUSE, 1789 SNDRV_PCM_INFO_PAUSE,
1780 .formats = FSI_FMTS,
1781 .rates = FSI_RATES,
1782 .rate_min = 8000,
1783 .rate_max = 192000,
1784 .channels_min = 2,
1785 .channels_max = 2,
1786 .buffer_bytes_max = 64 * 1024, 1790 .buffer_bytes_max = 64 * 1024,
1787 .period_bytes_min = 32, 1791 .period_bytes_min = 32,
1788 .period_bytes_max = 8192, 1792 .period_bytes_max = 8192,
@@ -1960,7 +1964,7 @@ static void fsi_handler_init(struct fsi_priv *fsi,
1960 fsi->capture.priv = fsi; 1964 fsi->capture.priv = fsi;
1961 1965
1962 if (info->tx_id) { 1966 if (info->tx_id) {
1963 fsi->playback.slave.shdma_slave.slave_id = info->tx_id; 1967 fsi->playback.dma_id = info->tx_id;
1964 fsi->playback.handler = &fsi_dma_push_handler; 1968 fsi->playback.handler = &fsi_dma_push_handler;
1965 } 1969 }
1966} 1970}