public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Robert Baldyga <r.baldyga@samsung.com>, vinod.koul@intel.com
Cc: dan.j.williams@intel.com, ars@metafoo.de,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	m.szyprowski@samsung.com, l.czerwinski@samsung.com
Subject: Re: [PATCH 1/2] dma: pl330: improve pl330_tx_status() function
Date: Tue, 25 Nov 2014 13:43:24 +0100	[thread overview]
Message-ID: <5474796C.50603@metafoo.de> (raw)
In-Reply-To: <1416918346-2442-2-git-send-email-r.baldyga@samsung.com>

On 11/25/2014 01:25 PM, Robert Baldyga wrote:
[...]
>   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;
> +	struct dma_pl330_chan *pch = to_pchan(chan);
> +	unsigned int bytes_transferred;
> +	unsigned int residual;
> +
> +	/* Check in pending list */
> +	spin_lock_irqsave(&pch->lock, flags);
> +	list_for_each_entry(desc, &pch->work_list, node) {
> +		if (desc->txd.cookie == cookie) {
> +			bytes_transferred =
> +				pl330_get_current_xferred_count(pch, desc);
> +			residual =  desc->bytes_requested -
> +				bytes_transferred % desc->bytes_requested;
> +			dma_set_residue(txstate, residual);
> +			ret = desc->status;
> +			spin_unlock_irqrestore(&pch->lock, flags);
> +			return ret;

I don't think this has the correct semantics. The expected behavior is that 
you pass a cookie of a descriptor and tx_status tells you how many bytes for 
the whole descriptor are still left to be transferred. What you implemented 
tells you how many bytes are still left for the current segment of the 
active descriptor. This will only work fine for descriptors that only have 
one segment. But this will definitely break audio playback using the PL330 
where you have more than one segment per descriptor.


> +		}
> +	}
> +	spin_unlock_irqrestore(&pch->lock, flags);
> +
> +	ret = dma_cookie_status(chan, cookie, txstate);
> +	dma_set_residue(txstate,  pch->transfered);
> +

pch->transfered is always 0?

  reply	other threads:[~2014-11-25 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 12:25 [PATCH 0/2] dma: pl330: improve status checking Robert Baldyga
2014-11-25 12:25 ` [PATCH 1/2] dma: pl330: improve pl330_tx_status() function Robert Baldyga
2014-11-25 12:43   ` Lars-Peter Clausen [this message]
2014-11-25 13:56   ` Krzysztof Kozłowski
     [not found]     ` <CAM4voamo307W_v8gy-eegTmV+yBSQG8eRKLgFxredR2SJt6PPA@mail.gmail.com>
2014-11-26 10:00       ` Padma Venkat
2014-11-25 12:25 ` [PATCH 2/2] dma: pl330: add DMA_PAUSE feature Robert Baldyga
2014-11-25 13:41   ` Krzysztof Kozłowski

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=5474796C.50603@metafoo.de \
    --to=lars@metafoo.de \
    --cc=ars@metafoo.de \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=l.czerwinski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=r.baldyga@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox