diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 11:32:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 11:32:05 -0400 |
commit | 33081adf8b89d5a716d7e1c60171768d39795b39 (patch) | |
tree | 275de58bbbb5f7ddffcdc087844cfc7fbe4315be /sound/soc/davinci/davinci-i2s.c | |
parent | c55960499f810357a29659b32d6ea594abee9237 (diff) | |
parent | 506ecbca71d07fa327dd986be1682e90885678ee (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (365 commits)
ALSA: hda - Disable sticky PCM stream assignment for AD codecs
ALSA: usb - Creative USB X-Fi volume knob support
ALSA: ca0106: Use card specific dac id for mute controls.
ALSA: ca0106: Allow different sound cards to use different SPI channel mappings.
ALSA: ca0106: Create a nice spot for mapping channels to dacs.
ALSA: ca0106: Move enabling of front dac out of hardcoded setup sequence.
ALSA: ca0106: Pull out dac powering routine into separate function.
ALSA: ca0106 - add Sound Blaster 5.1vx info.
ASoC: tlv320dac33: Use usleep_range for delays
ALSA: usb-audio: add Novation Launchpad support
ALSA: hda - Add workarounds for CT-IBG controllers
ALSA: hda - Fix wrong TLV mute bit for STAC/IDT codecs
ASoC: tpa6130a2: Error handling for broken chip
ASoC: max98088: Staticise m98088_eq_band
ASoC: soc-core: Fix codec->name memory leak
ALSA: hda - Apply ideapad quirk to Acer laptops with Cxt5066
ALSA: hda - Add some workarounds for Creative IBG
ALSA: hda - Fix wrong SPDIF NID assignment for CA0110
ALSA: hda - Fix codec rename rules for ALC662-compatible codecs
ALSA: hda - Add alc_init_jacks() call to other codecs
...
Diffstat (limited to 'sound/soc/davinci/davinci-i2s.c')
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 9e8932abf158..d46b545d41f4 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -183,8 +183,7 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
183 | struct snd_pcm_substream *substream) | 183 | struct snd_pcm_substream *substream) |
184 | { | 184 | { |
185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
186 | struct snd_soc_device *socdev = rtd->socdev; | 186 | struct snd_soc_platform *platform = rtd->platform; |
187 | struct snd_soc_platform *platform = socdev->card->platform; | ||
188 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 187 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
189 | u32 spcr; | 188 | u32 spcr; |
190 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; | 189 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; |
@@ -205,8 +204,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
205 | if (playback) { | 204 | if (playback) { |
206 | /* Stop the DMA to avoid data loss */ | 205 | /* Stop the DMA to avoid data loss */ |
207 | /* while the transmitter is out of reset to handle XSYNCERR */ | 206 | /* while the transmitter is out of reset to handle XSYNCERR */ |
208 | if (platform->pcm_ops->trigger) { | 207 | if (platform->driver->ops->trigger) { |
209 | int ret = platform->pcm_ops->trigger(substream, | 208 | int ret = platform->driver->ops->trigger(substream, |
210 | SNDRV_PCM_TRIGGER_STOP); | 209 | SNDRV_PCM_TRIGGER_STOP); |
211 | if (ret < 0) | 210 | if (ret < 0) |
212 | printk(KERN_DEBUG "Playback DMA stop failed\n"); | 211 | printk(KERN_DEBUG "Playback DMA stop failed\n"); |
@@ -227,8 +226,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
227 | toggle_clock(dev, playback); | 226 | toggle_clock(dev, playback); |
228 | 227 | ||
229 | /* Restart the DMA */ | 228 | /* Restart the DMA */ |
230 | if (platform->pcm_ops->trigger) { | 229 | if (platform->driver->ops->trigger) { |
231 | int ret = platform->pcm_ops->trigger(substream, | 230 | int ret = platform->driver->ops->trigger(substream, |
232 | SNDRV_PCM_TRIGGER_START); | 231 | SNDRV_PCM_TRIGGER_START); |
233 | if (ret < 0) | 232 | if (ret < 0) |
234 | printk(KERN_DEBUG "Playback DMA start failed\n"); | 233 | printk(KERN_DEBUG "Playback DMA start failed\n"); |
@@ -263,7 +262,7 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback) | |||
263 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 262 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
264 | unsigned int fmt) | 263 | unsigned int fmt) |
265 | { | 264 | { |
266 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 265 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
267 | unsigned int pcr; | 266 | unsigned int pcr; |
268 | unsigned int srgr; | 267 | unsigned int srgr; |
269 | /* Attention srgr is updated by hw_params! */ | 268 | /* Attention srgr is updated by hw_params! */ |
@@ -404,7 +403,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
404 | static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, | 403 | static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, |
405 | int div_id, int div) | 404 | int div_id, int div) |
406 | { | 405 | { |
407 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 406 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); |
408 | 407 | ||
409 | if (div_id != DAVINCI_MCBSP_CLKGDV) | 408 | if (div_id != DAVINCI_MCBSP_CLKGDV) |
410 | return -ENODEV; | 409 | return -ENODEV; |
@@ -417,7 +416,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
417 | struct snd_pcm_hw_params *params, | 416 | struct snd_pcm_hw_params *params, |
418 | struct snd_soc_dai *dai) | 417 | struct snd_soc_dai *dai) |
419 | { | 418 | { |
420 | struct davinci_mcbsp_dev *dev = dai->private_data; | 419 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
421 | struct davinci_pcm_dma_params *dma_params = | 420 | struct davinci_pcm_dma_params *dma_params = |
422 | &dev->dma_params[substream->stream]; | 421 | &dev->dma_params[substream->stream]; |
423 | struct snd_interval *i = NULL; | 422 | struct snd_interval *i = NULL; |
@@ -427,6 +426,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
427 | snd_pcm_format_t fmt; | 426 | snd_pcm_format_t fmt; |
428 | unsigned element_cnt = 1; | 427 | unsigned element_cnt = 1; |
429 | 428 | ||
429 | dai->capture_dma_data = dev->dma_params; | ||
430 | dai->playback_dma_data = dev->dma_params; | ||
431 | |||
430 | /* general line settings */ | 432 | /* general line settings */ |
431 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 433 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
432 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 434 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
@@ -569,24 +571,18 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
569 | static int davinci_i2s_prepare(struct snd_pcm_substream *substream, | 571 | static int davinci_i2s_prepare(struct snd_pcm_substream *substream, |
570 | struct snd_soc_dai *dai) | 572 | struct snd_soc_dai *dai) |
571 | { | 573 | { |
572 | struct davinci_mcbsp_dev *dev = dai->private_data; | 574 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
573 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 575 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
574 | davinci_mcbsp_stop(dev, playback); | 576 | davinci_mcbsp_stop(dev, playback); |
575 | if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) { | ||
576 | /* codec is master */ | ||
577 | davinci_mcbsp_start(dev, substream); | ||
578 | } | ||
579 | return 0; | 577 | return 0; |
580 | } | 578 | } |
581 | 579 | ||
582 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | 580 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
583 | struct snd_soc_dai *dai) | 581 | struct snd_soc_dai *dai) |
584 | { | 582 | { |
585 | struct davinci_mcbsp_dev *dev = dai->private_data; | 583 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
586 | int ret = 0; | 584 | int ret = 0; |
587 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 585 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
588 | if ((dev->pcr & DAVINCI_MCBSP_PCR_FSXM) == 0) | ||
589 | return 0; /* return if codec is master */ | ||
590 | 586 | ||
591 | switch (cmd) { | 587 | switch (cmd) { |
592 | case SNDRV_PCM_TRIGGER_START: | 588 | case SNDRV_PCM_TRIGGER_START: |
@@ -608,7 +604,7 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
608 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | 604 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, |
609 | struct snd_soc_dai *dai) | 605 | struct snd_soc_dai *dai) |
610 | { | 606 | { |
611 | struct davinci_mcbsp_dev *dev = dai->private_data; | 607 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); |
612 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 608 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
613 | davinci_mcbsp_stop(dev, playback); | 609 | davinci_mcbsp_stop(dev, playback); |
614 | } | 610 | } |
@@ -625,9 +621,7 @@ static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | |||
625 | 621 | ||
626 | }; | 622 | }; |
627 | 623 | ||
628 | struct snd_soc_dai davinci_i2s_dai = { | 624 | static struct snd_soc_dai_driver davinci_i2s_dai = { |
629 | .name = "davinci-i2s", | ||
630 | .id = 0, | ||
631 | .playback = { | 625 | .playback = { |
632 | .channels_min = 2, | 626 | .channels_min = 2, |
633 | .channels_max = 2, | 627 | .channels_max = 2, |
@@ -641,7 +635,6 @@ struct snd_soc_dai davinci_i2s_dai = { | |||
641 | .ops = &davinci_i2s_dai_ops, | 635 | .ops = &davinci_i2s_dai_ops, |
642 | 636 | ||
643 | }; | 637 | }; |
644 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); | ||
645 | 638 | ||
646 | static int davinci_i2s_probe(struct platform_device *pdev) | 639 | static int davinci_i2s_probe(struct platform_device *pdev) |
647 | { | 640 | { |
@@ -720,10 +713,9 @@ static int davinci_i2s_probe(struct platform_device *pdev) | |||
720 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; | 713 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; |
721 | dev->dev = &pdev->dev; | 714 | dev->dev = &pdev->dev; |
722 | 715 | ||
723 | davinci_i2s_dai.private_data = dev; | 716 | dev_set_drvdata(&pdev->dev, dev); |
724 | davinci_i2s_dai.capture.dma_data = dev->dma_params; | 717 | |
725 | davinci_i2s_dai.playback.dma_data = dev->dma_params; | 718 | ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); |
726 | ret = snd_soc_register_dai(&davinci_i2s_dai); | ||
727 | if (ret != 0) | 719 | if (ret != 0) |
728 | goto err_free_mem; | 720 | goto err_free_mem; |
729 | 721 | ||
@@ -739,10 +731,10 @@ err_release_region: | |||
739 | 731 | ||
740 | static int davinci_i2s_remove(struct platform_device *pdev) | 732 | static int davinci_i2s_remove(struct platform_device *pdev) |
741 | { | 733 | { |
742 | struct davinci_mcbsp_dev *dev = davinci_i2s_dai.private_data; | 734 | struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev); |
743 | struct resource *mem; | 735 | struct resource *mem; |
744 | 736 | ||
745 | snd_soc_unregister_dai(&davinci_i2s_dai); | 737 | snd_soc_unregister_dai(&pdev->dev); |
746 | clk_disable(dev->clk); | 738 | clk_disable(dev->clk); |
747 | clk_put(dev->clk); | 739 | clk_put(dev->clk); |
748 | dev->clk = NULL; | 740 | dev->clk = NULL; |
@@ -757,7 +749,7 @@ static struct platform_driver davinci_mcbsp_driver = { | |||
757 | .probe = davinci_i2s_probe, | 749 | .probe = davinci_i2s_probe, |
758 | .remove = davinci_i2s_remove, | 750 | .remove = davinci_i2s_remove, |
759 | .driver = { | 751 | .driver = { |
760 | .name = "davinci-asp", | 752 | .name = "davinci-i2s", |
761 | .owner = THIS_MODULE, | 753 | .owner = THIS_MODULE, |
762 | }, | 754 | }, |
763 | }; | 755 | }; |