1 From ad5d3e5a1218a599ec02c81a3bd599acedeea00f Mon Sep 17 00:00:00 2001
2 From: Jyri Sarha <jsarha@ti.com>
3 Date: Tue, 17 Sep 2013 12:09:30 +0300
4 Subject: [PATCH 214/752] ASoC: davinci-mcasp: Extract DMA channels directly
7 Extract DMA channels directly from DT as they can not be found from
8 platform resources anymore. This is a work-around until davinci audio
9 driver is updated to use dmaengine.
11 Signed-off-by: Jyri Sarha <jsarha@ti.com>
13 .../bindings/sound/davinci-mcasp-audio.txt | 5 +++
14 include/linux/platform_data/davinci_asp.h | 2 +
15 sound/soc/davinci/davinci-mcasp.c | 47 +++++++++++++-------
16 3 files changed, 39 insertions(+), 15 deletions(-)
18 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
19 +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
20 @@ -18,6 +18,11 @@ Required properties:
21 - serial-dir : A list of serializer pin mode. The list number should be equal
22 to "num-serializer" parameter. Each entry is a number indication
23 serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
24 +- dmas: two element list of DMA controller phandles and DMA request line
26 +- dma-names: identifier string for each DMA request line in the dmas property.
27 + These strings correspond 1:1 with the ordered pairs in dmas. The dma
28 + identifiers must be "rx" and "tx".
32 --- a/include/linux/platform_data/davinci_asp.h
33 +++ b/include/linux/platform_data/davinci_asp.h
34 @@ -84,6 +84,8 @@ struct snd_platform_data {
43 --- a/sound/soc/davinci/davinci-mcasp.c
44 +++ b/sound/soc/davinci/davinci-mcasp.c
45 @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci
46 struct snd_platform_data *pdata = NULL;
47 const struct of_device_id *match =
48 of_match_device(mcasp_dt_ids, &pdev->dev);
49 + struct of_phandle_args dma_spec;
51 const u32 *of_serial_dir32;
53 @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci
54 pdata->serial_dir = of_serial_dir;
57 + ret = of_property_match_string(np, "dma-names", "tx");
61 + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
66 + pdata->tx_dma_channel = dma_spec.args[0];
68 + ret = of_property_match_string(np, "dma-names", "rx");
72 + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
77 + pdata->rx_dma_channel = dma_spec.args[0];
79 ret = of_property_read_u32(np, "tx-num-evt", &val);
81 pdata->txnumevt = val;
82 @@ -1139,7 +1162,7 @@ nodata:
83 static int davinci_mcasp_probe(struct platform_device *pdev)
85 struct davinci_pcm_dma_params *dma_data;
86 - struct resource *mem, *ioarea, *res;
87 + struct resource *mem, *ioarea, *res, *dma;
88 struct snd_platform_data *pdata;
89 struct davinci_audio_dev *dev;
91 @@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct pl
92 dma_data->sram_size = pdata->sram_size_playback;
93 dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
95 - /* first TX, then RX */
96 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
98 - dev_err(&pdev->dev, "no DMA resource\n");
100 - goto err_release_clk;
103 - dma_data->channel = res->start;
105 + dma_data->channel = res->start;
107 + dma_data->channel = pdata->tx_dma_channel;
109 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
110 dma_data->asp_chan_q = pdata->asp_chan_q;
111 @@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct pl
112 dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
114 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
116 - dev_err(&pdev->dev, "no DMA resource\n");
118 - goto err_release_clk;
121 + dma_data->channel = res->start;
123 + dma_data->channel = pdata->rx_dma_channel;
125 - dma_data->channel = res->start;
126 dev_set_drvdata(&pdev->dev, dev);
127 ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component,
128 &davinci_mcasp_dai[pdata->op_mode], 1);