summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/pxp/pxp_dma.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/dma/pxp/pxp_dma.c b/drivers/dma/pxp/pxp_dma.c
index fb43e27bb358..eabf0077c690 100644
--- a/drivers/dma/pxp/pxp_dma.c
+++ b/drivers/dma/pxp/pxp_dma.c
@@ -654,6 +654,8 @@ static void pxp_clk_enable(struct pxps *pxp)
static void pxp_clk_disable(struct pxps *pxp)
{
+ unsigned long flags;
+
mutex_lock(&pxp->clk_mutex);
if (pxp->clk_stat == CLK_STAT_OFF) {
@@ -661,8 +663,13 @@ static void pxp_clk_disable(struct pxps *pxp)
return;
}
- clk_disable(pxp->clk);
- pxp->clk_stat = CLK_STAT_OFF;
+ spin_lock_irqsave(&pxp->lock, flags);
+ if ((pxp->pxp_ongoing == 0) && list_empty(&head)) {
+ spin_unlock_irqrestore(&pxp->lock, flags);
+ clk_disable(pxp->clk);
+ pxp->clk_stat = CLK_STAT_OFF;
+ } else
+ spin_unlock_irqrestore(&pxp->lock, flags);
mutex_unlock(&pxp->clk_mutex);
}
@@ -1088,7 +1095,9 @@ static void pxp_issue_pending(struct dma_chan *chan)
return;
}
+ spin_lock_irqsave(&pxp->lock, flags);
pxp->pxp_ongoing = 1;
+ spin_unlock_irqrestore(&pxp->lock, flags);
pxpdma_dostart_work(pxp);
}