aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-i2s.c28
-rw-r--r--sound/soc/davinci/davinci-mcasp.c29
2 files changed, 39 insertions, 18 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 9e0e565e6ed9..d0d60b8a54d4 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -658,7 +658,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
658 return -ENODEV; 658 return -ENODEV;
659 } 659 }
660 660
661 ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, 661 ioarea = request_mem_region(mem->start, resource_size(mem),
662 pdev->name); 662 pdev->name);
663 if (!ioarea) { 663 if (!ioarea) {
664 dev_err(&pdev->dev, "McBSP region already claimed\n"); 664 dev_err(&pdev->dev, "McBSP region already claimed\n");
@@ -694,20 +694,25 @@ static int davinci_i2s_probe(struct platform_device *pdev)
694 } 694 }
695 clk_enable(dev->clk); 695 clk_enable(dev->clk);
696 696
697 dev->base = (void __iomem *)IO_ADDRESS(mem->start); 697 dev->base = ioremap(mem->start, resource_size(mem));
698 if (!dev->base) {
699 dev_err(&pdev->dev, "ioremap failed\n");
700 ret = -ENOMEM;
701 goto err_release_clk;
702 }
698 703
699 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = 704 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr =
700 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); 705 (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
701 706
702 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = 707 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
703 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); 708 (dma_addr_t)(mem->start + DAVINCI_MCBSP_DRR_REG);
704 709
705 /* first TX, then RX */ 710 /* first TX, then RX */
706 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 711 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
707 if (!res) { 712 if (!res) {
708 dev_err(&pdev->dev, "no DMA resource\n"); 713 dev_err(&pdev->dev, "no DMA resource\n");
709 ret = -ENXIO; 714 ret = -ENXIO;
710 goto err_free_mem; 715 goto err_iounmap;
711 } 716 }
712 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; 717 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
713 718
@@ -715,7 +720,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
715 if (!res) { 720 if (!res) {
716 dev_err(&pdev->dev, "no DMA resource\n"); 721 dev_err(&pdev->dev, "no DMA resource\n");
717 ret = -ENXIO; 722 ret = -ENXIO;
718 goto err_free_mem; 723 goto err_iounmap;
719 } 724 }
720 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; 725 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
721 dev->dev = &pdev->dev; 726 dev->dev = &pdev->dev;
@@ -724,14 +729,19 @@ static int davinci_i2s_probe(struct platform_device *pdev)
724 729
725 ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); 730 ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
726 if (ret != 0) 731 if (ret != 0)
727 goto err_free_mem; 732 goto err_iounmap;
728 733
729 return 0; 734 return 0;
730 735
736err_iounmap:
737 iounmap(dev->base);
738err_release_clk:
739 clk_disable(dev->clk);
740 clk_put(dev->clk);
731err_free_mem: 741err_free_mem:
732 kfree(dev); 742 kfree(dev);
733err_release_region: 743err_release_region:
734 release_mem_region(mem->start, (mem->end - mem->start) + 1); 744 release_mem_region(mem->start, resource_size(mem));
735 745
736 return ret; 746 return ret;
737} 747}
@@ -747,7 +757,7 @@ static int davinci_i2s_remove(struct platform_device *pdev)
747 dev->clk = NULL; 757 dev->clk = NULL;
748 kfree(dev); 758 kfree(dev);
749 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 759 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
750 release_mem_region(mem->start, (mem->end - mem->start) + 1); 760 release_mem_region(mem->start, resource_size(mem));
751 761
752 return 0; 762 return 0;
753} 763}
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index fb55d2c5d704..a5af834c8ef5 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -868,7 +868,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
868 } 868 }
869 869
870 ioarea = request_mem_region(mem->start, 870 ioarea = request_mem_region(mem->start,
871 (mem->end - mem->start) + 1, pdev->name); 871 resource_size(mem), pdev->name);
872 if (!ioarea) { 872 if (!ioarea) {
873 dev_err(&pdev->dev, "Audio region already claimed\n"); 873 dev_err(&pdev->dev, "Audio region already claimed\n");
874 ret = -EBUSY; 874 ret = -EBUSY;
@@ -885,7 +885,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
885 clk_enable(dev->clk); 885 clk_enable(dev->clk);
886 dev->clk_active = 1; 886 dev->clk_active = 1;
887 887
888 dev->base = (void __iomem *)IO_ADDRESS(mem->start); 888 dev->base = ioremap(mem->start, resource_size(mem));
889 if (!dev->base) {
890 dev_err(&pdev->dev, "ioremap failed\n");
891 ret = -ENOMEM;
892 goto err_release_clk;
893 }
894
889 dev->op_mode = pdata->op_mode; 895 dev->op_mode = pdata->op_mode;
890 dev->tdm_slots = pdata->tdm_slots; 896 dev->tdm_slots = pdata->tdm_slots;
891 dev->num_serializer = pdata->num_serializer; 897 dev->num_serializer = pdata->num_serializer;
@@ -899,14 +905,14 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
899 dma_data->asp_chan_q = pdata->asp_chan_q; 905 dma_data->asp_chan_q = pdata->asp_chan_q;
900 dma_data->ram_chan_q = pdata->ram_chan_q; 906 dma_data->ram_chan_q = pdata->ram_chan_q;
901 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + 907 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
902 io_v2p(dev->base)); 908 mem->start);
903 909
904 /* first TX, then RX */ 910 /* first TX, then RX */
905 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 911 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
906 if (!res) { 912 if (!res) {
907 dev_err(&pdev->dev, "no DMA resource\n"); 913 dev_err(&pdev->dev, "no DMA resource\n");
908 ret = -ENODEV; 914 ret = -ENODEV;
909 goto err_release_region; 915 goto err_iounmap;
910 } 916 }
911 917
912 dma_data->channel = res->start; 918 dma_data->channel = res->start;
@@ -915,13 +921,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
915 dma_data->asp_chan_q = pdata->asp_chan_q; 921 dma_data->asp_chan_q = pdata->asp_chan_q;
916 dma_data->ram_chan_q = pdata->ram_chan_q; 922 dma_data->ram_chan_q = pdata->ram_chan_q;
917 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + 923 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
918 io_v2p(dev->base)); 924 mem->start);
919 925
920 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 926 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
921 if (!res) { 927 if (!res) {
922 dev_err(&pdev->dev, "no DMA resource\n"); 928 dev_err(&pdev->dev, "no DMA resource\n");
923 ret = -ENODEV; 929 ret = -ENODEV;
924 goto err_release_region; 930 goto err_iounmap;
925 } 931 }
926 932
927 dma_data->channel = res->start; 933 dma_data->channel = res->start;
@@ -929,11 +935,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
929 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); 935 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
930 936
931 if (ret != 0) 937 if (ret != 0)
932 goto err_release_region; 938 goto err_iounmap;
933 return 0; 939 return 0;
934 940
941err_iounmap:
942 iounmap(dev->base);
943err_release_clk:
944 clk_disable(dev->clk);
945 clk_put(dev->clk);
935err_release_region: 946err_release_region:
936 release_mem_region(mem->start, (mem->end - mem->start) + 1); 947 release_mem_region(mem->start, resource_size(mem));
937err_release_data: 948err_release_data:
938 kfree(dev); 949 kfree(dev);
939 950
@@ -951,7 +962,7 @@ static int davinci_mcasp_remove(struct platform_device *pdev)
951 dev->clk = NULL; 962 dev->clk = NULL;
952 963
953 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 964 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
954 release_mem_region(mem->start, (mem->end - mem->start) + 1); 965 release_mem_region(mem->start, resource_size(mem));
955 966
956 kfree(dev); 967 kfree(dev);
957 968