Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2 -52
-47
arch/arm/plat-pxa/ssp.c
··· 127 127 if (IS_ERR(ssp->clk)) 128 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 130 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 178 131 if (res == NULL) { 179 132 dev_err(dev, "no memory resource defined\n");
-2
include/linux/pxa2xx_ssp.h
··· 212 212 int type; 213 213 int use_count; 214 214 int irq; 215 - int drcmr_rx; 216 - int drcmr_tx; 217 215 218 216 struct device_node *of_node; 219 217 };
+2 -3
sound/soc/pxa/pxa-ssp.c
··· 105 105 dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL); 106 106 if (!dma) 107 107 return -ENOMEM; 108 - 109 - dma->filter_data = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 110 - &ssp->drcmr_tx : &ssp->drcmr_rx; 108 + dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 109 + "tx" : "rx"; 111 110 112 111 snd_soc_dai_set_dma_data(cpu_dai, substream, dma); 113 112