aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/tegra
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-04-03 05:06:03 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-03 13:13:34 -0400
commit3489d5067a2cd8c51a2649b2f39bfb5b11852b8d (patch)
treef8dc9541af71beb7c9ed0f2eec97bc90152489f2 /sound/soc/tegra
parent09ae3aaf3cd28422d76b7b78d9491b17330b276a (diff)
ASoC: tegra: Use common DAI DMA data struct
Use the common DAI DMA data struct for tegra, this allows us to use the common helper function to configure the DMA slave config based on the DAI DMA data. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r--sound/soc/tegra/tegra20_ac97.c13
-rw-r--r--sound/soc/tegra/tegra20_ac97.h4
-rw-r--r--sound/soc/tegra/tegra20_i2s.c13
-rw-r--r--sound/soc/tegra/tegra20_i2s.h4
-rw-r--r--sound/soc/tegra/tegra20_spdif.c7
-rw-r--r--sound/soc/tegra/tegra20_spdif.h4
-rw-r--r--sound/soc/tegra/tegra30_ahub.c8
-rw-r--r--sound/soc/tegra/tegra30_ahub.h8
-rw-r--r--sound/soc/tegra/tegra30_i2s.c13
-rw-r--r--sound/soc/tegra/tegra30_i2s.h4
-rw-r--r--sound/soc/tegra/tegra_pcm.c16
-rw-r--r--sound/soc/tegra/tegra_pcm.h7
12 files changed, 44 insertions, 57 deletions
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 336dcdd3e8a4..2d7b8c2719ce 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -35,6 +35,7 @@
35#include <sound/pcm.h> 35#include <sound/pcm.h>
36#include <sound/pcm_params.h> 36#include <sound/pcm_params.h>
37#include <sound/soc.h> 37#include <sound/soc.h>
38#include <sound/dmaengine_pcm.h>
38 39
39#include "tegra_asoc_utils.h" 40#include "tegra_asoc_utils.h"
40#include "tegra20_ac97.h" 41#include "tegra20_ac97.h"
@@ -389,14 +390,14 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
389 } 390 }
390 391
391 ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1; 392 ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1;
392 ac97->capture_dma_data.wrap = 4; 393 ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
393 ac97->capture_dma_data.width = 32; 394 ac97->capture_dma_data.maxburst = 4;
394 ac97->capture_dma_data.req_sel = of_dma[1]; 395 ac97->capture_dma_data.slave_id = of_dma[1];
395 396
396 ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1; 397 ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1;
397 ac97->playback_dma_data.wrap = 4; 398 ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
398 ac97->playback_dma_data.width = 32; 399 ac97->capture_dma_data.maxburst = 4;
399 ac97->playback_dma_data.req_sel = of_dma[1]; 400 ac97->capture_dma_data.slave_id = of_dma[0];
400 401
401 ret = snd_soc_register_dais(&pdev->dev, &tegra20_ac97_dai, 1); 402 ret = snd_soc_register_dais(&pdev->dev, &tegra20_ac97_dai, 1);
402 if (ret) { 403 if (ret) {
diff --git a/sound/soc/tegra/tegra20_ac97.h b/sound/soc/tegra/tegra20_ac97.h
index dddc6828004e..4acb3aaba29b 100644
--- a/sound/soc/tegra/tegra20_ac97.h
+++ b/sound/soc/tegra/tegra20_ac97.h
@@ -85,8 +85,8 @@
85 85
86struct tegra20_ac97 { 86struct tegra20_ac97 {
87 struct clk *clk_ac97; 87 struct clk *clk_ac97;
88 struct tegra_pcm_dma_params capture_dma_data; 88 struct snd_dmaengine_dai_dma_data capture_dma_data;
89 struct tegra_pcm_dma_params playback_dma_data; 89 struct snd_dmaengine_dai_dma_data playback_dma_data;
90 struct regmap *regmap; 90 struct regmap *regmap;
91 int reset_gpio; 91 int reset_gpio;
92 int sync_gpio; 92 int sync_gpio;
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index caa772de5a18..e6651e0eaeed 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -41,6 +41,7 @@
41#include <sound/pcm.h> 41#include <sound/pcm.h>
42#include <sound/pcm_params.h> 42#include <sound/pcm_params.h>
43#include <sound/soc.h> 43#include <sound/soc.h>
44#include <sound/dmaengine_pcm.h>
44 45
45#include "tegra20_i2s.h" 46#include "tegra20_i2s.h"
46 47
@@ -403,14 +404,14 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev)
403 } 404 }
404 405
405 i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2; 406 i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2;
406 i2s->capture_dma_data.wrap = 4; 407 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
407 i2s->capture_dma_data.width = 32; 408 i2s->capture_dma_data.maxburst = 4;
408 i2s->capture_dma_data.req_sel = dma_ch; 409 i2s->capture_dma_data.slave_id = dma_ch;
409 410
410 i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1; 411 i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1;
411 i2s->playback_dma_data.wrap = 4; 412 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
412 i2s->playback_dma_data.width = 32; 413 i2s->playback_dma_data.maxburst = 4;
413 i2s->playback_dma_data.req_sel = dma_ch; 414 i2s->playback_dma_data.slave_id = dma_ch;
414 415
415 pm_runtime_enable(&pdev->dev); 416 pm_runtime_enable(&pdev->dev);
416 if (!pm_runtime_enabled(&pdev->dev)) { 417 if (!pm_runtime_enabled(&pdev->dev)) {
diff --git a/sound/soc/tegra/tegra20_i2s.h b/sound/soc/tegra/tegra20_i2s.h
index 729958713cd4..fa6c29cc12b9 100644
--- a/sound/soc/tegra/tegra20_i2s.h
+++ b/sound/soc/tegra/tegra20_i2s.h
@@ -155,8 +155,8 @@
155struct tegra20_i2s { 155struct tegra20_i2s {
156 struct snd_soc_dai_driver dai; 156 struct snd_soc_dai_driver dai;
157 struct clk *clk_i2s; 157 struct clk *clk_i2s;
158 struct tegra_pcm_dma_params capture_dma_data; 158 struct snd_dmaengine_dai_dma_data capture_dma_data;
159 struct tegra_pcm_dma_params playback_dma_data; 159 struct snd_dmaengine_dai_dma_data playback_dma_data;
160 struct regmap *regmap; 160 struct regmap *regmap;
161}; 161};
162 162
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 04771d14d343..b7b4743cc94d 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -32,6 +32,7 @@
32#include <sound/pcm.h> 32#include <sound/pcm.h>
33#include <sound/pcm_params.h> 33#include <sound/pcm_params.h>
34#include <sound/soc.h> 34#include <sound/soc.h>
35#include <sound/dmaengine_pcm.h>
35 36
36#include "tegra20_spdif.h" 37#include "tegra20_spdif.h"
37 38
@@ -318,9 +319,9 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev)
318 } 319 }
319 320
320 spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT; 321 spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT;
321 spdif->playback_dma_data.wrap = 4; 322 spdif->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
322 spdif->playback_dma_data.width = 32; 323 spdif->capture_dma_data.maxburst = 4;
323 spdif->playback_dma_data.req_sel = dmareq->start; 324 spdif->playback_dma_data.slave_id = dmareq->start;
324 325
325 pm_runtime_enable(&pdev->dev); 326 pm_runtime_enable(&pdev->dev);
326 if (!pm_runtime_enabled(&pdev->dev)) { 327 if (!pm_runtime_enabled(&pdev->dev)) {
diff --git a/sound/soc/tegra/tegra20_spdif.h b/sound/soc/tegra/tegra20_spdif.h
index b48d699fd583..85a9aefcc287 100644
--- a/sound/soc/tegra/tegra20_spdif.h
+++ b/sound/soc/tegra/tegra20_spdif.h
@@ -462,8 +462,8 @@
462 462
463struct tegra20_spdif { 463struct tegra20_spdif {
464 struct clk *clk_spdif_out; 464 struct clk *clk_spdif_out;
465 struct tegra_pcm_dma_params capture_dma_data; 465 struct snd_dmaengine_dai_dma_data capture_dma_data;
466 struct tegra_pcm_dma_params playback_dma_data; 466 struct snd_dmaengine_dai_dma_data playback_dma_data;
467 struct regmap *regmap; 467 struct regmap *regmap;
468}; 468};
469 469
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index e5cfb4ac41ba..5e08f3e7e6cf 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -95,8 +95,8 @@ static int tegra30_ahub_runtime_resume(struct device *dev)
95} 95}
96 96
97int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, 97int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
98 unsigned long *fiforeg, 98 dma_addr_t *fiforeg,
99 unsigned long *reqsel) 99 unsigned int *reqsel)
100{ 100{
101 int channel; 101 int channel;
102 u32 reg, val; 102 u32 reg, val;
@@ -178,8 +178,8 @@ int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif)
178EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo); 178EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
179 179
180int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, 180int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
181 unsigned long *fiforeg, 181 dma_addr_t *fiforeg,
182 unsigned long *reqsel) 182 unsigned int *reqsel)
183{ 183{
184 int channel; 184 int channel;
185 u32 reg, val; 185 u32 reg, val;
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h
index e690e2eecc92..b7d7c1a30302 100644
--- a/sound/soc/tegra/tegra30_ahub.h
+++ b/sound/soc/tegra/tegra30_ahub.h
@@ -451,15 +451,15 @@ enum tegra30_ahub_rxcif {
451}; 451};
452 452
453extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif, 453extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
454 unsigned long *fiforeg, 454 dma_addr_t *fiforeg,
455 unsigned long *reqsel); 455 unsigned int *reqsel);
456extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif); 456extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
457extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif); 457extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
458extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif); 458extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
459 459
460extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif, 460extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
461 unsigned long *fiforeg, 461 dma_addr_t *fiforeg,
462 unsigned long *reqsel); 462 unsigned int *reqsel);
463extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif); 463extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
464extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif); 464extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
465extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif); 465extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index f4e1ce82750a..857ec21e3c7d 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -38,6 +38,7 @@
38#include <sound/pcm.h> 38#include <sound/pcm.h>
39#include <sound/pcm_params.h> 39#include <sound/pcm_params.h>
40#include <sound/soc.h> 40#include <sound/soc.h>
41#include <sound/dmaengine_pcm.h>
41 42
42#include "tegra30_ahub.h" 43#include "tegra30_ahub.h"
43#include "tegra30_i2s.h" 44#include "tegra30_i2s.h"
@@ -80,17 +81,17 @@ static int tegra30_i2s_startup(struct snd_pcm_substream *substream,
80 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 81 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
81 ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif, 82 ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif,
82 &i2s->playback_dma_data.addr, 83 &i2s->playback_dma_data.addr,
83 &i2s->playback_dma_data.req_sel); 84 &i2s->playback_dma_data.slave_id);
84 i2s->playback_dma_data.wrap = 4; 85 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
85 i2s->playback_dma_data.width = 32; 86 i2s->playback_dma_data.maxburst = 4;
86 tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif, 87 tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif,
87 i2s->playback_fifo_cif); 88 i2s->playback_fifo_cif);
88 } else { 89 } else {
89 ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif, 90 ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif,
90 &i2s->capture_dma_data.addr, 91 &i2s->capture_dma_data.addr,
91 &i2s->capture_dma_data.req_sel); 92 &i2s->capture_dma_data.slave_id);
92 i2s->capture_dma_data.wrap = 4; 93 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
93 i2s->capture_dma_data.width = 32; 94 i2s->capture_dma_data.maxburst = 4;
94 tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif, 95 tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif,
95 i2s->capture_i2s_cif); 96 i2s->capture_i2s_cif);
96 } 97 }
diff --git a/sound/soc/tegra/tegra30_i2s.h b/sound/soc/tegra/tegra30_i2s.h
index a294d942b9f7..bea23afe3b9f 100644
--- a/sound/soc/tegra/tegra30_i2s.h
+++ b/sound/soc/tegra/tegra30_i2s.h
@@ -231,10 +231,10 @@ struct tegra30_i2s {
231 struct clk *clk_i2s; 231 struct clk *clk_i2s;
232 enum tegra30_ahub_txcif capture_i2s_cif; 232 enum tegra30_ahub_txcif capture_i2s_cif;
233 enum tegra30_ahub_rxcif capture_fifo_cif; 233 enum tegra30_ahub_rxcif capture_fifo_cif;
234 struct tegra_pcm_dma_params capture_dma_data; 234 struct snd_dmaengine_dai_dma_data capture_dma_data;
235 enum tegra30_ahub_rxcif playback_i2s_cif; 235 enum tegra30_ahub_rxcif playback_i2s_cif;
236 enum tegra30_ahub_txcif playback_fifo_cif; 236 enum tegra30_ahub_txcif playback_fifo_cif;
237 struct tegra_pcm_dma_params playback_dma_data; 237 struct snd_dmaengine_dai_dma_data playback_dma_data;
238 struct regmap *regmap; 238 struct regmap *regmap;
239}; 239};
240 240
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index e67af0b5d35d..f91d08bc1753 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -81,12 +81,9 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
81 struct snd_soc_pcm_runtime *rtd = substream->private_data; 81 struct snd_soc_pcm_runtime *rtd = substream->private_data;
82 struct device *dev = rtd->platform->dev; 82 struct device *dev = rtd->platform->dev;
83 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); 83 struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
84 struct tegra_pcm_dma_params *dmap;
85 struct dma_slave_config slave_config; 84 struct dma_slave_config slave_config;
86 int ret; 85 int ret;
87 86
88 dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
89
90 ret = snd_hwparams_to_dma_slave_config(substream, params, 87 ret = snd_hwparams_to_dma_slave_config(substream, params,
91 &slave_config); 88 &slave_config);
92 if (ret) { 89 if (ret) {
@@ -94,16 +91,9 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
94 return ret; 91 return ret;
95 } 92 }
96 93
97 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 94 snd_dmaengine_pcm_set_config_from_dai_data(substream,
98 slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 95 snd_soc_dai_get_dma_data(rtd->cpu_dai, substream),
99 slave_config.dst_addr = dmap->addr; 96 &slave_config);
100 slave_config.dst_maxburst = 4;
101 } else {
102 slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
103 slave_config.src_addr = dmap->addr;
104 slave_config.src_maxburst = 4;
105 }
106 slave_config.slave_id = dmap->req_sel;
107 97
108 ret = dmaengine_slave_config(chan, &slave_config); 98 ret = dmaengine_slave_config(chan, &slave_config);
109 if (ret < 0) { 99 if (ret < 0) {
diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h
index bc8b46af928e..68ad901714a9 100644
--- a/sound/soc/tegra/tegra_pcm.h
+++ b/sound/soc/tegra/tegra_pcm.h
@@ -31,13 +31,6 @@
31#ifndef __TEGRA_PCM_H__ 31#ifndef __TEGRA_PCM_H__
32#define __TEGRA_PCM_H__ 32#define __TEGRA_PCM_H__
33 33
34struct tegra_pcm_dma_params {
35 unsigned long addr;
36 unsigned long wrap;
37 unsigned long width;
38 unsigned long req_sel;
39};
40
41int tegra_pcm_platform_register(struct device *dev); 34int tegra_pcm_platform_register(struct device *dev);
42void tegra_pcm_platform_unregister(struct device *dev); 35void tegra_pcm_platform_unregister(struct device *dev);
43 36