brcm47xx: deactivate mips wait instruction only for BCM4706
[openwrt.git] / target / linux / omap / patches-3.12 / 403-ASoC-davinci-mcasp-Extract-DMA-channels-directly-fro.patch
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
5  from DT
6
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.
10
11 Signed-off-by: Jyri Sarha <jsarha@ti.com>
12 ---
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(-)
17
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
25 +        ordered pairs.
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".
29  
30  Optional properties:
31  
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 {
35         u8 version;
36         u8 txnumevt;
37         u8 rxnumevt;
38 +       int tx_dma_channel;
39 +       int rx_dma_channel;
40  };
41  
42  enum {
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;
50  
51         const u32 *of_serial_dir32;
52         u8 *of_serial_dir;
53 @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci
54                 pdata->serial_dir = of_serial_dir;
55         }
56  
57 +       ret = of_property_match_string(np, "dma-names", "tx");
58 +       if (ret < 0)
59 +               goto nodata;
60 +
61 +       ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
62 +                                        &dma_spec);
63 +       if (ret < 0)
64 +               goto nodata;
65 +
66 +       pdata->tx_dma_channel = dma_spec.args[0];
67 +
68 +       ret = of_property_match_string(np, "dma-names", "rx");
69 +       if (ret < 0)
70 +               goto nodata;
71 +
72 +       ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
73 +                                        &dma_spec);
74 +       if (ret < 0)
75 +               goto nodata;
76 +
77 +       pdata->rx_dma_channel = dma_spec.args[0];
78 +
79         ret = of_property_read_u32(np, "tx-num-evt", &val);
80         if (ret >= 0)
81                 pdata->txnumevt = val;
82 @@ -1139,7 +1162,7 @@ nodata:
83  static int davinci_mcasp_probe(struct platform_device *pdev)
84  {
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;
90         int ret;
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;
94  
95 -       /* first TX, then RX */
96         res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
97 -       if (!res) {
98 -               dev_err(&pdev->dev, "no DMA resource\n");
99 -               ret = -ENODEV;
100 -               goto err_release_clk;
101 -       }
102 -
103 -       dma_data->channel = res->start;
104 +       if (res)
105 +               dma_data->channel = res->start;
106 +       else
107 +               dma_data->channel = pdata->tx_dma_channel;
108  
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;
113  
114         res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
115 -       if (!res) {
116 -               dev_err(&pdev->dev, "no DMA resource\n");
117 -               ret = -ENODEV;
118 -               goto err_release_clk;
119 -       }
120 +       if (res)
121 +               dma_data->channel = res->start;
122 +       else
123 +               dma_data->channel = pdata->rx_dma_channel;
124  
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);