dmaengine: mmp_tdma: add DMA_PREP_INTERRUPT flag support

add DMA_PREP_INTERRUPT flag to support no_period_wakeup, in which
user space app doesn't want audio interrupt to wake up audio threads.

Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
Qiao Zhou 2014-09-10 16:40:48 +08:00 committed by Vinod Koul
parent e34b731faa
commit e622226312
1 changed files with 14 additions and 5 deletions

View File

@ -148,10 +148,16 @@ static void mmp_tdma_chan_set_desc(struct mmp_tdma_chan *tdmac, dma_addr_t phys)
tdmac->reg_base + TDCR); tdmac->reg_base + TDCR);
} }
static void mmp_tdma_enable_irq(struct mmp_tdma_chan *tdmac, bool enable)
{
if (enable)
writel(TDIMR_COMP, tdmac->reg_base + TDIMR);
else
writel(0, tdmac->reg_base + TDIMR);
}
static void mmp_tdma_enable_chan(struct mmp_tdma_chan *tdmac) static void mmp_tdma_enable_chan(struct mmp_tdma_chan *tdmac)
{ {
/* enable irq */
writel(TDIMR_COMP, tdmac->reg_base + TDIMR);
/* enable dma chan */ /* enable dma chan */
writel(readl(tdmac->reg_base + TDCR) | TDCR_CHANEN, writel(readl(tdmac->reg_base + TDCR) | TDCR_CHANEN,
tdmac->reg_base + TDCR); tdmac->reg_base + TDCR);
@ -163,9 +169,6 @@ static void mmp_tdma_disable_chan(struct mmp_tdma_chan *tdmac)
writel(readl(tdmac->reg_base + TDCR) & ~TDCR_CHANEN, writel(readl(tdmac->reg_base + TDCR) & ~TDCR_CHANEN,
tdmac->reg_base + TDCR); tdmac->reg_base + TDCR);
/* disable irq */
writel(0, tdmac->reg_base + TDIMR);
tdmac->status = DMA_COMPLETE; tdmac->status = DMA_COMPLETE;
} }
@ -434,6 +437,10 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic(
i++; i++;
} }
/* enable interrupt */
if (flags & DMA_PREP_INTERRUPT)
mmp_tdma_enable_irq(tdmac, true);
tdmac->buf_len = buf_len; tdmac->buf_len = buf_len;
tdmac->period_len = period_len; tdmac->period_len = period_len;
tdmac->pos = 0; tdmac->pos = 0;
@ -455,6 +462,8 @@ static int mmp_tdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
switch (cmd) { switch (cmd) {
case DMA_TERMINATE_ALL: case DMA_TERMINATE_ALL:
mmp_tdma_disable_chan(tdmac); mmp_tdma_disable_chan(tdmac);
/* disable interrupt */
mmp_tdma_enable_irq(tdmac, false);
break; break;
case DMA_PAUSE: case DMA_PAUSE:
mmp_tdma_pause_chan(tdmac); mmp_tdma_pause_chan(tdmac);