aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2013-04-23 00:28:07 -0500
committerMisael Lopez Cruz2013-07-22 15:04:17 -0500
commit8acacc32551854816a4d0a68424fb63f0375e78e (patch)
tree77bb7791d5eaa5861b71499dace79a0739d14d4c
parentc4fc032ec03b9dcdc3862452a99e3fc2f691ff91 (diff)
downloadkernel-audio-8acacc32551854816a4d0a68424fb63f0375e78e.tar.gz
kernel-audio-8acacc32551854816a4d0a68424fb63f0375e78e.tar.xz
kernel-audio-8acacc32551854816a4d0a68424fb63f0375e78e.zip
ASoC: davinci-mcasp: HACK: Add MCASP_VERSION_4 support
McASP IP found in DRA7xx devices is similar to the one described by VERSION_3 (TI81xx, AM33xx), except that a different DMA mechanism is used. A new version is introduced to use DMA4 instead (OMAP's). Long term plan is to keep McASP driver totally agnostic of the DMA module (sDMA or eDMA). Change-Id: I47a2fd117b3647a5ed6562cbaa00211cb95dea3a Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r--Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt1
-rw-r--r--include/linux/platform_data/davinci_asp.h1
-rw-r--r--sound/soc/davinci/davinci-mcasp.c178
-rw-r--r--sound/soc/davinci/davinci-mcasp.h2
-rw-r--r--sound/soc/davinci/davinci-pcm.h15
5 files changed, 145 insertions, 52 deletions
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
index 6f269f3aca70..9bac63e73eb1 100644
--- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -5,6 +5,7 @@ Required properties:
5 "ti,dm646x-mcasp-audio" : for DM646x platforms 5 "ti,dm646x-mcasp-audio" : for DM646x platforms
6 "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms 6 "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms
7 "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx) 7 "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
8 "ti,dra7-mcasp-audio" : for DRA7xx platforms
8 9
9- reg : Should contain McASP registers offset and length 10- reg : Should contain McASP registers offset and length
10- interrupts : Interrupt number for McASP 11- interrupts : Interrupt number for McASP
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index a78d0b0762b1..416c1d2abe63 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -92,6 +92,7 @@ enum {
92 MCASP_VERSION_1 = 0, /* DM646x */ 92 MCASP_VERSION_1 = 0, /* DM646x */
93 MCASP_VERSION_2, /* DA8xx/OMAPL1x */ 93 MCASP_VERSION_2, /* DA8xx/OMAPL1x */
94 MCASP_VERSION_3, /* TI81xx/AM33xx */ 94 MCASP_VERSION_3, /* TI81xx/AM33xx */
95 MCASP_VERSION_4, /* DRA7xxx */
95}; 96};
96 97
97enum mcbsp_clk_input_pin { 98enum mcbsp_clk_input_pin {
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 5d9af6c7ddfa..3f569fc2b763 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -34,6 +34,7 @@
34 34
35#include "davinci-pcm.h" 35#include "davinci-pcm.h"
36#include "davinci-mcasp.h" 36#include "davinci-mcasp.h"
37#include "../omap/omap-pcm.h"
37 38
38/* 39/*
39 * McASP register definitions 40 * McASP register definitions
@@ -104,7 +105,7 @@
104/* Transmit Buffer for Serializer n */ 105/* Transmit Buffer for Serializer n */
105#define DAVINCI_MCASP_TXBUF_REG 0x200 106#define DAVINCI_MCASP_TXBUF_REG 0x200
106/* Receive Buffer for Serializer n */ 107/* Receive Buffer for Serializer n */
107#define DAVINCI_MCASP_RXBUF_REG 0x280 108#define DAVINCI_MCASP_RXBUF_REG 0x284
108 109
109/* McASP FIFO Registers */ 110/* McASP FIFO Registers */
110#define DAVINCI_MCASP_WFIFOCTL (0x1010) 111#define DAVINCI_MCASP_WFIFOCTL (0x1010)
@@ -425,6 +426,7 @@ static int davinci_mcasp_start(struct davinci_audio_dev *dev, int stream)
425 if (dev->txnumevt) { /* enable FIFO */ 426 if (dev->txnumevt) { /* enable FIFO */
426 switch (dev->version) { 427 switch (dev->version) {
427 case MCASP_VERSION_3: 428 case MCASP_VERSION_3:
429 case MCASP_VERSION_4:
428 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL, 430 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL,
429 FIFO_ENABLE); 431 FIFO_ENABLE);
430 mcasp_set_bits(dev->base + MCASP_VER3_WFIFOCTL, 432 mcasp_set_bits(dev->base + MCASP_VER3_WFIFOCTL,
@@ -460,6 +462,7 @@ static int davinci_mcasp_start(struct davinci_audio_dev *dev, int stream)
460 if (dev->rxnumevt) { /* enable FIFO */ 462 if (dev->rxnumevt) { /* enable FIFO */
461 switch (dev->version) { 463 switch (dev->version) {
462 case MCASP_VERSION_3: 464 case MCASP_VERSION_3:
465 case MCASP_VERSION_4:
463 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL, 466 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL,
464 FIFO_ENABLE); 467 FIFO_ENABLE);
465 mcasp_set_bits(dev->base + MCASP_VER3_RFIFOCTL, 468 mcasp_set_bits(dev->base + MCASP_VER3_RFIFOCTL,
@@ -511,6 +514,7 @@ static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream)
511 if (dev->txnumevt) { /* disable FIFO */ 514 if (dev->txnumevt) { /* disable FIFO */
512 switch (dev->version) { 515 switch (dev->version) {
513 case MCASP_VERSION_3: 516 case MCASP_VERSION_3:
517 case MCASP_VERSION_4:
514 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL, 518 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL,
515 FIFO_ENABLE); 519 FIFO_ENABLE);
516 break; 520 break;
@@ -524,6 +528,7 @@ static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream)
524 if (dev->rxnumevt) { /* disable FIFO */ 528 if (dev->rxnumevt) { /* disable FIFO */
525 switch (dev->version) { 529 switch (dev->version) {
526 case MCASP_VERSION_3: 530 case MCASP_VERSION_3:
531 case MCASP_VERSION_4:
527 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL, 532 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL,
528 FIFO_ENABLE); 533 FIFO_ENABLE);
529 break; 534 break;
@@ -747,7 +752,9 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
747 u8 slots = dev->tdm_slots; 752 u8 slots = dev->tdm_slots;
748 u8 max_active_serializers = (channels + slots - 1) / slots; 753 u8 max_active_serializers = (channels + slots - 1) / slots;
749 /* Default configuration */ 754 /* Default configuration */
750 mcasp_set_bits(dev->base + DAVINCI_MCASP_PWREMUMGT_REG, MCASP_SOFT); 755 if (dev->version != MCASP_VERSION_4)
756 mcasp_set_bits(dev->base + DAVINCI_MCASP_PWREMUMGT_REG,
757 MCASP_SOFT);
751 758
752 /* All PINS as McASP */ 759 /* All PINS as McASP */
753 mcasp_set_reg(dev->base + DAVINCI_MCASP_PFUNC_REG, 0x00000000); 760 mcasp_set_reg(dev->base + DAVINCI_MCASP_PFUNC_REG, 0x00000000);
@@ -804,6 +811,7 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
804 811
805 switch (dev->version) { 812 switch (dev->version) {
806 case MCASP_VERSION_3: 813 case MCASP_VERSION_3:
814 case MCASP_VERSION_4:
807 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL, tx_ser, 815 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL, tx_ser,
808 NUMDMA_MASK); 816 NUMDMA_MASK);
809 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL, 817 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL,
@@ -822,6 +830,7 @@ static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
822 dev->rxnumevt = 1; 830 dev->rxnumevt = 1;
823 switch (dev->version) { 831 switch (dev->version) {
824 case MCASP_VERSION_3: 832 case MCASP_VERSION_3:
833 case MCASP_VERSION_4:
825 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL, rx_ser, 834 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL, rx_ser,
826 NUMDMA_MASK); 835 NUMDMA_MASK);
827 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL, 836 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL,
@@ -845,6 +854,7 @@ static int davinci_hw_param(struct davinci_audio_dev *dev, int stream,
845 int total_slots = dev->tdm_slots; 854 int total_slots = dev->tdm_slots;
846 int active_serializers; 855 int active_serializers;
847 u32 mask = 0; 856 u32 mask = 0;
857 u32 busel = 0;
848 858
849 if ((total_slots < 2) || (total_slots > 32)) { 859 if ((total_slots < 2) || (total_slots > 32)) {
850 dev_err(dev->dev, "tdm slot count %d not supported\n", 860 dev_err(dev->dev, "tdm slot count %d not supported\n",
@@ -871,15 +881,18 @@ static int davinci_hw_param(struct davinci_audio_dev *dev, int stream,
871 881
872 mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC); 882 mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
873 883
884 if (dev->version == MCASP_VERSION_4)
885 busel = TXSEL;
886
874 /* bit stream is MSB first with no delay */ 887 /* bit stream is MSB first with no delay */
875 /* DSP_B mode */ 888 /* DSP_B mode */
876 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); 889 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
877 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); 890 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, busel | TXORD);
878 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, 891 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
879 FSXMOD(total_slots), FSXMOD(0x1FF)); 892 FSXMOD(total_slots), FSXMOD(0x1FF));
880 893
881 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); 894 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
882 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD); 895 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, busel | RXORD);
883 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, 896 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
884 FSRMOD(total_slots), FSRMOD(0x1FF)); 897 FSRMOD(total_slots), FSRMOD(0x1FF));
885 898
@@ -916,13 +929,34 @@ static int davinci_hw_dit_param(struct davinci_audio_dev *dev)
916 return 0; 929 return 0;
917} 930}
918 931
932static void davinci_mcasp_set_dma_params(struct snd_pcm_substream *substream,
933 struct davinci_audio_dev *dev,
934 int word_length, u8 fifo_level)
935{
936 if (dev->version == MCASP_VERSION_4) {
937 struct omap_pcm_dma_data *dma_data =
938 dev->dma_params[substream->stream];
939
940 dma_data->packet_size = fifo_level;
941 } else {
942 struct davinci_pcm_dma_params *dma_params =
943 dev->dma_params[substream->stream];
944
945 dma_params->data_type = word_length >> 3;
946 dma_params->fifo_level = fifo_level;
947
948 if (dev->version == MCASP_VERSION_2 && !fifo_level)
949 dma_params->acnt = 4;
950 else
951 dma_params->acnt = dma_params->data_type;
952 }
953}
954
919static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, 955static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
920 struct snd_pcm_hw_params *params, 956 struct snd_pcm_hw_params *params,
921 struct snd_soc_dai *cpu_dai) 957 struct snd_soc_dai *cpu_dai)
922{ 958{
923 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); 959 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
924 struct davinci_pcm_dma_params *dma_params =
925 &dev->dma_params[substream->stream];
926 int word_length; 960 int word_length;
927 u8 fifo_level; 961 u8 fifo_level;
928 u8 slots = dev->tdm_slots; 962 u8 slots = dev->tdm_slots;
@@ -950,19 +984,16 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
950 switch (params_format(params)) { 984 switch (params_format(params)) {
951 case SNDRV_PCM_FORMAT_U8: 985 case SNDRV_PCM_FORMAT_U8:
952 case SNDRV_PCM_FORMAT_S8: 986 case SNDRV_PCM_FORMAT_S8:
953 dma_params->data_type = 1;
954 word_length = 8; 987 word_length = 8;
955 break; 988 break;
956 989
957 case SNDRV_PCM_FORMAT_U16_LE: 990 case SNDRV_PCM_FORMAT_U16_LE:
958 case SNDRV_PCM_FORMAT_S16_LE: 991 case SNDRV_PCM_FORMAT_S16_LE:
959 dma_params->data_type = 2;
960 word_length = 16; 992 word_length = 16;
961 break; 993 break;
962 994
963 case SNDRV_PCM_FORMAT_U24_3LE: 995 case SNDRV_PCM_FORMAT_U24_3LE:
964 case SNDRV_PCM_FORMAT_S24_3LE: 996 case SNDRV_PCM_FORMAT_S24_3LE:
965 dma_params->data_type = 3;
966 word_length = 24; 997 word_length = 24;
967 break; 998 break;
968 999
@@ -970,7 +1001,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
970 case SNDRV_PCM_FORMAT_S24_LE: 1001 case SNDRV_PCM_FORMAT_S24_LE:
971 case SNDRV_PCM_FORMAT_U32_LE: 1002 case SNDRV_PCM_FORMAT_U32_LE:
972 case SNDRV_PCM_FORMAT_S32_LE: 1003 case SNDRV_PCM_FORMAT_S32_LE:
973 dma_params->data_type = 4;
974 word_length = 32; 1004 word_length = 32;
975 break; 1005 break;
976 1006
@@ -979,14 +1009,8 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
979 return -EINVAL; 1009 return -EINVAL;
980 } 1010 }
981 1011
982 if (dev->version == MCASP_VERSION_2 && !fifo_level)
983 dma_params->acnt = 4;
984 else
985 dma_params->acnt = dma_params->data_type;
986
987 dma_params->fifo_level = fifo_level;
988
989 dev->sample_bits = word_length; 1012 dev->sample_bits = word_length;
1013 davinci_mcasp_set_dma_params(substream, dev, word_length, fifo_level);
990 davinci_config_channel_size(dev, word_length); 1014 davinci_config_channel_size(dev, word_length);
991 1015
992 return 0; 1016 return 0;
@@ -1023,7 +1047,11 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
1023{ 1047{
1024 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai); 1048 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
1025 1049
1026 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); 1050 if (dev->version == MCASP_VERSION_4)
1051 snd_soc_dai_set_dma_data(dai, substream,
1052 dev->dma_params[substream->stream]);
1053 else
1054 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
1027 1055
1028 /* Apply channels symmetry, needed when using a single serializer */ 1056 /* Apply channels symmetry, needed when using a single serializer */
1029 if (dev->channels) 1057 if (dev->channels)
@@ -1121,6 +1149,10 @@ static const struct of_device_id mcasp_dt_ids[] = {
1121 .compatible = "ti,omap2-mcasp-audio", 1149 .compatible = "ti,omap2-mcasp-audio",
1122 .data = (void *)MCASP_VERSION_3, 1150 .data = (void *)MCASP_VERSION_3,
1123 }, 1151 },
1152 {
1153 .compatible = "ti,dra7-mcasp-audio",
1154 .data = (void *)MCASP_VERSION_4,
1155 },
1124 { /* sentinel */ } 1156 { /* sentinel */ }
1125}; 1157};
1126MODULE_DEVICE_TABLE(of, mcasp_dt_ids); 1158MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
@@ -1247,8 +1279,8 @@ nodata:
1247 1279
1248static int davinci_mcasp_probe(struct platform_device *pdev) 1280static int davinci_mcasp_probe(struct platform_device *pdev)
1249{ 1281{
1250 struct davinci_pcm_dma_params *dma_data; 1282 struct resource *mem, *ioarea;
1251 struct resource *mem, *ioarea, *res; 1283 struct resource *tx_res, *rx_res;
1252 struct snd_platform_data *pdata; 1284 struct snd_platform_data *pdata;
1253 struct davinci_audio_dev *dev; 1285 struct davinci_audio_dev *dev;
1254 int ret; 1286 int ret;
@@ -1302,50 +1334,91 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1302 dev->rx_dismod = pdata->rx_dismod; 1334 dev->rx_dismod = pdata->rx_dismod;
1303 dev->dev = &pdev->dev; 1335 dev->dev = &pdev->dev;
1304 1336
1305 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
1306 dma_data->asp_chan_q = pdata->asp_chan_q;
1307 dma_data->ram_chan_q = pdata->ram_chan_q;
1308 dma_data->sram_pool = pdata->sram_pool;
1309 dma_data->sram_size = pdata->sram_size_playback;
1310 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
1311 mem->start);
1312
1313 /* first TX, then RX */ 1337 /* first TX, then RX */
1314 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1338 tx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
1315 if (!res) { 1339 if (!tx_res) {
1316 dev_err(&pdev->dev, "no DMA resource\n"); 1340 dev_err(&pdev->dev, "no DMA resource\n");
1317 ret = -ENODEV; 1341 return -ENODEV;
1318 goto err_release_clk; 1342 }
1343
1344 rx_res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1345 if (!rx_res) {
1346 dev_err(&pdev->dev, "no DMA resource\n");
1347 return -ENODEV;
1319 } 1348 }
1320 1349
1321 dma_data->channel = res->start; 1350 if (dev->version == MCASP_VERSION_4) {
1351 struct omap_pcm_dma_data *dma_data;
1322 1352
1323 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; 1353 dma_data = devm_kzalloc(&pdev->dev, sizeof(*dma_data),
1324 dma_data->asp_chan_q = pdata->asp_chan_q; 1354 GFP_KERNEL);
1325 dma_data->ram_chan_q = pdata->ram_chan_q; 1355 if (!dma_data) {
1326 dma_data->sram_pool = pdata->sram_pool; 1356 ret = -ENOMEM;
1327 dma_data->sram_size = pdata->sram_size_capture; 1357 goto err_release_clk;
1328 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + 1358 }
1329 mem->start);
1330 1359
1331 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 1360 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = dma_data;
1332 if (!res) { 1361 dma_data->port_addr = mem->start + DAVINCI_MCASP_TXBUF_REG;
1333 dev_err(&pdev->dev, "no DMA resource\n"); 1362 dma_data->dma_req = tx_res->start;
1334 ret = -ENODEV; 1363
1335 goto err_release_clk; 1364 dma_data = devm_kzalloc(&pdev->dev, sizeof(*dma_data),
1365 GFP_KERNEL);
1366 if (!dma_data) {
1367 ret = -ENOMEM;
1368 goto err_release_clk;
1369 }
1370
1371 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = dma_data;
1372 dma_data->port_addr = mem->start + DAVINCI_MCASP_RXBUF_REG;
1373 dma_data->dma_req = rx_res->start;
1374 } else {
1375 struct davinci_pcm_dma_params *dma_data;
1376
1377 dma_data = devm_kzalloc(&pdev->dev, sizeof(*dma_data),
1378 GFP_KERNEL);
1379 if (!dma_data) {
1380 ret = -ENOMEM;
1381 goto err_release_clk;
1382 }
1383
1384 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = dma_data;
1385 dma_data->asp_chan_q = pdata->asp_chan_q;
1386 dma_data->ram_chan_q = pdata->ram_chan_q;
1387 dma_data->sram_pool = pdata->sram_pool;
1388 dma_data->sram_size = pdata->sram_size_playback;
1389 dma_data->channel = tx_res->start;
1390 dma_data->dma_addr = (dma_addr_t)(pdata->tx_dma_offset +
1391 mem->start);
1392
1393 dma_data = devm_kzalloc(&pdev->dev, sizeof(*dma_data),
1394 GFP_KERNEL);
1395 if (!dma_data) {
1396 ret = -ENOMEM;
1397 goto err_release_clk;
1398 }
1399
1400 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = dma_data;
1401 dma_data->asp_chan_q = pdata->asp_chan_q;
1402 dma_data->ram_chan_q = pdata->ram_chan_q;
1403 dma_data->sram_pool = pdata->sram_pool;
1404 dma_data->sram_size = pdata->sram_size_capture;
1405 dma_data->channel = rx_res->start;
1406 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
1407 mem->start);
1336 } 1408 }
1337 1409
1338 dma_data->channel = res->start;
1339 dev_set_drvdata(&pdev->dev, dev); 1410 dev_set_drvdata(&pdev->dev, dev);
1340 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); 1411 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
1341 1412
1342 if (ret != 0) 1413 if (ret != 0)
1343 goto err_release_clk; 1414 goto err_release_clk;
1344 1415
1345 ret = davinci_soc_platform_register(&pdev->dev); 1416 if (dev->version != MCASP_VERSION_4) {
1346 if (ret) { 1417 ret = davinci_soc_platform_register(&pdev->dev);
1347 dev_err(&pdev->dev, "register PCM failed: %d\n", ret); 1418 if (ret) {
1348 goto err_unregister_dai; 1419 dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
1420 goto err_unregister_dai;
1421 }
1349 } 1422 }
1350 1423
1351 return 0; 1424 return 0;
@@ -1359,9 +1432,12 @@ err_release_clk:
1359 1432
1360static int davinci_mcasp_remove(struct platform_device *pdev) 1433static int davinci_mcasp_remove(struct platform_device *pdev)
1361{ 1434{
1435 struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev);
1362 1436
1363 snd_soc_unregister_dai(&pdev->dev); 1437 snd_soc_unregister_dai(&pdev->dev);
1364 davinci_soc_platform_unregister(&pdev->dev); 1438
1439 if (dev->version != MCASP_VERSION_4)
1440 davinci_soc_platform_unregister(&pdev->dev);
1365 1441
1366 pm_runtime_disable(&pdev->dev); 1442 pm_runtime_disable(&pdev->dev);
1367 1443
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 8b98ed16b8ed..38a205ea338d 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -28,7 +28,7 @@
28#define DAVINCI_MCASP_DIT_DAI 1 28#define DAVINCI_MCASP_DIT_DAI 1
29 29
30struct davinci_audio_dev { 30struct davinci_audio_dev {
31 struct davinci_pcm_dma_params dma_params[2]; 31 void *dma_params[2];
32 void __iomem *base; 32 void __iomem *base;
33 struct device *dev; 33 struct device *dev;
34 34
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index fbb710c76c08..436722c27dc9 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -29,7 +29,22 @@ struct davinci_pcm_dma_params {
29 unsigned int fifo_level; 29 unsigned int fifo_level;
30}; 30};
31 31
32#ifdef CONFIG_SND_DAVINCI_SOC
33
32int davinci_soc_platform_register(struct device *dev); 34int davinci_soc_platform_register(struct device *dev);
33void davinci_soc_platform_unregister(struct device *dev); 35void davinci_soc_platform_unregister(struct device *dev);
34 36
37#else
38
39static inline int davinci_soc_platform_register(struct device *dev)
40{
41 return 0;
42}
43
44static inline void davinci_soc_platform_unregister(struct device *dev)
45{
46}
47
48#endif
49
35#endif 50#endif