diff options
Diffstat (limited to 'sound/soc/davinci/davinci-mcasp.c')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 7a06c0a86665..3174d96d929f 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -332,14 +332,6 @@ static inline void mcasp_set_ctl_reg(void __iomem *regs, u32 val) | |||
332 | printk(KERN_ERR "GBLCTL write error\n"); | 332 | printk(KERN_ERR "GBLCTL write error\n"); |
333 | } | 333 | } |
334 | 334 | ||
335 | static int davinci_mcasp_startup(struct snd_pcm_substream *substream, | ||
336 | struct snd_soc_dai *cpu_dai) | ||
337 | { | ||
338 | struct davinci_audio_dev *dev = cpu_dai->private_data; | ||
339 | cpu_dai->dma_data = dev->dma_params[substream->stream]; | ||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static void mcasp_start_rx(struct davinci_audio_dev *dev) | 335 | static void mcasp_start_rx(struct davinci_audio_dev *dev) |
344 | { | 336 | { |
345 | mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); | 337 | mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); |
@@ -720,7 +712,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
720 | { | 712 | { |
721 | struct davinci_audio_dev *dev = cpu_dai->private_data; | 713 | struct davinci_audio_dev *dev = cpu_dai->private_data; |
722 | struct davinci_pcm_dma_params *dma_params = | 714 | struct davinci_pcm_dma_params *dma_params = |
723 | dev->dma_params[substream->stream]; | 715 | &dev->dma_params[substream->stream]; |
724 | int word_length; | 716 | int word_length; |
725 | u8 numevt; | 717 | u8 numevt; |
726 | 718 | ||
@@ -798,7 +790,6 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
798 | } | 790 | } |
799 | 791 | ||
800 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | 792 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { |
801 | .startup = davinci_mcasp_startup, | ||
802 | .trigger = davinci_mcasp_trigger, | 793 | .trigger = davinci_mcasp_trigger, |
803 | .hw_params = davinci_mcasp_hw_params, | 794 | .hw_params = davinci_mcasp_hw_params, |
804 | .set_fmt = davinci_mcasp_set_dai_fmt, | 795 | .set_fmt = davinci_mcasp_set_dai_fmt, |
@@ -849,20 +840,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
849 | struct resource *mem, *ioarea, *res; | 840 | struct resource *mem, *ioarea, *res; |
850 | struct snd_platform_data *pdata; | 841 | struct snd_platform_data *pdata; |
851 | struct davinci_audio_dev *dev; | 842 | struct davinci_audio_dev *dev; |
852 | int count = 0; | ||
853 | int ret = 0; | 843 | int ret = 0; |
854 | 844 | ||
855 | dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); | 845 | dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); |
856 | if (!dev) | 846 | if (!dev) |
857 | return -ENOMEM; | 847 | return -ENOMEM; |
858 | 848 | ||
859 | dma_data = kzalloc(sizeof(struct davinci_pcm_dma_params) * 2, | ||
860 | GFP_KERNEL); | ||
861 | if (!dma_data) { | ||
862 | ret = -ENOMEM; | ||
863 | goto err_release_dev; | ||
864 | } | ||
865 | |||
866 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 849 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
867 | if (!mem) { | 850 | if (!mem) { |
868 | dev_err(&pdev->dev, "no mem resource?\n"); | 851 | dev_err(&pdev->dev, "no mem resource?\n"); |
@@ -897,11 +880,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
897 | dev->txnumevt = pdata->txnumevt; | 880 | dev->txnumevt = pdata->txnumevt; |
898 | dev->rxnumevt = pdata->rxnumevt; | 881 | dev->rxnumevt = pdata->rxnumevt; |
899 | 882 | ||
900 | dma_data[count].name = "I2S PCM Stereo out"; | 883 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; |
901 | dma_data[count].eventq_no = pdata->eventq_no; | 884 | dma_data->eventq_no = pdata->eventq_no; |
902 | dma_data[count].dma_addr = (dma_addr_t) (pdata->tx_dma_offset + | 885 | dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + |
903 | io_v2p(dev->base)); | 886 | io_v2p(dev->base)); |
904 | dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &dma_data[count]; | ||
905 | 887 | ||
906 | /* first TX, then RX */ | 888 | /* first TX, then RX */ |
907 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 889 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
@@ -910,13 +892,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
910 | goto err_release_region; | 892 | goto err_release_region; |
911 | } | 893 | } |
912 | 894 | ||
913 | dma_data[count].channel = res->start; | 895 | dma_data->channel = res->start; |
914 | count++; | 896 | |
915 | dma_data[count].name = "I2S PCM Stereo in"; | 897 | dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; |
916 | dma_data[count].eventq_no = pdata->eventq_no; | 898 | dma_data->eventq_no = pdata->eventq_no; |
917 | dma_data[count].dma_addr = (dma_addr_t)(pdata->rx_dma_offset + | 899 | dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + |
918 | io_v2p(dev->base)); | 900 | io_v2p(dev->base)); |
919 | dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &dma_data[count]; | ||
920 | 901 | ||
921 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 902 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
922 | if (!res) { | 903 | if (!res) { |
@@ -924,7 +905,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
924 | goto err_release_region; | 905 | goto err_release_region; |
925 | } | 906 | } |
926 | 907 | ||
927 | dma_data[count].channel = res->start; | 908 | dma_data->channel = res->start; |
928 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; | 909 | davinci_mcasp_dai[pdata->op_mode].private_data = dev; |
929 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; | 910 | davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; |
930 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); | 911 | ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); |
@@ -936,8 +917,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
936 | err_release_region: | 917 | err_release_region: |
937 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 918 | release_mem_region(mem->start, (mem->end - mem->start) + 1); |
938 | err_release_data: | 919 | err_release_data: |
939 | kfree(dma_data); | ||
940 | err_release_dev: | ||
941 | kfree(dev); | 920 | kfree(dev); |
942 | 921 | ||
943 | return ret; | 922 | return ret; |
@@ -946,7 +925,6 @@ err_release_dev: | |||
946 | static int davinci_mcasp_remove(struct platform_device *pdev) | 925 | static int davinci_mcasp_remove(struct platform_device *pdev) |
947 | { | 926 | { |
948 | struct snd_platform_data *pdata = pdev->dev.platform_data; | 927 | struct snd_platform_data *pdata = pdev->dev.platform_data; |
949 | struct davinci_pcm_dma_params *dma_data; | ||
950 | struct davinci_audio_dev *dev; | 928 | struct davinci_audio_dev *dev; |
951 | struct resource *mem; | 929 | struct resource *mem; |
952 | 930 | ||
@@ -959,8 +937,6 @@ static int davinci_mcasp_remove(struct platform_device *pdev) | |||
959 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 937 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
960 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 938 | release_mem_region(mem->start, (mem->end - mem->start) + 1); |
961 | 939 | ||
962 | dma_data = dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; | ||
963 | kfree(dma_data); | ||
964 | kfree(dev); | 940 | kfree(dev); |
965 | 941 | ||
966 | return 0; | 942 | return 0; |