diff options
author | Robert Jarzmik <robert.jarzmik@free.fr> | 2018-06-17 13:02:17 -0400 |
---|---|---|
committer | Robert Jarzmik <robert.jarzmik@free.fr> | 2018-06-18 15:32:41 -0400 |
commit | cd31b80736852d34bc1072f3e579a6fd73a244e7 (patch) | |
tree | fc2cae085bbec287cf6be7b9d9ef052c8bf366e4 | |
parent | b77ed2e6d61d40117272be1b2377c5dfd101e9cd (diff) |
ARM: pxa: change SSP DMA channels allocation
Now the dma_slave_map is available for PXA architecture, switch the SSP
device to it.
This specifically means that :
- for platform data based machines, the DMA requestor channels are
extracted from the slave map, where pxa-ssp-dai.<N> is a 1-1 match to
ssp.<N>, and the channels are either "rx" or "tx".
- for device tree platforms, the dma node should be hooked into the
pxa2xx-ac97 or pxa-ssp-dai node.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Daniel Mack <daniel@zonque.org>
-rw-r--r-- | arch/arm/plat-pxa/ssp.c | 47 | ||||
-rw-r--r-- | include/linux/pxa2xx_ssp.h | 2 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.c | 5 |
3 files changed, 2 insertions, 52 deletions
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c index ba13f793fbce..ed36dcab80f1 100644 --- a/arch/arm/plat-pxa/ssp.c +++ b/arch/arm/plat-pxa/ssp.c | |||
@@ -127,53 +127,6 @@ static int pxa_ssp_probe(struct platform_device *pdev) | |||
127 | if (IS_ERR(ssp->clk)) | 127 | if (IS_ERR(ssp->clk)) |
128 | return PTR_ERR(ssp->clk); | 128 | return PTR_ERR(ssp->clk); |
129 | 129 | ||
130 | if (dev->of_node) { | ||
131 | struct of_phandle_args dma_spec; | ||
132 | struct device_node *np = dev->of_node; | ||
133 | int ret; | ||
134 | |||
135 | /* | ||
136 | * FIXME: we should allocate the DMA channel from this | ||
137 | * context and pass the channel down to the ssp users. | ||
138 | * For now, we lookup the rx and tx indices manually | ||
139 | */ | ||
140 | |||
141 | /* rx */ | ||
142 | ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", | ||
143 | 0, &dma_spec); | ||
144 | |||
145 | if (ret) { | ||
146 | dev_err(dev, "Can't parse dmas property\n"); | ||
147 | return -ENODEV; | ||
148 | } | ||
149 | ssp->drcmr_rx = dma_spec.args[0]; | ||
150 | of_node_put(dma_spec.np); | ||
151 | |||
152 | /* tx */ | ||
153 | ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", | ||
154 | 1, &dma_spec); | ||
155 | if (ret) { | ||
156 | dev_err(dev, "Can't parse dmas property\n"); | ||
157 | return -ENODEV; | ||
158 | } | ||
159 | ssp->drcmr_tx = dma_spec.args[0]; | ||
160 | of_node_put(dma_spec.np); | ||
161 | } else { | ||
162 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
163 | if (res == NULL) { | ||
164 | dev_err(dev, "no SSP RX DRCMR defined\n"); | ||
165 | return -ENODEV; | ||
166 | } | ||
167 | ssp->drcmr_rx = res->start; | ||
168 | |||
169 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
170 | if (res == NULL) { | ||
171 | dev_err(dev, "no SSP TX DRCMR defined\n"); | ||
172 | return -ENODEV; | ||
173 | } | ||
174 | ssp->drcmr_tx = res->start; | ||
175 | } | ||
176 | |||
177 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 130 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
178 | if (res == NULL) { | 131 | if (res == NULL) { |
179 | dev_err(dev, "no memory resource defined\n"); | 132 | dev_err(dev, "no memory resource defined\n"); |
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index 8461b18e4608..03a7ca46735b 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h | |||
@@ -212,8 +212,6 @@ struct ssp_device { | |||
212 | int type; | 212 | int type; |
213 | int use_count; | 213 | int use_count; |
214 | int irq; | 214 | int irq; |
215 | int drcmr_rx; | ||
216 | int drcmr_tx; | ||
217 | 215 | ||
218 | struct device_node *of_node; | 216 | struct device_node *of_node; |
219 | }; | 217 | }; |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 6fc986080130..0b441338bdd4 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -105,9 +105,8 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream, | |||
105 | dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL); | 105 | dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL); |
106 | if (!dma) | 106 | if (!dma) |
107 | return -ENOMEM; | 107 | return -ENOMEM; |
108 | 108 | dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | |
109 | dma->filter_data = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | 109 | "tx" : "rx"; |
110 | &ssp->drcmr_tx : &ssp->drcmr_rx; | ||
111 | 110 | ||
112 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma); | 111 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma); |
113 | 112 | ||