aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-05-25 06:32:45 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-07-01 09:15:50 -0400
commit5e2479bd0e0dc41f2b9f6b4345bc5d4557837056 (patch)
tree4822ee508024f5470cebfda8a1312e82ee05415b
parentad0de2ac3218d372149d89d9d5c5058aca6aa29b (diff)
dmaengine: PL08x: track mux usage on a per-channel basis.
Keep track of the number of descriptors currently using a MUX setting on a per-channel basis. This allows us to know when we have descriptors queued somewhere which have been assigned a DMA request signal. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/dma/amba-pl08x.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index c203d2f22bca..ac9fdccb2c19 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -227,6 +227,7 @@ enum pl08x_dma_chan_state {
227 * @waiting: a TX descriptor on this channel which is waiting for a physical 227 * @waiting: a TX descriptor on this channel which is waiting for a physical
228 * channel to become available 228 * channel to become available
229 * @signal: the physical DMA request signal which this channel is using 229 * @signal: the physical DMA request signal which this channel is using
230 * @mux_use: count of descriptors using this DMA request signal setting
230 */ 231 */
231struct pl08x_dma_chan { 232struct pl08x_dma_chan {
232 struct dma_chan chan; 233 struct dma_chan chan;
@@ -244,6 +245,7 @@ struct pl08x_dma_chan {
244 bool slave; 245 bool slave;
245 struct pl08x_txd *waiting; 246 struct pl08x_txd *waiting;
246 int signal; 247 int signal;
248 unsigned mux_use;
247}; 249};
248 250
249/** 251/**
@@ -310,10 +312,12 @@ static int pl08x_request_mux(struct pl08x_dma_chan *plchan)
310 const struct pl08x_platform_data *pd = plchan->host->pd; 312 const struct pl08x_platform_data *pd = plchan->host->pd;
311 int ret; 313 int ret;
312 314
313 if (pd->get_signal) { 315 if (plchan->mux_use++ == 0 && pd->get_signal) {
314 ret = pd->get_signal(plchan->cd); 316 ret = pd->get_signal(plchan->cd);
315 if (ret < 0) 317 if (ret < 0) {
318 plchan->mux_use = 0;
316 return ret; 319 return ret;
320 }
317 321
318 plchan->signal = ret; 322 plchan->signal = ret;
319 } 323 }
@@ -324,9 +328,13 @@ static void pl08x_release_mux(struct pl08x_dma_chan *plchan)
324{ 328{
325 const struct pl08x_platform_data *pd = plchan->host->pd; 329 const struct pl08x_platform_data *pd = plchan->host->pd;
326 330
327 if (plchan->signal >= 0 && pd->put_signal) { 331 if (plchan->signal >= 0) {
328 pd->put_signal(plchan->cd, plchan->signal); 332 WARN_ON(plchan->mux_use == 0);
329 plchan->signal = -1; 333
334 if (--plchan->mux_use == 0 && pd->put_signal) {
335 pd->put_signal(plchan->cd, plchan->signal);
336 plchan->signal = -1;
337 }
330 } 338 }
331} 339}
332 340