diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2010-03-26 19:50:49 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-03-26 19:50:49 -0400 |
commit | 0793448187643b50af89d36b08470baf45a3cab4 (patch) | |
tree | b3313ff58d47e26a8cf707d196177effa1aadfbe /drivers/dma/at_hdmac.c | |
parent | c3635c78e500a52c9fcd55de381a72928d9e054d (diff) |
DMAENGINE: generic channel status v2
Convert the device_is_tx_complete() operation on the
DMA engine to a generic device_tx_status()operation which
can return three states, DMA_TX_RUNNING, DMA_TX_COMPLETE,
DMA_TX_PAUSED.
[dan.j.williams@intel.com: update for timberdale]
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Li Yang <leoli@freescale.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Magnus Damm <damm@opensource.se>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Joe Perches <joe@perches.com>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/at_hdmac.c')
-rw-r--r-- | drivers/dma/at_hdmac.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index f9143cf9e50a..ff75cf18d32e 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -798,29 +798,25 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd) | |||
798 | } | 798 | } |
799 | 799 | ||
800 | /** | 800 | /** |
801 | * atc_is_tx_complete - poll for transaction completion | 801 | * atc_tx_status - poll for transaction completion |
802 | * @chan: DMA channel | 802 | * @chan: DMA channel |
803 | * @cookie: transaction identifier to check status of | 803 | * @cookie: transaction identifier to check status of |
804 | * @done: if not %NULL, updated with last completed transaction | 804 | * @txstate: if not %NULL updated with transaction state |
805 | * @used: if not %NULL, updated with last used transaction | ||
806 | * | 805 | * |
807 | * If @done and @used are passed in, upon return they reflect the driver | 806 | * If @txstate is passed in, upon return it reflect the driver |
808 | * internal state and can be used with dma_async_is_complete() to check | 807 | * internal state and can be used with dma_async_is_complete() to check |
809 | * the status of multiple cookies without re-checking hardware state. | 808 | * the status of multiple cookies without re-checking hardware state. |
810 | */ | 809 | */ |
811 | static enum dma_status | 810 | static enum dma_status |
812 | atc_is_tx_complete(struct dma_chan *chan, | 811 | atc_tx_status(struct dma_chan *chan, |
813 | dma_cookie_t cookie, | 812 | dma_cookie_t cookie, |
814 | dma_cookie_t *done, dma_cookie_t *used) | 813 | struct dma_tx_state *txstate) |
815 | { | 814 | { |
816 | struct at_dma_chan *atchan = to_at_dma_chan(chan); | 815 | struct at_dma_chan *atchan = to_at_dma_chan(chan); |
817 | dma_cookie_t last_used; | 816 | dma_cookie_t last_used; |
818 | dma_cookie_t last_complete; | 817 | dma_cookie_t last_complete; |
819 | enum dma_status ret; | 818 | enum dma_status ret; |
820 | 819 | ||
821 | dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n", | ||
822 | cookie, done ? *done : 0, used ? *used : 0); | ||
823 | |||
824 | spin_lock_bh(&atchan->lock); | 820 | spin_lock_bh(&atchan->lock); |
825 | 821 | ||
826 | last_complete = atchan->completed_cookie; | 822 | last_complete = atchan->completed_cookie; |
@@ -838,10 +834,15 @@ atc_is_tx_complete(struct dma_chan *chan, | |||
838 | 834 | ||
839 | spin_unlock_bh(&atchan->lock); | 835 | spin_unlock_bh(&atchan->lock); |
840 | 836 | ||
841 | if (done) | 837 | if (txstate) { |
842 | *done = last_complete; | 838 | txstate->last = last_complete; |
843 | if (used) | 839 | txstate->used = last_used; |
844 | *used = last_used; | 840 | txstate->residue = 0; |
841 | } | ||
842 | |||
843 | dev_vdbg(chan2dev(chan), "tx_status: %d (d%d, u%d)\n", | ||
844 | cookie, last_complete ? last_complete : 0, | ||
845 | last_used ? last_used : 0); | ||
845 | 846 | ||
846 | return ret; | 847 | return ret; |
847 | } | 848 | } |
@@ -1087,7 +1088,7 @@ static int __init at_dma_probe(struct platform_device *pdev) | |||
1087 | /* set base routines */ | 1088 | /* set base routines */ |
1088 | atdma->dma_common.device_alloc_chan_resources = atc_alloc_chan_resources; | 1089 | atdma->dma_common.device_alloc_chan_resources = atc_alloc_chan_resources; |
1089 | atdma->dma_common.device_free_chan_resources = atc_free_chan_resources; | 1090 | atdma->dma_common.device_free_chan_resources = atc_free_chan_resources; |
1090 | atdma->dma_common.device_is_tx_complete = atc_is_tx_complete; | 1091 | atdma->dma_common.device_tx_status = atc_tx_status; |
1091 | atdma->dma_common.device_issue_pending = atc_issue_pending; | 1092 | atdma->dma_common.device_issue_pending = atc_issue_pending; |
1092 | atdma->dma_common.dev = &pdev->dev; | 1093 | atdma->dma_common.dev = &pdev->dev; |
1093 | 1094 | ||