From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755591AbcBZWWJ (ORCPT ); Fri, 26 Feb 2016 17:22:09 -0500 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:53898 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755562AbcBZWWG (ORCPT ); Fri, 26 Feb 2016 17:22:06 -0500 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Fri, 26 Feb 2016 23:22:03 +0100 X-ME-IP: 109.220.219.11 From: Robert Jarzmik To: Vinod Koul Cc: Haojian Zhuang , Daniel Mack , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] dmaengine: pxa_dma: fix cyclic transfers References: <1455659642-7746-1-git-send-email-robert.jarzmik@free.fr> X-URL: http://belgarath.falguerolles.org/ Date: Fri, 26 Feb 2016 23:22:03 +0100 In-Reply-To: <1455659642-7746-1-git-send-email-robert.jarzmik@free.fr> (Robert Jarzmik's message of "Tue, 16 Feb 2016 22:54:02 +0100") Message-ID: <87a8mnun78.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Robert Jarzmik writes: > While testing audio with pxa2xx-ac97, underrun were happening while the > user application was correctly feeding the music. Debug proved that the > cyclic transfer is not cyclic, ie. the last descriptor did not loop on > the first. > > Another issue is that the descriptor length was always set to 8192, > because of an trivial operator issue. > > This was tested on a pxa27x platform. > > Fixes: a57e16cf0333 ("dmaengine: pxa: add pxa dmaengine driver") > Reported-by: Vasily Khoruzhick > Tested-by: Vasily Khoruzhick > Signed-off-by: Robert Jarzmik > --- > Since v1: add the mask fix suggested by Vasily Hi Vinod, Could you consider this patch, it's a fix and I'd like to have it reviewed. Cheers. -- Robert [1] The patch on cyclic transfers > --- > drivers/dma/pxa_dma.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c > index 8ab4a53e5660..77c1c44009d8 100644 > --- a/drivers/dma/pxa_dma.c > +++ b/drivers/dma/pxa_dma.c > @@ -586,6 +586,8 @@ static void set_updater_desc(struct pxad_desc_sw *sw_desc, > (PXA_DCMD_LENGTH & sizeof(u32)); > if (flags & DMA_PREP_INTERRUPT) > updater->dcmd |= PXA_DCMD_ENDIRQEN; > + if (sw_desc->cyclic) > + sw_desc->hw_desc[sw_desc->nb_desc - 2]->ddadr = sw_desc->first; > } > > static bool is_desc_completed(struct virt_dma_desc *vd) > @@ -676,6 +678,10 @@ static irqreturn_t pxad_chan_handler(int irq, void *dev_id) > dev_dbg(&chan->vc.chan.dev->device, > "%s(): checking txd %p[%x]: completed=%d\n", > __func__, vd, vd->tx.cookie, is_desc_completed(vd)); > + if (to_pxad_sw_desc(vd)->cyclic) { > + vchan_cyclic_callback(vd); > + break; > + } > if (is_desc_completed(vd)) { > list_del(&vd->node); > vchan_cookie_complete(vd); > @@ -1084,7 +1090,7 @@ pxad_prep_dma_cyclic(struct dma_chan *dchan, > return NULL; > > pxad_get_config(chan, dir, &dcmd, &dsadr, &dtadr); > - dcmd |= PXA_DCMD_ENDIRQEN | (PXA_DCMD_LENGTH | period_len); > + dcmd |= PXA_DCMD_ENDIRQEN | (PXA_DCMD_LENGTH & period_len); > dev_dbg(&chan->vc.chan.dev->device, > "%s(): buf_addr=0x%lx len=%zu period=%zu dir=%d flags=%lx\n", > __func__, (unsigned long)buf_addr, len, period_len, dir, flags); -- Robert