[alsa-devel] [PATCH v4 4/4] ASoC: SAMSUNG: Add I2S0 internal dma driver
Jassi Brar
jassisinghbrar at gmail.com
Tue Jul 12 10:06:36 CEST 2011
On Fri, Jul 1, 2011 at 7:18 AM, Sangbeom Kim <sbkim73 at samsung.com> wrote:
> +static void idma_control(int op)
> +{
> + u32 val = readl(idma.regs + I2SAHB);
> +
> + spin_lock(&idma.lock);
> +
> + switch (op) {
> + case LPAM_DMA_START:
> + val |= (AHB_INTENLVL0 | AHB_DMAEN);
> + break;
> + case LPAM_DMA_STOP:
> + val &= ~(AHB_INTENLVL0 | AHB_DMAEN);
> + break;
> + default:
> + return;
Need to release the lock before return.
This is not the showstopper for this revision.
> + }
> +
> + writel(val, idma.regs + I2SAHB);
> + spin_unlock(&idma.lock);
> +}
> +
......
> +static irqreturn_t iis_irq(int irqno, void *dev_id)
> +{
> + struct idma_ctrl *prtd = (struct idma_ctrl *)dev_id;
> + u32 iiscon, iisahb, val, addr;
> +
> + iisahb = readl(idma.regs + I2SAHB);
> + iiscon = readl(idma.regs + I2SCON);
> +
> + val = (iisahb & AHB_LVL0INT) ? AHB_CLRLVL0INT : 0;
> +
> + if (val) {
> + iisahb |= val;
> + writel(iisahb, idma.regs + I2SAHB);
> +
> + addr = readl(idma.regs + I2SLVL0ADDR) - idma.lp_tx_addr;
> + addr += prtd->periodsz;
> + addr %= prtd->period;
> + addr += idma.lp_tx_addr;
Dear, out of 4 revisions, 3(including current) got it wrong at this
important point.
Ok write it like below
addr = readl(idma.regs + I2SLVL0ADDR) - idma.lp_tx_addr;
addr += prtd->periodsz;
addr %= (prtd->end - prtd->start); // <------ Note
addr += idma.lp_tx_addr;
> +
> + writel(addr, idma.regs + I2SLVL0ADDR);
> +
> + if (prtd->cb)
> + prtd->cb(prtd->token, prtd->period);
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
More information about the Alsa-devel
mailing list