diff options
-rw-r--r-- | Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 5 | ||||
-rw-r--r-- | include/linux/platform_data/davinci_asp.h | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 45 |
3 files changed, 38 insertions, 14 deletions
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index c2ab8697e24a..c3ccde71f97a 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | |||
@@ -18,6 +18,11 @@ Required properties: | |||
18 | - serial-dir : A list of serializer pin mode. The list number should be equal | 18 | - serial-dir : A list of serializer pin mode. The list number should be equal |
19 | to "num-serializer" parameter. Each entry is a number indication | 19 | to "num-serializer" parameter. Each entry is a number indication |
20 | serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) | 20 | serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) |
21 | - dmas: two element list of DMA controller phandles and DMA request line | ||
22 | ordered pairs. | ||
23 | - dma-names: identifier string for each DMA request line in the dmas property. | ||
24 | These strings correspond 1:1 with the ordered pairs in dmas. The dma | ||
25 | identifiers must be "rx" and "tx". | ||
21 | 26 | ||
22 | Optional properties: | 27 | Optional properties: |
23 | 28 | ||
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae03b6e3..689a856b86f9 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h | |||
@@ -84,6 +84,8 @@ struct snd_platform_data { | |||
84 | u8 version; | 84 | u8 version; |
85 | u8 txnumevt; | 85 | u8 txnumevt; |
86 | u8 rxnumevt; | 86 | u8 rxnumevt; |
87 | int tx_dma_channel; | ||
88 | int rx_dma_channel; | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | enum { | 91 | enum { |
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); |