diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2010-06-20 17:25:46 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-06-22 21:01:54 -0400 |
commit | 0c32269d813c148194524fc8272f7ec1f7c90e6a (patch) | |
tree | 74603b87ce1b4b1fbe8b538a32683c73ea66c6a8 /drivers/dma | |
parent | 2292b880e411276d127a020a1c35ca149fcca992 (diff) |
DMAENGINE: ste_dma40: avoid doing unnessecary suspend
Avoid doing unnessecary suspend when modifying logical channels.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index ebffb53c036c..abbc1b627bcc 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -595,6 +595,7 @@ static void d40_config_set_event(struct d40_chan *d40c, bool do_enable) | |||
595 | u32 val; | 595 | u32 val; |
596 | unsigned long flags; | 596 | unsigned long flags; |
597 | 597 | ||
598 | /* Notice, that disable requires the physical channel to be stopped */ | ||
598 | if (do_enable) | 599 | if (do_enable) |
599 | val = D40_ACTIVATE_EVENTLINE; | 600 | val = D40_ACTIVATE_EVENTLINE; |
600 | else | 601 | else |
@@ -740,18 +741,10 @@ static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) | |||
740 | 741 | ||
741 | static int d40_start(struct d40_chan *d40c) | 742 | static int d40_start(struct d40_chan *d40c) |
742 | { | 743 | { |
743 | int err; | 744 | if (d40c->log_num != D40_PHY_CHAN) |
744 | |||
745 | if (d40c->log_num != D40_PHY_CHAN) { | ||
746 | err = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | ||
747 | if (err) | ||
748 | return err; | ||
749 | d40_config_set_event(d40c, true); | 745 | d40_config_set_event(d40c, true); |
750 | } | ||
751 | |||
752 | err = d40_channel_execute_command(d40c, D40_DMA_RUN); | ||
753 | 746 | ||
754 | return err; | 747 | return d40_channel_execute_command(d40c, D40_DMA_RUN); |
755 | } | 748 | } |
756 | 749 | ||
757 | static struct d40_desc *d40_queue_start(struct d40_chan *d40c) | 750 | static struct d40_desc *d40_queue_start(struct d40_chan *d40c) |
@@ -1340,7 +1333,6 @@ static bool d40_is_paused(struct d40_chan *d40c) | |||
1340 | void __iomem *active_reg; | 1333 | void __iomem *active_reg; |
1341 | u32 status; | 1334 | u32 status; |
1342 | u32 event; | 1335 | u32 event; |
1343 | int res; | ||
1344 | 1336 | ||
1345 | spin_lock_irqsave(&d40c->lock, flags); | 1337 | spin_lock_irqsave(&d40c->lock, flags); |
1346 | 1338 | ||
@@ -1359,10 +1351,6 @@ static bool d40_is_paused(struct d40_chan *d40c) | |||
1359 | goto _exit; | 1351 | goto _exit; |
1360 | } | 1352 | } |
1361 | 1353 | ||
1362 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | ||
1363 | if (res != 0) | ||
1364 | goto _exit; | ||
1365 | |||
1366 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || | 1354 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || |
1367 | d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) | 1355 | d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) |
1368 | event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); | 1356 | event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); |
@@ -1379,12 +1367,6 @@ static bool d40_is_paused(struct d40_chan *d40c) | |||
1379 | 1367 | ||
1380 | if (status != D40_DMA_RUN) | 1368 | if (status != D40_DMA_RUN) |
1381 | is_paused = true; | 1369 | is_paused = true; |
1382 | |||
1383 | /* Resume the other logical channels if any */ | ||
1384 | if (d40_chan_has_events(d40c)) | ||
1385 | res = d40_channel_execute_command(d40c, | ||
1386 | D40_DMA_RUN); | ||
1387 | |||
1388 | _exit: | 1370 | _exit: |
1389 | spin_unlock_irqrestore(&d40c->lock, flags); | 1371 | spin_unlock_irqrestore(&d40c->lock, flags); |
1390 | return is_paused; | 1372 | return is_paused; |
@@ -1430,20 +1412,13 @@ static int d40_resume(struct dma_chan *chan) | |||
1430 | 1412 | ||
1431 | spin_lock_irqsave(&d40c->lock, flags); | 1413 | spin_lock_irqsave(&d40c->lock, flags); |
1432 | 1414 | ||
1433 | if (d40c->log_num != D40_PHY_CHAN) { | 1415 | /* If bytes left to transfer or linked tx resume job */ |
1434 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | 1416 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) { |
1435 | if (res) | 1417 | if (d40c->log_num != D40_PHY_CHAN) |
1436 | goto out; | ||
1437 | |||
1438 | /* If bytes left to transfer or linked tx resume job */ | ||
1439 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) { | ||
1440 | d40_config_set_event(d40c, true); | 1418 | d40_config_set_event(d40c, true); |
1441 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); | ||
1442 | } | ||
1443 | } else if (d40_residue(d40c) || d40_tx_is_linked(d40c)) | ||
1444 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); | 1419 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); |
1420 | } | ||
1445 | 1421 | ||
1446 | out: | ||
1447 | spin_unlock_irqrestore(&d40c->lock, flags); | 1422 | spin_unlock_irqrestore(&d40c->lock, flags); |
1448 | return res; | 1423 | return res; |
1449 | } | 1424 | } |