aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2015-03-03 09:45:20 -0500
committerMark Brown <broonie@kernel.org>2015-03-04 12:26:28 -0500
commit9759e7ef53138c5ab46ea516ad08977eb5770393 (patch)
tree67df3810d7c6ea6818e40ace9b6def9c228b0489 /sound/soc/davinci
parent62731d33c41d95914a0a796f319924e22e7ea411 (diff)
ASoC: davinci-mcasp: Deprecate the use of davinci-pcm in favor of edma-pcm
The edma-pcm performs as good as the old davinci-pcm and it's use does not require the 'ping-pong' mode of davinci-pcm, which was introduced to overcome under/over flow issues when using davinci-pcm. Keep the SND_DAVINCI_SOC config option to select the SND_EDMA_SOC to avoid regression in audio support. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/Kconfig15
-rw-r--r--sound/soc/davinci/davinci-mcasp.c87
2 files changed, 27 insertions, 75 deletions
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index eae4e229f341..3736d9aabc56 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -1,15 +1,16 @@
1config SND_DAVINCI_SOC 1config SND_DAVINCI_SOC
2 tristate "SoC Audio for TI DAVINCI" 2 tristate
3 depends on ARCH_DAVINCI 3 depends on ARCH_DAVINCI
4 select SND_EDMA_SOC 4 select SND_EDMA_SOC
5 5
6config SND_EDMA_SOC 6config SND_EDMA_SOC
7 tristate "SoC Audio for Texas Instruments chips using eDMA (AM33XX/43XX)" 7 tristate "SoC Audio for Texas Instruments chips using eDMA"
8 depends on SOC_AM33XX || SOC_AM43XX || ARCH_DAVINCI 8 depends on SOC_AM33XX || SOC_AM43XX || ARCH_DAVINCI
9 select SND_SOC_GENERIC_DMAENGINE_PCM 9 select SND_SOC_GENERIC_DMAENGINE_PCM
10 help 10 help
11 Say Y or M here if you want audio support for TI SoC which uses eDMA. 11 Say Y or M here if you want audio support for TI SoC which uses eDMA.
12 The following line of SoCs are supported by this platform driver: 12 The following line of SoCs are supported by this platform driver:
13 - daVinci devices
13 - AM335x 14 - AM335x
14 - AM437x/AM438x 15 - AM437x/AM438x
15 16
@@ -18,7 +19,7 @@ config SND_DAVINCI_SOC_I2S
18 19
19config SND_DAVINCI_SOC_MCASP 20config SND_DAVINCI_SOC_MCASP
20 tristate "Multichannel Audio Serial Port (McASP) support" 21 tristate "Multichannel Audio Serial Port (McASP) support"
21 depends on SND_DAVINCI_SOC || SND_OMAP_SOC || SND_EDMA_SOC 22 depends on SND_OMAP_SOC || SND_EDMA_SOC
22 help 23 help
23 Say Y or M here if you want to have support for McASP IP found in 24 Say Y or M here if you want to have support for McASP IP found in
24 various Texas Instruments SoCs like: 25 various Texas Instruments SoCs like:
@@ -46,7 +47,7 @@ config SND_AM33XX_SOC_EVM
46 47
47config SND_DAVINCI_SOC_EVM 48config SND_DAVINCI_SOC_EVM
48 tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" 49 tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM"
49 depends on SND_DAVINCI_SOC && I2C 50 depends on SND_EDMA_SOC && I2C
50 depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM || MACH_DAVINCI_DM365_EVM 51 depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM || MACH_DAVINCI_DM365_EVM
51 select SND_DAVINCI_SOC_GENERIC_EVM 52 select SND_DAVINCI_SOC_GENERIC_EVM
52 help 53 help
@@ -74,7 +75,7 @@ endchoice
74 75
75config SND_DM6467_SOC_EVM 76config SND_DM6467_SOC_EVM
76 tristate "SoC Audio support for DaVinci DM6467 EVM" 77 tristate "SoC Audio support for DaVinci DM6467 EVM"
77 depends on SND_DAVINCI_SOC && MACH_DAVINCI_DM6467_EVM && I2C 78 depends on SND_EDMA_SOC && MACH_DAVINCI_DM6467_EVM && I2C
78 select SND_DAVINCI_SOC_GENERIC_EVM 79 select SND_DAVINCI_SOC_GENERIC_EVM
79 select SND_SOC_SPDIF 80 select SND_SOC_SPDIF
80 81
@@ -83,7 +84,7 @@ config SND_DM6467_SOC_EVM
83 84
84config SND_DA830_SOC_EVM 85config SND_DA830_SOC_EVM
85 tristate "SoC Audio support for DA830/OMAP-L137 EVM" 86 tristate "SoC Audio support for DA830/OMAP-L137 EVM"
86 depends on SND_DAVINCI_SOC && MACH_DAVINCI_DA830_EVM && I2C 87 depends on SND_EDMA_SOC && MACH_DAVINCI_DA830_EVM && I2C
87 select SND_DAVINCI_SOC_GENERIC_EVM 88 select SND_DAVINCI_SOC_GENERIC_EVM
88 89
89 help 90 help
@@ -92,7 +93,7 @@ config SND_DA830_SOC_EVM
92 93
93config SND_DA850_SOC_EVM 94config SND_DA850_SOC_EVM
94 tristate "SoC Audio support for DA850/OMAP-L138 EVM" 95 tristate "SoC Audio support for DA850/OMAP-L138 EVM"
95 depends on SND_DAVINCI_SOC && MACH_DAVINCI_DA850_EVM && I2C 96 depends on SND_EDMA_SOC && MACH_DAVINCI_DA850_EVM && I2C
96 select SND_DAVINCI_SOC_GENERIC_EVM 97 select SND_DAVINCI_SOC_GENERIC_EVM
97 help 98 help
98 Say Y if you want to add support for SoC audio on TI 99 Say Y if you want to add support for SoC audio on TI
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 031c1fb44ae7..0c882995a357 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -26,6 +26,7 @@
26#include <linux/of.h> 26#include <linux/of.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/of_device.h> 28#include <linux/of_device.h>
29#include <linux/platform_data/davinci_asp.h>
29 30
30#include <sound/asoundef.h> 31#include <sound/asoundef.h>
31#include <sound/core.h> 32#include <sound/core.h>
@@ -36,7 +37,6 @@
36#include <sound/dmaengine_pcm.h> 37#include <sound/dmaengine_pcm.h>
37#include <sound/omap-pcm.h> 38#include <sound/omap-pcm.h>
38 39
39#include "davinci-pcm.h"
40#include "edma-pcm.h" 40#include "edma-pcm.h"
41#include "davinci-mcasp.h" 41#include "davinci-mcasp.h"
42 42
@@ -65,7 +65,6 @@ struct davinci_mcasp_context {
65}; 65};
66 66
67struct davinci_mcasp { 67struct davinci_mcasp {
68 struct davinci_pcm_dma_params dma_params[2];
69 struct snd_dmaengine_dai_dma_data dma_data[2]; 68 struct snd_dmaengine_dai_dma_data dma_data[2];
70 void __iomem *base; 69 void __iomem *base;
71 u32 fifo_base; 70 u32 fifo_base;
@@ -82,6 +81,7 @@ struct davinci_mcasp {
82 u16 bclk_lrclk_ratio; 81 u16 bclk_lrclk_ratio;
83 int streams; 82 int streams;
84 u32 irq_request[2]; 83 u32 irq_request[2];
84 int dma_request[2];
85 85
86 int sysclk_freq; 86 int sysclk_freq;
87 bool bclk_master; 87 bool bclk_master;
@@ -643,7 +643,6 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
643static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream, 643static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
644 int period_words, int channels) 644 int period_words, int channels)
645{ 645{
646 struct davinci_pcm_dma_params *dma_params = &mcasp->dma_params[stream];
647 struct snd_dmaengine_dai_dma_data *dma_data = &mcasp->dma_data[stream]; 646 struct snd_dmaengine_dai_dma_data *dma_data = &mcasp->dma_data[stream];
648 int i; 647 int i;
649 u8 tx_ser = 0; 648 u8 tx_ser = 0;
@@ -711,10 +710,8 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
711 * For example if three serializers are enabled the DMA 710 * For example if three serializers are enabled the DMA
712 * need to transfer three words per DMA request. 711 * need to transfer three words per DMA request.
713 */ 712 */
714 dma_params->fifo_level = active_serializers;
715 dma_data->maxburst = active_serializers; 713 dma_data->maxburst = active_serializers;
716 } else { 714 } else {
717 dma_params->fifo_level = 0;
718 dma_data->maxburst = 0; 715 dma_data->maxburst = 0;
719 } 716 }
720 return 0; 717 return 0;
@@ -746,7 +743,6 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
746 /* Configure the burst size for platform drivers */ 743 /* Configure the burst size for platform drivers */
747 if (numevt == 1) 744 if (numevt == 1)
748 numevt = 0; 745 numevt = 0;
749 dma_params->fifo_level = numevt;
750 dma_data->maxburst = numevt; 746 dma_data->maxburst = numevt;
751 747
752 return 0; 748 return 0;
@@ -872,8 +868,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
872 struct snd_soc_dai *cpu_dai) 868 struct snd_soc_dai *cpu_dai)
873{ 869{
874 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai); 870 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
875 struct davinci_pcm_dma_params *dma_params =
876 &mcasp->dma_params[substream->stream];
877 int word_length; 871 int word_length;
878 int channels = params_channels(params); 872 int channels = params_channels(params);
879 int period_size = params_period_size(params); 873 int period_size = params_period_size(params);
@@ -914,31 +908,26 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
914 switch (params_format(params)) { 908 switch (params_format(params)) {
915 case SNDRV_PCM_FORMAT_U8: 909 case SNDRV_PCM_FORMAT_U8:
916 case SNDRV_PCM_FORMAT_S8: 910 case SNDRV_PCM_FORMAT_S8:
917 dma_params->data_type = 1;
918 word_length = 8; 911 word_length = 8;
919 break; 912 break;
920 913
921 case SNDRV_PCM_FORMAT_U16_LE: 914 case SNDRV_PCM_FORMAT_U16_LE:
922 case SNDRV_PCM_FORMAT_S16_LE: 915 case SNDRV_PCM_FORMAT_S16_LE:
923 dma_params->data_type = 2;
924 word_length = 16; 916 word_length = 16;
925 break; 917 break;
926 918
927 case SNDRV_PCM_FORMAT_U24_3LE: 919 case SNDRV_PCM_FORMAT_U24_3LE:
928 case SNDRV_PCM_FORMAT_S24_3LE: 920 case SNDRV_PCM_FORMAT_S24_3LE:
929 dma_params->data_type = 3;
930 word_length = 24; 921 word_length = 24;
931 break; 922 break;
932 923
933 case SNDRV_PCM_FORMAT_U24_LE: 924 case SNDRV_PCM_FORMAT_U24_LE:
934 case SNDRV_PCM_FORMAT_S24_LE: 925 case SNDRV_PCM_FORMAT_S24_LE:
935 dma_params->data_type = 4;
936 word_length = 24; 926 word_length = 24;
937 break; 927 break;
938 928
939 case SNDRV_PCM_FORMAT_U32_LE: 929 case SNDRV_PCM_FORMAT_U32_LE:
940 case SNDRV_PCM_FORMAT_S32_LE: 930 case SNDRV_PCM_FORMAT_S32_LE:
941 dma_params->data_type = 4;
942 word_length = 32; 931 word_length = 32;
943 break; 932 break;
944 933
@@ -947,11 +936,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
947 return -EINVAL; 936 return -EINVAL;
948 } 937 }
949 938
950 if (mcasp->version == MCASP_VERSION_2 && !dma_params->fifo_level)
951 dma_params->acnt = 4;
952 else
953 dma_params->acnt = dma_params->data_type;
954
955 davinci_config_channel_size(mcasp, word_length); 939 davinci_config_channel_size(mcasp, word_length);
956 940
957 if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) 941 if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
@@ -1055,17 +1039,8 @@ static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
1055{ 1039{
1056 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); 1040 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
1057 1041
1058 if (mcasp->version >= MCASP_VERSION_3) { 1042 dai->playback_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
1059 /* Using dmaengine PCM */ 1043 dai->capture_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
1060 dai->playback_dma_data =
1061 &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
1062 dai->capture_dma_data =
1063 &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
1064 } else {
1065 /* Using davinci-pcm */
1066 dai->playback_dma_data = mcasp->dma_params;
1067 dai->capture_dma_data = mcasp->dma_params;
1068 }
1069 1044
1070 return 0; 1045 return 0;
1071} 1046}
@@ -1184,28 +1159,24 @@ static const struct snd_soc_component_driver davinci_mcasp_component = {
1184static struct davinci_mcasp_pdata dm646x_mcasp_pdata = { 1159static struct davinci_mcasp_pdata dm646x_mcasp_pdata = {
1185 .tx_dma_offset = 0x400, 1160 .tx_dma_offset = 0x400,
1186 .rx_dma_offset = 0x400, 1161 .rx_dma_offset = 0x400,
1187 .asp_chan_q = EVENTQ_0,
1188 .version = MCASP_VERSION_1, 1162 .version = MCASP_VERSION_1,
1189}; 1163};
1190 1164
1191static struct davinci_mcasp_pdata da830_mcasp_pdata = { 1165static struct davinci_mcasp_pdata da830_mcasp_pdata = {
1192 .tx_dma_offset = 0x2000, 1166 .tx_dma_offset = 0x2000,
1193 .rx_dma_offset = 0x2000, 1167 .rx_dma_offset = 0x2000,
1194 .asp_chan_q = EVENTQ_0,
1195 .version = MCASP_VERSION_2, 1168 .version = MCASP_VERSION_2,
1196}; 1169};
1197 1170
1198static struct davinci_mcasp_pdata am33xx_mcasp_pdata = { 1171static struct davinci_mcasp_pdata am33xx_mcasp_pdata = {
1199 .tx_dma_offset = 0, 1172 .tx_dma_offset = 0,
1200 .rx_dma_offset = 0, 1173 .rx_dma_offset = 0,
1201 .asp_chan_q = EVENTQ_0,
1202 .version = MCASP_VERSION_3, 1174 .version = MCASP_VERSION_3,
1203}; 1175};
1204 1176
1205static struct davinci_mcasp_pdata dra7_mcasp_pdata = { 1177static struct davinci_mcasp_pdata dra7_mcasp_pdata = {
1206 .tx_dma_offset = 0x200, 1178 .tx_dma_offset = 0x200,
1207 .rx_dma_offset = 0x284, 1179 .rx_dma_offset = 0x284,
1208 .asp_chan_q = EVENTQ_0,
1209 .version = MCASP_VERSION_4, 1180 .version = MCASP_VERSION_4,
1210}; 1181};
1211 1182
@@ -1382,12 +1353,12 @@ nodata:
1382 1353
1383static int davinci_mcasp_probe(struct platform_device *pdev) 1354static int davinci_mcasp_probe(struct platform_device *pdev)
1384{ 1355{
1385 struct davinci_pcm_dma_params *dma_params;
1386 struct snd_dmaengine_dai_dma_data *dma_data; 1356 struct snd_dmaengine_dai_dma_data *dma_data;
1387 struct resource *mem, *ioarea, *res, *dat; 1357 struct resource *mem, *ioarea, *res, *dat;
1388 struct davinci_mcasp_pdata *pdata; 1358 struct davinci_mcasp_pdata *pdata;
1389 struct davinci_mcasp *mcasp; 1359 struct davinci_mcasp *mcasp;
1390 char *irq_name; 1360 char *irq_name;
1361 int *dma;
1391 int irq; 1362 int irq;
1392 int ret; 1363 int ret;
1393 1364
@@ -1521,59 +1492,45 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1521 if (dat) 1492 if (dat)
1522 mcasp->dat_port = true; 1493 mcasp->dat_port = true;
1523 1494
1524 dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
1525 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK]; 1495 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
1526 dma_params->asp_chan_q = pdata->asp_chan_q;
1527 dma_params->ram_chan_q = pdata->ram_chan_q;
1528 dma_params->sram_pool = pdata->sram_pool;
1529 dma_params->sram_size = pdata->sram_size_playback;
1530 if (dat) 1496 if (dat)
1531 dma_params->dma_addr = dat->start; 1497 dma_data->addr = dat->start;
1532 else 1498 else
1533 dma_params->dma_addr = mem->start + pdata->tx_dma_offset; 1499 dma_data->addr = mem->start + pdata->tx_dma_offset;
1534
1535 /* Unconditional dmaengine stuff */
1536 dma_data->addr = dma_params->dma_addr;
1537 1500
1501 dma = &mcasp->dma_request[SNDRV_PCM_STREAM_PLAYBACK];
1538 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1502 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
1539 if (res) 1503 if (res)
1540 dma_params->channel = res->start; 1504 *dma = res->start;
1541 else 1505 else
1542 dma_params->channel = pdata->tx_dma_channel; 1506 *dma = pdata->tx_dma_channel;
1543 1507
1544 /* dmaengine filter data for DT and non-DT boot */ 1508 /* dmaengine filter data for DT and non-DT boot */
1545 if (pdev->dev.of_node) 1509 if (pdev->dev.of_node)
1546 dma_data->filter_data = "tx"; 1510 dma_data->filter_data = "tx";
1547 else 1511 else
1548 dma_data->filter_data = &dma_params->channel; 1512 dma_data->filter_data = dma;
1549 1513
1550 /* RX is not valid in DIT mode */ 1514 /* RX is not valid in DIT mode */
1551 if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) { 1515 if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) {
1552 dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE];
1553 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE]; 1516 dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
1554 dma_params->asp_chan_q = pdata->asp_chan_q;
1555 dma_params->ram_chan_q = pdata->ram_chan_q;
1556 dma_params->sram_pool = pdata->sram_pool;
1557 dma_params->sram_size = pdata->sram_size_capture;
1558 if (dat) 1517 if (dat)
1559 dma_params->dma_addr = dat->start; 1518 dma_data->addr = dat->start;
1560 else 1519 else
1561 dma_params->dma_addr = mem->start + pdata->rx_dma_offset; 1520 dma_data->addr = mem->start + pdata->rx_dma_offset;
1562
1563 /* Unconditional dmaengine stuff */
1564 dma_data->addr = dma_params->dma_addr;
1565 1521
1522 dma = &mcasp->dma_request[SNDRV_PCM_STREAM_CAPTURE];
1566 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 1523 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1567 if (res) 1524 if (res)
1568 dma_params->channel = res->start; 1525 *dma = res->start;
1569 else 1526 else
1570 dma_params->channel = pdata->rx_dma_channel; 1527 *dma = pdata->rx_dma_channel;
1571 1528
1572 /* dmaengine filter data for DT and non-DT boot */ 1529 /* dmaengine filter data for DT and non-DT boot */
1573 if (pdev->dev.of_node) 1530 if (pdev->dev.of_node)
1574 dma_data->filter_data = "rx"; 1531 dma_data->filter_data = "rx";
1575 else 1532 else
1576 dma_data->filter_data = &dma_params->channel; 1533 dma_data->filter_data = dma;
1577 } 1534 }
1578 1535
1579 if (mcasp->version < MCASP_VERSION_3) { 1536 if (mcasp->version < MCASP_VERSION_3) {
@@ -1596,17 +1553,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1596 goto err; 1553 goto err;
1597 1554
1598 switch (mcasp->version) { 1555 switch (mcasp->version) {
1599#if IS_BUILTIN(CONFIG_SND_DAVINCI_SOC) || \
1600 (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
1601 IS_MODULE(CONFIG_SND_DAVINCI_SOC))
1602 case MCASP_VERSION_1:
1603 case MCASP_VERSION_2:
1604 ret = davinci_soc_platform_register(&pdev->dev);
1605 break;
1606#endif
1607#if IS_BUILTIN(CONFIG_SND_EDMA_SOC) || \ 1556#if IS_BUILTIN(CONFIG_SND_EDMA_SOC) || \
1608 (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \ 1557 (IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
1609 IS_MODULE(CONFIG_SND_EDMA_SOC)) 1558 IS_MODULE(CONFIG_SND_EDMA_SOC))
1559 case MCASP_VERSION_1:
1560 case MCASP_VERSION_2:
1610 case MCASP_VERSION_3: 1561 case MCASP_VERSION_3:
1611 ret = edma_pcm_platform_register(&pdev->dev); 1562 ret = edma_pcm_platform_register(&pdev->dev);
1612 break; 1563 break;