diff options
Diffstat (limited to 'sound/soc/davinci/davinci-i2s.c')
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index c8f038cb4c5e..ba5644b5fbbf 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -122,6 +122,7 @@ static const unsigned char double_fmt[SNDRV_PCM_FORMAT_S32_LE + 1] = { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | struct davinci_mcbsp_dev { | 124 | struct davinci_mcbsp_dev { |
125 | struct device *dev; | ||
125 | struct davinci_pcm_dma_params dma_params[2]; | 126 | struct davinci_pcm_dma_params dma_params[2]; |
126 | void __iomem *base; | 127 | void __iomem *base; |
127 | #define MOD_DSP_A 0 | 128 | #define MOD_DSP_A 0 |
@@ -153,6 +154,7 @@ struct davinci_mcbsp_dev { | |||
153 | 154 | ||
154 | unsigned int fmt; | 155 | unsigned int fmt; |
155 | int clk_div; | 156 | int clk_div; |
157 | int clk_input_pin; | ||
156 | }; | 158 | }; |
157 | 159 | ||
158 | static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, | 160 | static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, |
@@ -279,11 +281,26 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
279 | DAVINCI_MCBSP_PCR_CLKRM; | 281 | DAVINCI_MCBSP_PCR_CLKRM; |
280 | break; | 282 | break; |
281 | case SND_SOC_DAIFMT_CBM_CFS: | 283 | case SND_SOC_DAIFMT_CBM_CFS: |
282 | /* McBSP CLKR pin is the input for the Sample Rate Generator. | 284 | pcr = DAVINCI_MCBSP_PCR_FSRM | DAVINCI_MCBSP_PCR_FSXM; |
283 | * McBSP FSR and FSX are driven by the Sample Rate Generator. */ | 285 | /* |
284 | pcr = DAVINCI_MCBSP_PCR_SCLKME | | 286 | * Selection of the clock input pin that is the |
285 | DAVINCI_MCBSP_PCR_FSXM | | 287 | * input for the Sample Rate Generator. |
286 | DAVINCI_MCBSP_PCR_FSRM; | 288 | * McBSP FSR and FSX are driven by the Sample Rate |
289 | * Generator. | ||
290 | */ | ||
291 | switch (dev->clk_input_pin) { | ||
292 | case MCBSP_CLKS: | ||
293 | pcr |= DAVINCI_MCBSP_PCR_CLKXM | | ||
294 | DAVINCI_MCBSP_PCR_CLKRM; | ||
295 | break; | ||
296 | case MCBSP_CLKR: | ||
297 | pcr |= DAVINCI_MCBSP_PCR_SCLKME; | ||
298 | break; | ||
299 | default: | ||
300 | dev_err(dev->dev, "bad clk_input_pin\n"); | ||
301 | return -EINVAL; | ||
302 | } | ||
303 | |||
287 | break; | 304 | break; |
288 | case SND_SOC_DAIFMT_CBM_CFM: | 305 | case SND_SOC_DAIFMT_CBM_CFM: |
289 | /* codec is master */ | 306 | /* codec is master */ |
@@ -644,6 +661,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
644 | pdata->sram_size_playback; | 661 | pdata->sram_size_playback; |
645 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].sram_size = | 662 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].sram_size = |
646 | pdata->sram_size_capture; | 663 | pdata->sram_size_capture; |
664 | dev->clk_input_pin = pdata->clk_input_pin; | ||
647 | } | 665 | } |
648 | dev->clk = clk_get(&pdev->dev, NULL); | 666 | dev->clk = clk_get(&pdev->dev, NULL); |
649 | if (IS_ERR(dev->clk)) { | 667 | if (IS_ERR(dev->clk)) { |
@@ -676,6 +694,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
676 | goto err_free_mem; | 694 | goto err_free_mem; |
677 | } | 695 | } |
678 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; | 696 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; |
697 | dev->dev = &pdev->dev; | ||
679 | 698 | ||
680 | davinci_i2s_dai.private_data = dev; | 699 | davinci_i2s_dai.private_data = dev; |
681 | davinci_i2s_dai.capture.dma_data = dev->dma_params; | 700 | davinci_i2s_dai.capture.dma_data = dev->dma_params; |