ARM: tegra: dma: enum for initial status of dma req
Laxman Dewangan [Mon, 2 Apr 2012 08:48:07 +0000 (13:48 +0530)]
Adding new req status TEGRA_DMA_REQ_PENDING. This will be initial
status of the request when enqueued.

Change-Id: I67ee71dd0c64b6398305b86fbf186488f062e876
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/93801
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/dma.c
arch/arm/mach-tegra/include/mach/dma.h

index aabee5e..c9c0cda 100644 (file)
@@ -214,9 +214,17 @@ static void resume_dma(void)
 static void start_head_req(struct tegra_dma_channel *ch)
 {
        struct tegra_dma_req *head_req;
+       struct tegra_dma_req *next_req;
        if (!list_empty(&ch->list)) {
                head_req = list_entry(ch->list.next, typeof(*head_req), node);
                tegra_dma_update_hw(ch, head_req);
+
+               /* Set next request to idle. */
+               if (!list_is_last(&head_req->node, &ch->list)) {
+                       next_req = list_entry(head_req->node.next,
+                                       typeof(*head_req), node);
+                       next_req->status = TEGRA_DMA_REQ_PENDING;
+               }
        }
 }
 
@@ -504,7 +512,7 @@ int tegra_dma_enqueue_req(struct tegra_dma_channel *ch,
        }
 
        req->bytes_transferred = 0;
-       req->status = 0;
+       req->status = TEGRA_DMA_REQ_PENDING;
        /* STATUS_EMPTY just means the DMA hasn't processed the buf yet. */
        req->buffer_status = TEGRA_DMA_REQ_BUF_STATUS_EMPTY;
        if (list_empty(&ch->list))
index 0ae9c87..948538a 100644 (file)
@@ -74,6 +74,7 @@ enum tegra_dma_mode {
 
 /*
  * tegra_dma_req_status: Dma request status
+ * TEGRA_DMA_REQ_PENDING: Request is pending and not programmed in hw.
  * TEGRA_DMA_REQ_SUCCESS: The request has been successfully completed.
  *             The byte_transferred tells number of bytes transferred.
  * TEGRA_DMA_REQ_ERROR_ABORTED: The request is aborted by client after
@@ -96,7 +97,8 @@ enum tegra_dma_mode {
  */
 
 enum tegra_dma_req_status {
-       TEGRA_DMA_REQ_SUCCESS = 0,
+       TEGRA_DMA_REQ_PENDING = 0,
+       TEGRA_DMA_REQ_SUCCESS,
        TEGRA_DMA_REQ_ERROR_ABORTED,
        TEGRA_DMA_REQ_ERROR_STOPPED,
        TEGRA_DMA_REQ_INFLIGHT,