diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dmaengine.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 0731802f876f..55b08e84ac8d 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -40,11 +40,13 @@ typedef s32 dma_cookie_t; | |||
40 | * enum dma_status - DMA transaction status | 40 | * enum dma_status - DMA transaction status |
41 | * @DMA_SUCCESS: transaction completed successfully | 41 | * @DMA_SUCCESS: transaction completed successfully |
42 | * @DMA_IN_PROGRESS: transaction not yet processed | 42 | * @DMA_IN_PROGRESS: transaction not yet processed |
43 | * @DMA_PAUSED: transaction is paused | ||
43 | * @DMA_ERROR: transaction failed | 44 | * @DMA_ERROR: transaction failed |
44 | */ | 45 | */ |
45 | enum dma_status { | 46 | enum dma_status { |
46 | DMA_SUCCESS, | 47 | DMA_SUCCESS, |
47 | DMA_IN_PROGRESS, | 48 | DMA_IN_PROGRESS, |
49 | DMA_PAUSED, | ||
48 | DMA_ERROR, | 50 | DMA_ERROR, |
49 | }; | 51 | }; |
50 | 52 | ||
@@ -249,6 +251,21 @@ struct dma_async_tx_descriptor { | |||
249 | }; | 251 | }; |
250 | 252 | ||
251 | /** | 253 | /** |
254 | * struct dma_tx_state - filled in to report the status of | ||
255 | * a transfer. | ||
256 | * @last: last completed DMA cookie | ||
257 | * @used: last issued DMA cookie (i.e. the one in progress) | ||
258 | * @residue: the remaining number of bytes left to transmit | ||
259 | * on the selected transfer for states DMA_IN_PROGRESS and | ||
260 | * DMA_PAUSED if this is implemented in the driver, else 0 | ||
261 | */ | ||
262 | struct dma_tx_state { | ||
263 | dma_cookie_t last; | ||
264 | dma_cookie_t used; | ||
265 | u32 residue; | ||
266 | }; | ||
267 | |||
268 | /** | ||
252 | * struct dma_device - info on the entity supplying DMA services | 269 | * struct dma_device - info on the entity supplying DMA services |
253 | * @chancnt: how many DMA channels are supported | 270 | * @chancnt: how many DMA channels are supported |
254 | * @privatecnt: how many DMA channels are requested by dma_request_channel | 271 | * @privatecnt: how many DMA channels are requested by dma_request_channel |
@@ -276,7 +293,10 @@ struct dma_async_tx_descriptor { | |||
276 | * @device_prep_slave_sg: prepares a slave dma operation | 293 | * @device_prep_slave_sg: prepares a slave dma operation |
277 | * @device_control: manipulate all pending operations on a channel, returns | 294 | * @device_control: manipulate all pending operations on a channel, returns |
278 | * zero or error code | 295 | * zero or error code |
279 | * @device_is_tx_complete: poll for transaction completion | 296 | * @device_tx_status: poll for transaction completion, the optional |
297 | * txstate parameter can be supplied with a pointer to get a | ||
298 | * struct with auxilary transfer status information, otherwise the call | ||
299 | * will just return a simple status code | ||
280 | * @device_issue_pending: push pending transactions to hardware | 300 | * @device_issue_pending: push pending transactions to hardware |
281 | */ | 301 | */ |
282 | struct dma_device { | 302 | struct dma_device { |
@@ -329,9 +349,9 @@ struct dma_device { | |||
329 | unsigned long flags); | 349 | unsigned long flags); |
330 | int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd); | 350 | int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd); |
331 | 351 | ||
332 | enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, | 352 | enum dma_status (*device_tx_status)(struct dma_chan *chan, |
333 | dma_cookie_t cookie, dma_cookie_t *last, | 353 | dma_cookie_t cookie, |
334 | dma_cookie_t *used); | 354 | struct dma_tx_state *txstate); |
335 | void (*device_issue_pending)(struct dma_chan *chan); | 355 | void (*device_issue_pending)(struct dma_chan *chan); |
336 | }; | 356 | }; |
337 | 357 | ||
@@ -572,7 +592,15 @@ static inline void dma_async_issue_pending(struct dma_chan *chan) | |||
572 | static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, | 592 | static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, |
573 | dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) | 593 | dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) |
574 | { | 594 | { |
575 | return chan->device->device_is_tx_complete(chan, cookie, last, used); | 595 | struct dma_tx_state state; |
596 | enum dma_status status; | ||
597 | |||
598 | status = chan->device->device_tx_status(chan, cookie, &state); | ||
599 | if (last) | ||
600 | *last = state.last; | ||
601 | if (used) | ||
602 | *used = state.used; | ||
603 | return status; | ||
576 | } | 604 | } |
577 | 605 | ||
578 | #define dma_async_memcpy_complete(chan, cookie, last, used)\ | 606 | #define dma_async_memcpy_complete(chan, cookie, last, used)\ |