All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: dmaengine@vger.kernel.org, Michal Simek <michal.simek@xilinx.com>,
	Hyun Kwon <hyun.kwon@xilinx.com>,
	Tejas Upadhyay <tejasu@xilinx.com>,
	Satish Kumar Nagireddy <SATISHNA@xilinx.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: Re: [PATCH v6 4/6] dmaengine: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver
Date: Sun, 12 Jul 2020 01:16:44 +0300	[thread overview]
Message-ID: <20200711221644.GD5954@pendragon.ideasonboard.com> (raw)
In-Reply-To: <64817596-1ba2-97d7-1dde-600eead16b05@ti.com>

Hi Peter,

On Thu, Jul 09, 2020 at 04:21:38PM +0300, Peter Ujfalusi wrote:
> On 08/07/2020 23.19, Laurent Pinchart wrote:
> > From: Hyun Kwon <hyun.kwon@xilinx.com>
> > 
> > The ZynqMP DisplayPort subsystem includes a DMA engine called DPDMA with
> > 6 DMa channels (4 for display and 2 for audio). This driver exposes the
> > DPDMA through the dmaengine API, to be used by audio (ALSA) and display
> > (DRM) drivers for the DisplayPort subsystem.
> > 
> > Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
> > Signed-off-by: Tejas Upadhyay <tejasu@xilinx.com>
> > Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> ...
> 
> > +static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan)
> > +{
> > +	struct xilinx_dpdma_device *xdev = chan->xdev;
> > +	struct xilinx_dpdma_sw_desc *sw_desc;
> > +	struct xilinx_dpdma_tx_desc *desc;
> > +	struct virt_dma_desc *vdesc;
> > +	u32 reg, channels;
> > +
> > +	lockdep_assert_held(&chan->lock);
> > +
> > +	if (chan->desc.pending)
> > +		return;
> > +
> > +	if (!chan->running) {
> > +		xilinx_dpdma_chan_unpause(chan);
> > +		xilinx_dpdma_chan_enable(chan);
> > +		chan->first_frame = true;
> > +		chan->running = true;
> > +	}
> > +
> > +	if (chan->video_group)
> > +		channels = xilinx_dpdma_chan_video_group_ready(chan);
> > +	else
> > +		channels = BIT(chan->id);
> > +
> > +	if (!channels)
> > +		return;
> > +
> > +	vdesc = vchan_next_desc(&chan->vchan);
> > +	if (!vdesc)
> > +		return;
> > +
> > +	if (!chan->first_frame && !(vdesc->tx.flags & DMA_PREP_LOAD_EOT)) {
> > +		/*
> > +		 * The client forgot to set the DMA_PREP_LOAD_EOT flag. The DMA
> > +		 * engine API requires the channel to silently ignore the
> > +		 * descriptor, leaving the client waiting forever for the new
> > +		 * descriptor to be processed.
> > +		 */
> 
> This hardly going to happen. But if it does, a gentle dev_dbg() might
> save some time for the user on debugging?

I think you know my opinion on this already :-) I believe we should have
designed this API in a way that makes this error impossible, by dropping
the DMA_PREP_LOAD_EOT flag and considering that the default case. That
was rejected. Do we now need to work around the problem in drivers ?

> > +		return;
> > +	}
> > +
> > +	desc = to_dpdma_tx_desc(vdesc);
> > +	chan->desc.pending = desc;
> > +	list_del(&desc->vdesc.node);
> > +
> > +	/*
> > +	 * Assign the cookie to descriptors in this transaction. Only 16 bit
> > +	 * will be used, but it should be enough.
> > +	 */
> > +	list_for_each_entry(sw_desc, &desc->descriptors, node)
> > +		sw_desc->hw.desc_id = desc->vdesc.tx.cookie;
> > +
> > +	sw_desc = list_first_entry(&desc->descriptors,
> > +				   struct xilinx_dpdma_sw_desc, node);
> > +	dpdma_write(chan->reg, XILINX_DPDMA_CH_DESC_START_ADDR,
> > +		    lower_32_bits(sw_desc->dma_addr));
> > +	if (xdev->ext_addr)
> > +		dpdma_write(chan->reg, XILINX_DPDMA_CH_DESC_START_ADDRE,
> > +			    FIELD_PREP(XILINX_DPDMA_CH_DESC_START_ADDRE_MASK,
> > +				       upper_32_bits(sw_desc->dma_addr)));
> > +
> > +	if (chan->first_frame)
> > +		reg = XILINX_DPDMA_GBL_TRIG_MASK(channels);
> > +	else
> > +		reg = XILINX_DPDMA_GBL_RETRIG_MASK(channels);
> > +
> > +	chan->first_frame = false;
> > +
> > +	dpdma_write(xdev->reg, XILINX_DPDMA_GBL, reg);
> > +}

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2020-07-11 22:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 20:19 [PATCH v6 0/6] dma: Add Xilinx ZynqMP DPDMA driver Laurent Pinchart
2020-07-08 20:19 ` [PATCH v6 1/6] dt: bindings: dma: xilinx: dpdma: DT bindings for Xilinx DPDMA Laurent Pinchart
2020-07-08 20:19 ` [PATCH v6 2/6] dmaengine: virt-dma: Use lockdep to check locking requirements Laurent Pinchart
2020-07-09 13:07   ` Peter Ujfalusi
2020-07-11 19:53     ` Laurent Pinchart
2020-07-08 20:19 ` [PATCH v6 3/6] dmaengine: Add support for repeating transactions Laurent Pinchart
2020-07-09 13:25   ` Peter Ujfalusi
2020-07-08 20:19 ` [PATCH v6 4/6] dmaengine: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver Laurent Pinchart
2020-07-09 13:21   ` Peter Ujfalusi
2020-07-11 22:16     ` Laurent Pinchart [this message]
2020-07-15  6:54       ` Vinod Koul
2020-07-15 10:59   ` Vinod Koul
2020-07-16  0:41     ` Laurent Pinchart
2020-07-16  5:21       ` Vinod Koul
2020-07-16 13:46         ` Laurent Pinchart
2020-07-17  5:59           ` Vinod Koul
2020-07-08 20:19 ` [PATCH v6 5/6] dmaengine: xilinx: dpdma: Add debugfs support Laurent Pinchart
2020-07-15 11:01   ` Vinod Koul
2020-07-16  0:42     ` Laurent Pinchart
2020-07-08 20:19 ` [PATCH v6 6/6] arm64: dts: zynqmp: Add DPDMA node Laurent Pinchart

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=20200711221644.GD5954@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=SATISHNA@xilinx.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=hyun.kwon@xilinx.com \
    --cc=michal.simek@xilinx.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=tejasu@xilinx.com \
    --cc=vkoul@kernel.org \
    /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.