lkml.org 
[lkml]   [2014]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] dma: pl330: improve pl330_tx_status() function
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?


\
 
 \ /
  Last update: 2014-11-25 14:21    [W:0.276 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site