diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2016-04-06 06:01:46 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2016-04-06 10:29:49 -0400 |
commit | 23f49fd2ea9bc8e1c8cff0126cd71b071ea9e91f (patch) | |
tree | d09e21ab177b13ed83301bac58626849fa906125 | |
parent | f55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff) |
dmaengine: edma: Remove dynamic TPTC power management feature
The dynamic or on demand pm_runtime does not work correctly on am335x and
am437x due to interference with hwmod.
Fall back using the pm_runtime usage as it was in the old driver stack,
meaning that at probe time call pm_runtime_enable() and
pm_runtime_get_sync() for the TPTCs as well.
Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reported-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/edma.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index ee3463e774f8..13b6a23dc06b 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -1570,32 +1570,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) | |||
1570 | return IRQ_HANDLED; | 1570 | return IRQ_HANDLED; |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable) | ||
1574 | { | ||
1575 | struct platform_device *tc_pdev; | ||
1576 | int ret; | ||
1577 | |||
1578 | if (!IS_ENABLED(CONFIG_OF) || !tc) | ||
1579 | return; | ||
1580 | |||
1581 | tc_pdev = of_find_device_by_node(tc->node); | ||
1582 | if (!tc_pdev) { | ||
1583 | pr_err("%s: TPTC device is not found\n", __func__); | ||
1584 | return; | ||
1585 | } | ||
1586 | if (!pm_runtime_enabled(&tc_pdev->dev)) | ||
1587 | pm_runtime_enable(&tc_pdev->dev); | ||
1588 | |||
1589 | if (enable) | ||
1590 | ret = pm_runtime_get_sync(&tc_pdev->dev); | ||
1591 | else | ||
1592 | ret = pm_runtime_put_sync(&tc_pdev->dev); | ||
1593 | |||
1594 | if (ret < 0) | ||
1595 | pr_err("%s: pm_runtime_%s_sync() failed for %s\n", __func__, | ||
1596 | enable ? "get" : "put", dev_name(&tc_pdev->dev)); | ||
1597 | } | ||
1598 | |||
1599 | /* Alloc channel resources */ | 1573 | /* Alloc channel resources */ |
1600 | static int edma_alloc_chan_resources(struct dma_chan *chan) | 1574 | static int edma_alloc_chan_resources(struct dma_chan *chan) |
1601 | { | 1575 | { |
@@ -1632,8 +1606,6 @@ static int edma_alloc_chan_resources(struct dma_chan *chan) | |||
1632 | EDMA_CHAN_SLOT(echan->ch_num), chan->chan_id, | 1606 | EDMA_CHAN_SLOT(echan->ch_num), chan->chan_id, |
1633 | echan->hw_triggered ? "HW" : "SW"); | 1607 | echan->hw_triggered ? "HW" : "SW"); |
1634 | 1608 | ||
1635 | edma_tc_set_pm_state(echan->tc, true); | ||
1636 | |||
1637 | return 0; | 1609 | return 0; |
1638 | 1610 | ||
1639 | err_slot: | 1611 | err_slot: |
@@ -1670,7 +1642,6 @@ static void edma_free_chan_resources(struct dma_chan *chan) | |||
1670 | echan->alloced = false; | 1642 | echan->alloced = false; |
1671 | } | 1643 | } |
1672 | 1644 | ||
1673 | edma_tc_set_pm_state(echan->tc, false); | ||
1674 | echan->tc = NULL; | 1645 | echan->tc = NULL; |
1675 | echan->hw_triggered = false; | 1646 | echan->hw_triggered = false; |
1676 | 1647 | ||
@@ -2417,10 +2388,8 @@ static int edma_pm_suspend(struct device *dev) | |||
2417 | int i; | 2388 | int i; |
2418 | 2389 | ||
2419 | for (i = 0; i < ecc->num_channels; i++) { | 2390 | for (i = 0; i < ecc->num_channels; i++) { |
2420 | if (echan[i].alloced) { | 2391 | if (echan[i].alloced) |
2421 | edma_setup_interrupt(&echan[i], false); | 2392 | edma_setup_interrupt(&echan[i], false); |
2422 | edma_tc_set_pm_state(echan[i].tc, false); | ||
2423 | } | ||
2424 | } | 2393 | } |
2425 | 2394 | ||
2426 | return 0; | 2395 | return 0; |
@@ -2450,8 +2419,6 @@ static int edma_pm_resume(struct device *dev) | |||
2450 | 2419 | ||
2451 | /* Set up channel -> slot mapping for the entry slot */ | 2420 | /* Set up channel -> slot mapping for the entry slot */ |
2452 | edma_set_chmap(&echan[i], echan[i].slot[0]); | 2421 | edma_set_chmap(&echan[i], echan[i].slot[0]); |
2453 | |||
2454 | edma_tc_set_pm_state(echan[i].tc, true); | ||
2455 | } | 2422 | } |
2456 | } | 2423 | } |
2457 | 2424 | ||
@@ -2475,7 +2442,8 @@ static struct platform_driver edma_driver = { | |||
2475 | 2442 | ||
2476 | static int edma_tptc_probe(struct platform_device *pdev) | 2443 | static int edma_tptc_probe(struct platform_device *pdev) |
2477 | { | 2444 | { |
2478 | return 0; | 2445 | pm_runtime_enable(&pdev->dev); |
2446 | return pm_runtime_get_sync(&pdev->dev); | ||
2479 | } | 2447 | } |
2480 | 2448 | ||
2481 | static struct platform_driver edma_tptc_driver = { | 2449 | static struct platform_driver edma_tptc_driver = { |