All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Baldyga <r.baldyga@samsung.com>
To: Vinod Koul <vinod.koul@intel.com>
Cc: dan.j.williams@intel.com, lars@metafoo.de,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	m.szyprowski@samsung.com, k.kozlowski@samsung.com,
	kyungmin.park@samsung.com, l.czerwinski@samsung.com,
	padma.kvr@gmail.com
Subject: Re: [PATCH v3 1/2] dma: pl330: improve pl330_tx_status() function
Date: Wed, 11 Feb 2015 11:50:22 +0100	[thread overview]
Message-ID: <54DB33EE.9020609@samsung.com> (raw)
In-Reply-To: <20150211002318.GB21387@intel.com>

On 02/11/2015 01:23 AM, Vinod Koul wrote:
> On Wed, Dec 10, 2014 at 11:55:17AM +0100, Robert Baldyga wrote:
>> This patch adds possibility to read residue of DMA transfer. It's useful
>> when we want to know how many bytes have been transferred before we
>> terminate channel. It can take place, for example, on timeout interrupt.
>>
>> Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com>
>> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
>> ---
>>  drivers/dma/pl330.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 66 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
>> index bdf40b5..2f4d561 100644
>> --- a/drivers/dma/pl330.c
>> +++ b/drivers/dma/pl330.c
>> @@ -504,6 +504,9 @@ struct dma_pl330_desc {
>>  
>>  	enum desc_status status;
>>  
>> +	int bytes_requested;
>> +	bool last;
>> +
>>  	/* The channel which currently holds this desc */
>>  	struct dma_pl330_chan *pchan;
>>  
>> @@ -2182,11 +2185,68 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
>>  	pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
>>  }
>>  
>> +int pl330_get_current_xferred_count(struct dma_pl330_chan *pch,
>> +		struct dma_pl330_desc *desc)
>> +{
>> +	struct pl330_thread *thrd = pch->thread;
>> +	struct pl330_dmac *pl330 = pch->dmac;
>> +	void __iomem *regs = thrd->dmac->base;
>> +	u32 val, addr;
>> +
>> +	pm_runtime_get_sync(pl330->ddma.dev);
>> +	val = addr = 0;
>> +	if (desc->rqcfg.src_inc) {
>> +		val = readl(regs + SA(thrd->id));
>> +		addr = desc->px.src_addr;
>> +	} else {
>> +		val = readl(regs + DA(thrd->id));
>> +		addr = desc->px.dst_addr;
>> +	}
>> +	pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
>> +	pm_runtime_put_autosuspend(pl330->ddma.dev);
>> +	return val - addr;
>> +}
>> +
>>  static enum dma_status
>>  pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
>>  		 struct dma_tx_state *txstate)
>>  {
>> -	return dma_cookie_status(chan, cookie, txstate);
>> +	enum dma_status ret;
>> +	unsigned long flags;
>> +	struct dma_pl330_desc *desc, *running = NULL;
>> +	struct dma_pl330_chan *pch = to_pchan(chan);
>> +	unsigned int transferred, residual = 0;
>> +
>> +	spin_lock_irqsave(&pch->lock, flags);
> You want to check the dma_cookie_status here first and then based on status
> go into residue calcaultion, that too only when the txstate is NON null.
> 

Ok, I will send v4.

Thanks,
Robert Baldyga

  reply	other threads:[~2015-02-11 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 10:55 [PATCH v3 0/2] dma: pl330: improve status checking Robert Baldyga
2014-12-10 10:55 ` [PATCH v3 1/2] dma: pl330: improve pl330_tx_status() function Robert Baldyga
2015-02-11  0:23   ` Vinod Koul
2015-02-11 10:50     ` Robert Baldyga [this message]
2014-12-10 10:55 ` [PATCH v3 2/2] dma: pl330: add DMA_PAUSE feature Robert Baldyga
2015-02-11  0:24   ` Vinod Koul
2015-02-11 11:02     ` Robert Baldyga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54DB33EE.9020609@samsung.com \
    --to=r.baldyga@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=l.czerwinski@samsung.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=padma.kvr@gmail.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.