Re: [PATCH v3 2/3] dmaengine: ptdma: Register pass-through engine as a DMA resource
From: Vinod Koul
Date: Fri Jan 24 2020 - 01:05:39 EST
On 21-01-20, 03:04, Sanjay R Mehta wrote:
> +static void pt_free_chan_resources(struct dma_chan *dma_chan)
> +{
> + struct pt_dma_chan *chan = container_of(dma_chan, struct pt_dma_chan,
> + dma_chan);
> + unsigned long flags;
> +
> + dev_dbg(chan->pt->dev, "%s - chan=%p\n", __func__, chan);
> +
> + spin_lock_irqsave(&chan->lock, flags);
> +
> + pt_free_desc_resources(chan->pt, &chan->complete);
> + pt_free_desc_resources(chan->pt, &chan->active);
> + pt_free_desc_resources(chan->pt, &chan->pending);
> + pt_free_desc_resources(chan->pt, &chan->created);
can you use the virt-dma layer instead for list and descriptor
management..
> +static enum dma_status pt_tx_status(struct dma_chan *dma_chan,
> + dma_cookie_t cookie,
> + struct dma_tx_state *state)
> +{
> + struct pt_dma_chan *chan = container_of(dma_chan, struct pt_dma_chan,
> + dma_chan);
> + struct pt_dma_desc *desc;
> + enum dma_status ret;
> + unsigned long flags;
> +
> + if (chan->status == DMA_PAUSED) {
> + ret = DMA_PAUSED;
the pt_tx_status is for a specific cookie and not for the channel, so
you need to return status of the cookie which may have been completed or
pending (where pause makes sense)
> +static int pt_pause(struct dma_chan *dma_chan)
> +{
> + struct pt_dma_chan *chan = container_of(dma_chan, struct pt_dma_chan,
> + dma_chan);
> +
> + chan->status = DMA_PAUSED;
> +
> + /*TODO: Wait for active DMA to complete before returning? */
When will the be resolved :)
--
~Vinod