aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2013-10-18 11:37:43 -0400
committerMark Brown <broonie@linaro.org>2013-10-22 07:03:21 -0400
commit4023fe6ff2192d6050647571ea54f5497b2ec8f6 (patch)
treef853cf5add0ab7ce1d371aec5fc2a7156f95561b /sound/soc/davinci
parent256ba181cb2ddeef8e0a9b0540b09e0f77bf5540 (diff)
ASoC: davinci-mcasp: Extract DMA channels directly from DT
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-mcasp.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 806bec34e4d9..4c207508348f 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
1047 struct snd_platform_data *pdata = NULL; 1047 struct snd_platform_data *pdata = NULL;
1048 const struct of_device_id *match = 1048 const struct of_device_id *match =
1049 of_match_device(mcasp_dt_ids, &pdev->dev); 1049 of_match_device(mcasp_dt_ids, &pdev->dev);
1050 struct of_phandle_args dma_spec;
1050 1051
1051 const u32 *of_serial_dir32; 1052 const u32 *of_serial_dir32;
1052 u8 *of_serial_dir; 1053 u8 *of_serial_dir;
@@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
1109 pdata->serial_dir = of_serial_dir; 1110 pdata->serial_dir = of_serial_dir;
1110 } 1111 }
1111 1112
1113 ret = of_property_match_string(np, "dma-names", "tx");
1114 if (ret < 0)
1115 goto nodata;
1116
1117 ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
1118 &dma_spec);
1119 if (ret < 0)
1120 goto nodata;
1121
1122 pdata->tx_dma_channel = dma_spec.args[0];
1123
1124 ret = of_property_match_string(np, "dma-names", "rx");
1125 if (ret < 0)
1126 goto nodata;
1127
1128 ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
1129 &dma_spec);
1130 if (ret < 0)
1131 goto nodata;
1132
1133 pdata->rx_dma_channel = dma_spec.args[0];
1134
1112 ret = of_property_read_u32(np, "tx-num-evt", &val); 1135 ret = of_property_read_u32(np, "tx-num-evt", &val);
1113 if (ret >= 0) 1136 if (ret >= 0)
1114 pdata->txnumevt = val; 1137 pdata->txnumevt = val;
@@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1213 dma_data->sram_size = pdata->sram_size_playback; 1236 dma_data->sram_size = pdata->sram_size_playback;
1214 dma_data->dma_addr = dat->start + pdata->tx_dma_offset; 1237 dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
1215 1238
1216 /* first TX, then RX */
1217 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1239 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
1218 if (!res) { 1240 if (res)
1219 dev_err(&pdev->dev, "no DMA resource\n"); 1241 dma_data->channel = res->start;
1220 ret = -ENODEV; 1242 else
1221 goto err_release_clk; 1243 dma_data->channel = pdata->tx_dma_channel;
1222 }
1223
1224 dma_data->channel = res->start;
1225 1244
1226 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; 1245 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
1227 dma_data->asp_chan_q = pdata->asp_chan_q; 1246 dma_data->asp_chan_q = pdata->asp_chan_q;
@@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1231 dma_data->dma_addr = dat->start + pdata->rx_dma_offset; 1250 dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
1232 1251
1233 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 1252 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1234 if (!res) { 1253 if (res)
1235 dev_err(&pdev->dev, "no DMA resource\n"); 1254 dma_data->channel = res->start;
1236 ret = -ENODEV; 1255 else
1237 goto err_release_clk; 1256 dma_data->channel = pdata->rx_dma_channel;
1238 }
1239 1257
1240 dma_data->channel = res->start;
1241 dev_set_drvdata(&pdev->dev, dev); 1258 dev_set_drvdata(&pdev->dev, dev);
1242 ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, 1259 ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component,
1243 &davinci_mcasp_dai[pdata->op_mode], 1); 1260 &davinci_mcasp_dai[pdata->op_mode], 1);