aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt8
-rw-r--r--sound/soc/davinci/davinci-mcasp.c61
2 files changed, 47 insertions, 22 deletions
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
index 374e145c2ef1..c2ab8697e24a 100644
--- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -6,7 +6,11 @@ Required properties:
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 8
9- reg : Should contain McASP registers offset and length 9- reg : Should contain reg specifiers for the entries in the reg-names property.
10- reg-names : Should contain:
11 * "mpu" for the main registers (required). For compatibility with
12 existing software, it is recommended this is the first entry.
13 * "dat" for separate data port register access (optional).
10- interrupts : Interrupt number for McASP 14- interrupts : Interrupt number for McASP
11- op-mode : I2S/DIT ops mode. 15- op-mode : I2S/DIT ops mode.
12- tdm-slots : Slots for TDM operation. 16- tdm-slots : Slots for TDM operation.
@@ -15,7 +19,6 @@ Required properties:
15 to "num-serializer" parameter. Each entry is a number indication 19 to "num-serializer" parameter. Each entry is a number indication
16 serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) 20 serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
17 21
18
19Optional properties: 22Optional properties:
20 23
21- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0 24- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0
@@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 {
31 #address-cells = <1>; 34 #address-cells = <1>;
32 #size-cells = <0>; 35 #size-cells = <0>;
33 reg = <0x100000 0x3000>; 36 reg = <0x100000 0x3000>;
37 reg-names "mpu";
34 interrupts = <82 83>; 38 interrupts = <82 83>;
35 op-mode = <0>; /* MCASP_IIS_MODE */ 39 op-mode = <0>; /* MCASP_IIS_MODE */
36 tdm-slots = <2>; 40 tdm-slots = <2>;
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index cdfe959d6062..806bec34e4d9 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = {
1001 .name = "davinci-mcasp", 1001 .name = "davinci-mcasp",
1002}; 1002};
1003 1003
1004/* Some HW specific values and defaults. The rest is filled in from DT. */
1005static struct snd_platform_data dm646x_mcasp_pdata = {
1006 .tx_dma_offset = 0x400,
1007 .rx_dma_offset = 0x400,
1008 .asp_chan_q = EVENTQ_0,
1009 .version = MCASP_VERSION_1,
1010};
1011
1012static struct snd_platform_data da830_mcasp_pdata = {
1013 .tx_dma_offset = 0x2000,
1014 .rx_dma_offset = 0x2000,
1015 .asp_chan_q = EVENTQ_0,
1016 .version = MCASP_VERSION_2,
1017};
1018
1019static struct snd_platform_data omap2_mcasp_pdata = {
1020 .tx_dma_offset = 0,
1021 .rx_dma_offset = 0,
1022 .asp_chan_q = EVENTQ_0,
1023 .version = MCASP_VERSION_3,
1024};
1025
1004static const struct of_device_id mcasp_dt_ids[] = { 1026static const struct of_device_id mcasp_dt_ids[] = {
1005 { 1027 {
1006 .compatible = "ti,dm646x-mcasp-audio", 1028 .compatible = "ti,dm646x-mcasp-audio",
1007 .data = (void *)MCASP_VERSION_1, 1029 .data = &dm646x_mcasp_pdata,
1008 }, 1030 },
1009 { 1031 {
1010 .compatible = "ti,da830-mcasp-audio", 1032 .compatible = "ti,da830-mcasp-audio",
1011 .data = (void *)MCASP_VERSION_2, 1033 .data = &da830_mcasp_pdata,
1012 }, 1034 },
1013 { 1035 {
1014 .compatible = "ti,omap2-mcasp-audio", 1036 .compatible = "ti,omap2-mcasp-audio",
1015 .data = (void *)MCASP_VERSION_3, 1037 .data = &omap2_mcasp_pdata,
1016 }, 1038 },
1017 { /* sentinel */ } 1039 { /* sentinel */ }
1018}; 1040};
@@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
1035 pdata = pdev->dev.platform_data; 1057 pdata = pdev->dev.platform_data;
1036 return pdata; 1058 return pdata;
1037 } else if (match) { 1059 } else if (match) {
1038 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1060 pdata = (struct snd_platform_data *) match->data;
1039 if (!pdata) {
1040 ret = -ENOMEM;
1041 goto nodata;
1042 }
1043 } else { 1061 } else {
1044 /* control shouldn't reach here. something is wrong */ 1062 /* control shouldn't reach here. something is wrong */
1045 ret = -EINVAL; 1063 ret = -EINVAL;
1046 goto nodata; 1064 goto nodata;
1047 } 1065 }
1048 1066
1049 if (match->data)
1050 pdata->version = (u8)((int)match->data);
1051
1052 ret = of_property_read_u32(np, "op-mode", &val); 1067 ret = of_property_read_u32(np, "op-mode", &val);
1053 if (ret >= 0) 1068 if (ret >= 0)
1054 pdata->op_mode = val; 1069 pdata->op_mode = val;
@@ -1124,7 +1139,7 @@ nodata:
1124static int davinci_mcasp_probe(struct platform_device *pdev) 1139static int davinci_mcasp_probe(struct platform_device *pdev)
1125{ 1140{
1126 struct davinci_pcm_dma_params *dma_data; 1141 struct davinci_pcm_dma_params *dma_data;
1127 struct resource *mem, *ioarea, *res; 1142 struct resource *mem, *ioarea, *res, *dat;
1128 struct snd_platform_data *pdata; 1143 struct snd_platform_data *pdata;
1129 struct davinci_audio_dev *dev; 1144 struct davinci_audio_dev *dev;
1130 int ret; 1145 int ret;
@@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1145 return -EINVAL; 1160 return -EINVAL;
1146 } 1161 }
1147 1162
1148 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1163 mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
1149 if (!mem) { 1164 if (!mem) {
1150 dev_err(&pdev->dev, "no mem resource?\n"); 1165 dev_warn(dev->dev,
1151 return -ENODEV; 1166 "\"mpu\" mem resource not found, using index 0\n");
1167 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1168 if (!mem) {
1169 dev_err(&pdev->dev, "no mem resource?\n");
1170 return -ENODEV;
1171 }
1152 } 1172 }
1153 1173
1154 ioarea = devm_request_mem_region(&pdev->dev, mem->start, 1174 ioarea = devm_request_mem_region(&pdev->dev, mem->start,
@@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1182 dev->rxnumevt = pdata->rxnumevt; 1202 dev->rxnumevt = pdata->rxnumevt;
1183 dev->dev = &pdev->dev; 1203 dev->dev = &pdev->dev;
1184 1204
1205 dat = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat");
1206 if (!dat)
1207 dat = mem;
1208
1185 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; 1209 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
1186 dma_data->asp_chan_q = pdata->asp_chan_q; 1210 dma_data->asp_chan_q = pdata->asp_chan_q;
1187 dma_data->ram_chan_q = pdata->ram_chan_q; 1211 dma_data->ram_chan_q = pdata->ram_chan_q;
1188 dma_data->sram_pool = pdata->sram_pool; 1212 dma_data->sram_pool = pdata->sram_pool;
1189 dma_data->sram_size = pdata->sram_size_playback; 1213 dma_data->sram_size = pdata->sram_size_playback;
1190 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + 1214 dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
1191 mem->start);
1192 1215
1193 /* first TX, then RX */ 1216 /* first TX, then RX */
1194 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1217 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1205 dma_data->ram_chan_q = pdata->ram_chan_q; 1228 dma_data->ram_chan_q = pdata->ram_chan_q;
1206 dma_data->sram_pool = pdata->sram_pool; 1229 dma_data->sram_pool = pdata->sram_pool;
1207 dma_data->sram_size = pdata->sram_size_capture; 1230 dma_data->sram_size = pdata->sram_size_capture;
1208 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + 1231 dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
1209 mem->start);
1210 1232
1211 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 1233 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1212 if (!res) { 1234 if (!res) {
@@ -1305,4 +1327,3 @@ module_platform_driver(davinci_mcasp_driver);
1305MODULE_AUTHOR("Steve Chen"); 1327MODULE_AUTHOR("Steve Chen");
1306MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); 1328MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface");
1307MODULE_LICENSE("GPL"); 1329MODULE_LICENSE("GPL");
1308