diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-11-17 08:42:36 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-12-22 02:03:21 -0500 |
commit | 6f5bad03e894dba90707efd0ac8159d46f1bb157 (patch) | |
tree | 7556046a2dadc715ea4ae1bb38891c50335882a8 | |
parent | 826b15a7a8eda016e8a8e86d4dedb80840a8bbba (diff) |
dmaengine: d40: Split device_control
Split the device_control callback of the ST-Ericsson DMA 40 driver to make use
of the newly introduced callbacks, that will eventually be used to retrieve
slave capabilities.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/ste_dma40.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 15d49461c0d2..e5a284865e92 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1429,11 +1429,17 @@ static bool d40_tx_is_linked(struct d40_chan *d40c) | |||
1429 | return is_link; | 1429 | return is_link; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | static int d40_pause(struct d40_chan *d40c) | 1432 | static int d40_pause(struct dma_chan *chan) |
1433 | { | 1433 | { |
1434 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | ||
1434 | int res = 0; | 1435 | int res = 0; |
1435 | unsigned long flags; | 1436 | unsigned long flags; |
1436 | 1437 | ||
1438 | if (d40c->phy_chan == NULL) { | ||
1439 | chan_err(d40c, "Channel is not allocated!\n"); | ||
1440 | return -EINVAL; | ||
1441 | } | ||
1442 | |||
1437 | if (!d40c->busy) | 1443 | if (!d40c->busy) |
1438 | return 0; | 1444 | return 0; |
1439 | 1445 | ||
@@ -1448,11 +1454,17 @@ static int d40_pause(struct d40_chan *d40c) | |||
1448 | return res; | 1454 | return res; |
1449 | } | 1455 | } |
1450 | 1456 | ||
1451 | static int d40_resume(struct d40_chan *d40c) | 1457 | static int d40_resume(struct dma_chan *chan) |
1452 | { | 1458 | { |
1459 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | ||
1453 | int res = 0; | 1460 | int res = 0; |
1454 | unsigned long flags; | 1461 | unsigned long flags; |
1455 | 1462 | ||
1463 | if (d40c->phy_chan == NULL) { | ||
1464 | chan_err(d40c, "Channel is not allocated!\n"); | ||
1465 | return -EINVAL; | ||
1466 | } | ||
1467 | |||
1456 | if (!d40c->busy) | 1468 | if (!d40c->busy) |
1457 | return 0; | 1469 | return 0; |
1458 | 1470 | ||
@@ -2610,6 +2622,11 @@ static void d40_terminate_all(struct dma_chan *chan) | |||
2610 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | 2622 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); |
2611 | int ret; | 2623 | int ret; |
2612 | 2624 | ||
2625 | if (d40c->phy_chan == NULL) { | ||
2626 | chan_err(d40c, "Channel is not allocated!\n"); | ||
2627 | return -EINVAL; | ||
2628 | } | ||
2629 | |||
2613 | spin_lock_irqsave(&d40c->lock, flags); | 2630 | spin_lock_irqsave(&d40c->lock, flags); |
2614 | 2631 | ||
2615 | pm_runtime_get_sync(d40c->base->dev); | 2632 | pm_runtime_get_sync(d40c->base->dev); |
@@ -2673,6 +2690,11 @@ static int d40_set_runtime_config(struct dma_chan *chan, | |||
2673 | u32 src_maxburst, dst_maxburst; | 2690 | u32 src_maxburst, dst_maxburst; |
2674 | int ret; | 2691 | int ret; |
2675 | 2692 | ||
2693 | if (d40c->phy_chan == NULL) { | ||
2694 | chan_err(d40c, "Channel is not allocated!\n"); | ||
2695 | return -EINVAL; | ||
2696 | } | ||
2697 | |||
2676 | src_addr_width = config->src_addr_width; | 2698 | src_addr_width = config->src_addr_width; |
2677 | src_maxburst = config->src_maxburst; | 2699 | src_maxburst = config->src_maxburst; |
2678 | dst_addr_width = config->dst_addr_width; | 2700 | dst_addr_width = config->dst_addr_width; |
@@ -2781,35 +2803,6 @@ static int d40_set_runtime_config(struct dma_chan *chan, | |||
2781 | return 0; | 2803 | return 0; |
2782 | } | 2804 | } |
2783 | 2805 | ||
2784 | static int d40_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | ||
2785 | unsigned long arg) | ||
2786 | { | ||
2787 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | ||
2788 | |||
2789 | if (d40c->phy_chan == NULL) { | ||
2790 | chan_err(d40c, "Channel is not allocated!\n"); | ||
2791 | return -EINVAL; | ||
2792 | } | ||
2793 | |||
2794 | switch (cmd) { | ||
2795 | case DMA_TERMINATE_ALL: | ||
2796 | d40_terminate_all(chan); | ||
2797 | return 0; | ||
2798 | case DMA_PAUSE: | ||
2799 | return d40_pause(d40c); | ||
2800 | case DMA_RESUME: | ||
2801 | return d40_resume(d40c); | ||
2802 | case DMA_SLAVE_CONFIG: | ||
2803 | return d40_set_runtime_config(chan, | ||
2804 | (struct dma_slave_config *) arg); | ||
2805 | default: | ||
2806 | break; | ||
2807 | } | ||
2808 | |||
2809 | /* Other commands are unimplemented */ | ||
2810 | return -ENXIO; | ||
2811 | } | ||
2812 | |||
2813 | /* Initialization functions */ | 2806 | /* Initialization functions */ |
2814 | 2807 | ||
2815 | static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma, | 2808 | static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma, |
@@ -2870,7 +2863,10 @@ static void d40_ops_init(struct d40_base *base, struct dma_device *dev) | |||
2870 | dev->device_free_chan_resources = d40_free_chan_resources; | 2863 | dev->device_free_chan_resources = d40_free_chan_resources; |
2871 | dev->device_issue_pending = d40_issue_pending; | 2864 | dev->device_issue_pending = d40_issue_pending; |
2872 | dev->device_tx_status = d40_tx_status; | 2865 | dev->device_tx_status = d40_tx_status; |
2873 | dev->device_control = d40_control; | 2866 | dev->device_config = d40_set_runtime_config; |
2867 | dev->device_pause = d40_pause; | ||
2868 | dev->device_resume = d40_resume; | ||
2869 | dev->device_terminate_all = d40_terminate_all; | ||
2874 | dev->dev = base->dev; | 2870 | dev->dev = base->dev; |
2875 | } | 2871 | } |
2876 | 2872 | ||