aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-i2s.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-10-03 12:31:22 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-03 12:31:22 -0400
commita1cb9cd69750d6d62251393738efc02d252b67d3 (patch)
tree5c68b23180e6ca127d1048cdbf723ca447551123 /sound/soc/davinci/davinci-i2s.c
parent08d1e635089f41e28fec644a8620a0e8d66b1235 (diff)
parent834eb6c599a8efa1fe9b77d469562e0c78c876e1 (diff)
Merge branch 'fix/asoc' into for-linus
Diffstat (limited to 'sound/soc/davinci/davinci-i2s.c')
-rw-r--r--sound/soc/davinci/davinci-i2s.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 12a6c549ee6e..4ae707048021 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -97,22 +97,19 @@ enum {
97 DAVINCI_MCBSP_WORD_32, 97 DAVINCI_MCBSP_WORD_32,
98}; 98};
99 99
100static struct davinci_pcm_dma_params davinci_i2s_pcm_out = {
101 .name = "I2S PCM Stereo out",
102};
103
104static struct davinci_pcm_dma_params davinci_i2s_pcm_in = {
105 .name = "I2S PCM Stereo in",
106};
107
108struct davinci_mcbsp_dev { 100struct davinci_mcbsp_dev {
101 /*
102 * dma_params must be first because rtd->dai->cpu_dai->private_data
103 * is cast to a pointer of an array of struct davinci_pcm_dma_params in
104 * davinci_pcm_open.
105 */
106 struct davinci_pcm_dma_params dma_params[2];
109 void __iomem *base; 107 void __iomem *base;
110#define MOD_DSP_A 0 108#define MOD_DSP_A 0
111#define MOD_DSP_B 1 109#define MOD_DSP_B 1
112 int mode; 110 int mode;
113 u32 pcr; 111 u32 pcr;
114 struct clk *clk; 112 struct clk *clk;
115 struct davinci_pcm_dma_params *dma_params[2];
116}; 113};
117 114
118static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, 115static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
@@ -215,14 +212,6 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback)
215 toggle_clock(dev, playback); 212 toggle_clock(dev, playback);
216} 213}
217 214
218static int davinci_i2s_startup(struct snd_pcm_substream *substream,
219 struct snd_soc_dai *cpu_dai)
220{
221 struct davinci_mcbsp_dev *dev = cpu_dai->private_data;
222 cpu_dai->dma_data = dev->dma_params[substream->stream];
223 return 0;
224}
225
226#define DEFAULT_BITPERSAMPLE 16 215#define DEFAULT_BITPERSAMPLE 16
227 216
228static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, 217static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
@@ -353,8 +342,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
353 struct snd_pcm_hw_params *params, 342 struct snd_pcm_hw_params *params,
354 struct snd_soc_dai *dai) 343 struct snd_soc_dai *dai)
355{ 344{
356 struct davinci_pcm_dma_params *dma_params = dai->dma_data;
357 struct davinci_mcbsp_dev *dev = dai->private_data; 345 struct davinci_mcbsp_dev *dev = dai->private_data;
346 struct davinci_pcm_dma_params *dma_params =
347 &dev->dma_params[substream->stream];
358 struct snd_interval *i = NULL; 348 struct snd_interval *i = NULL;
359 int mcbsp_word_length; 349 int mcbsp_word_length;
360 unsigned int rcr, xcr, srgr; 350 unsigned int rcr, xcr, srgr;
@@ -472,7 +462,6 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
472#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 462#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
473 463
474static struct snd_soc_dai_ops davinci_i2s_dai_ops = { 464static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
475 .startup = davinci_i2s_startup,
476 .shutdown = davinci_i2s_shutdown, 465 .shutdown = davinci_i2s_shutdown,
477 .prepare = davinci_i2s_prepare, 466 .prepare = davinci_i2s_prepare,
478 .trigger = davinci_i2s_trigger, 467 .trigger = davinci_i2s_trigger,
@@ -534,12 +523,10 @@ static int davinci_i2s_probe(struct platform_device *pdev)
534 523
535 dev->base = (void __iomem *)IO_ADDRESS(mem->start); 524 dev->base = (void __iomem *)IO_ADDRESS(mem->start);
536 525
537 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &davinci_i2s_pcm_out; 526 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr =
538 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->dma_addr =
539 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); 527 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG);
540 528
541 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &davinci_i2s_pcm_in; 529 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
542 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->dma_addr =
543 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); 530 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG);
544 531
545 /* first TX, then RX */ 532 /* first TX, then RX */
@@ -549,7 +536,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
549 ret = -ENXIO; 536 ret = -ENXIO;
550 goto err_free_mem; 537 goto err_free_mem;
551 } 538 }
552 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->channel = res->start; 539 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
553 540
554 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 541 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
555 if (!res) { 542 if (!res) {
@@ -557,7 +544,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
557 ret = -ENXIO; 544 ret = -ENXIO;
558 goto err_free_mem; 545 goto err_free_mem;
559 } 546 }
560 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->channel = res->start; 547 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
561 548
562 davinci_i2s_dai.private_data = dev; 549 davinci_i2s_dai.private_data = dev;
563 ret = snd_soc_register_dai(&davinci_i2s_dai); 550 ret = snd_soc_register_dai(&davinci_i2s_dai);