diff options
Diffstat (limited to 'sound/soc/davinci/davinci-mcasp.c')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 5d1f98a4c978..79f0f4ad242c 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
22 | #include <linux/io.h> | 23 | #include <linux/io.h> |
23 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
@@ -714,16 +715,13 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
714 | struct davinci_pcm_dma_params *dma_params = | 715 | struct davinci_pcm_dma_params *dma_params = |
715 | &dev->dma_params[substream->stream]; | 716 | &dev->dma_params[substream->stream]; |
716 | int word_length; | 717 | int word_length; |
717 | u8 numevt; | 718 | u8 fifo_level; |
718 | 719 | ||
719 | davinci_hw_common_param(dev, substream->stream); | 720 | davinci_hw_common_param(dev, substream->stream); |
720 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 721 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
721 | numevt = dev->txnumevt; | 722 | fifo_level = dev->txnumevt; |
722 | else | 723 | else |
723 | numevt = dev->rxnumevt; | 724 | fifo_level = dev->rxnumevt; |
724 | |||
725 | if (!numevt) | ||
726 | numevt = 1; | ||
727 | 725 | ||
728 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) | 726 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) |
729 | davinci_hw_dit_param(dev); | 727 | davinci_hw_dit_param(dev); |
@@ -751,12 +749,12 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
751 | return -EINVAL; | 749 | return -EINVAL; |
752 | } | 750 | } |
753 | 751 | ||
754 | if (dev->version == MCASP_VERSION_2) { | 752 | if (dev->version == MCASP_VERSION_2 && !fifo_level) |
755 | dma_params->data_type *= numevt; | 753 | dma_params->acnt = 4; |
756 | dma_params->acnt = 4 * numevt; | 754 | else |
757 | } else | ||
758 | dma_params->acnt = dma_params->data_type; | 755 | dma_params->acnt = dma_params->data_type; |
759 | 756 | ||
757 | dma_params->fifo_level = fifo_level; | ||
760 | davinci_config_channel_size(dev, word_length); | 758 | davinci_config_channel_size(dev, word_length); |
761 | 759 | ||
762 | return 0; | 760 | return 0; |
@@ -770,14 +768,26 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
770 | int ret = 0; | 768 | int ret = 0; |
771 | 769 | ||
772 | switch (cmd) { | 770 | switch (cmd) { |
773 | case SNDRV_PCM_TRIGGER_START: | ||
774 | case SNDRV_PCM_TRIGGER_RESUME: | 771 | case SNDRV_PCM_TRIGGER_RESUME: |
772 | case SNDRV_PCM_TRIGGER_START: | ||
775 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 773 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
774 | if (!dev->clk_active) { | ||
775 | clk_enable(dev->clk); | ||
776 | dev->clk_active = 1; | ||
777 | } | ||
776 | davinci_mcasp_start(dev, substream->stream); | 778 | davinci_mcasp_start(dev, substream->stream); |
777 | break; | 779 | break; |
778 | 780 | ||
779 | case SNDRV_PCM_TRIGGER_STOP: | ||
780 | case SNDRV_PCM_TRIGGER_SUSPEND: | 781 | case SNDRV_PCM_TRIGGER_SUSPEND: |
782 | davinci_mcasp_stop(dev, substream->stream); | ||
783 | if (dev->clk_active) { | ||
784 | clk_disable(dev->clk); | ||
785 | dev->clk_active = 0; | ||
786 | } | ||
787 | |||
788 | break; | ||
789 | |||
790 | case SNDRV_PCM_TRIGGER_STOP: | ||
781 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 791 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
782 | davinci_mcasp_stop(dev, substream->stream); | 792 | davinci_mcasp_stop(dev, substream->stream); |
783 | break; | 793 | break; |
@@ -869,6 +879,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
869 | } | 879 | } |
870 | 880 | ||
871 | clk_enable(dev->clk); | 881 | clk_enable(dev->clk); |
882 | dev->clk_active = 1; | ||
872 | 883 | ||
873 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); | 884 | dev->base = (void __iomem *)IO_ADDRESS(mem->start); |
874 | dev->op_mode = pdata->op_mode; | 885 | dev->op_mode = pdata->op_mode; |
@@ -907,6 +918,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
907 | 918 | ||
908 | dma_data->channel = res->start; | 919 | dma_data->channel = res->start; |
909 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; | 920 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; |
921 | davinci_mcasp_dai[pdata->op_mode].capture.dma_data = dev->dma_params; | ||
922 | davinci_mcasp_dai[pdata->op_mode].playback.dma_data = dev->dma_params; | ||
910 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; | 923 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; |
911 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); | 924 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); |
912 | 925 | ||