From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Archit Taneja <archit@ti.com>
Cc: linux-media@vger.kernel.org, linux-omap@vger.kernel.org,
dagriego@biglakesoftware.com, dale@farnsworth.org,
pawel@osciak.com, m.szyprowski@samsung.com, hverkuil@xs4all.nl,
tomi.valkeinen@ti.com
Subject: Re: [PATCH 1/6] v4l: ti-vpe: Create a vpdma helper library
Date: Tue, 20 Aug 2013 13:39:34 +0200 [thread overview]
Message-ID: <1436822.NCo0PqzB8p@avalon> (raw)
In-Reply-To: <520B62B5.8080000@ti.com>
Hi Archit,
On Wednesday 14 August 2013 16:27:57 Archit Taneja wrote:
> On Friday 09 August 2013 03:34 AM, Laurent Pinchart wrote:
> > On Friday 02 August 2013 19:33:38 Archit Taneja wrote:
> >> The primary function of VPDMA is to move data between external memory and
> >> internal processing modules(in our case, VPE) that source or sink data.
> >> VPDMA is capable of buffering this data and then delivering the data as
> >> demanded to the modules as programmed. The modules that source or sink
> >> data are referred to as clients or ports. A channel is setup inside the
> >> VPDMA to connect a specific memory buffer to a specific client. The VPDMA
> >> centralizes the DMA control functions and buffering required to allow all
> >> the clients to minimize the effect of long latency times.
> >>
> >> Add the following to the VPDMA helper:
> >>
> >> - A data struct which describe VPDMA channels. For now, these channels
> >> are the ones used only by VPE, the list of channels will increase when
> >> VIP(Video Input Port) also uses the VPDMA library. This channel
> >> information will be used to populate fields required by data descriptors.
> >>
> >> - Data structs which describe the different data types supported by
> >> VPDMA. This data type information will be used to populate fields
> >> required by data descriptors and used by the VPE driver to map a V4L2
> >> format to the corresponding VPDMA data type.
> >>
> >> - Provide VPDMA register offset definitions, functions to read, write and
> >> modify VPDMA registers.
> >>
> >> - Functions to create and submit a VPDMA list. A list is a group of
> >> descriptors that makes up a set of DMA transfers that need to be
> >> completed. Each descriptor will either perform a DMA transaction to fetch
> >> input buffers and write to output buffers(data descriptors), or configure
> >> the MMRs of sub blocks of VPE(configuration descriptors), or provide
> >> control information to VPDMA (control descriptors).
> >>
> >> - Functions to allocate, map and unmap buffers needed for the descriptor
> >> list, payloads containing MMR values and motion vector buffers. These use
> >> the DMA mapping APIs to ensure exclusive access to VPDMA.
> >>
> >> - Functions to enable VPDMA interrupts. VPDMA can trigger an interrupt on
> >> the VPE interrupt line when a descriptor list is parsed completely and
> >> the DMA transactions are completed. This requires masking the events in
> >> VPDMA registers and configuring some top level VPE interrupt registers.
> >>
> >> - Enable some VPDMA specific parameters: frame start event(when to start
> >> DMA for a client) and line mode(whether each line fetched should be
> >> mirrored or not).
> >>
> >> - Function to load firmware required by VPDMA. VPDMA requires a firmware
> >> for it's internal list manager. We add the required request_firmware
> >> apis to fetch this firmware from user space.
> >>
> >> - Function to dump VPDMA registers.
> >>
> >> - A function to initialize VPDMA, this will be called by the VPE driver
> >> with it's platform device pointer, this function will take care of
> >> loading VPDMA firmware and returning a handle back to the VPE driver.
> >> The VIP driver will also call the same init function to initialize it's
> >> own VPDMA instance.
> >>
> >> Signed-off-by: Archit Taneja <archit@ti.com>
[snip]
> >> +/*
> >> + * Allocate a DMA buffer
> >> + */
> >> +int vpdma_buf_alloc(struct vpdma_buf *buf, size_t size)
> >> +{
> >> + buf->size = size;
> >> + buf->mapped = 0;
> >> + buf->addr = kzalloc(size, GFP_KERNEL);
> >
> > You should use the dma allocation API (depending on your needs,
> > dma_alloc_coherent for instance) to allocate DMA-able buffers.
>
> I'm not sure about this, dma_map_single() api works fine on kzalloc'd
> buffers. The above function is used to allocate small contiguous buffers
> (never more than 1024 bytes) needed for descriptors for the DMA IP. I
> thought of using DMA pool, but that creates small buffers of the same size.
> So I finally went with kzalloc.
OK, I mistakenly thought it would allocate larger buffers as well. If it's
used to allocate descriptors only, would it be better to rename it to
vpdma_desc_alloc() (or something similar) ?
> >> + if (!buf->addr)
> >> + return -ENOMEM;
> >> +
> >> + WARN_ON((u32) buf->addr & VPDMA_DESC_ALIGN);
> >> +
> >> + return 0;
> >> +}
[snip]
> >> +static int vpdma_load_firmware(struct vpdma_data *vpdma)
> >> +{
> >> + int r;
> >> + struct device *dev = &vpdma->pdev->dev;
> >> +
> >> + r = request_firmware_nowait(THIS_MODULE, 1,
> >> + (const char *) VPDMA_FIRMWARE, dev, GFP_KERNEL, vpdma,
> >> + vpdma_firmware_cb);
> >
> > Is there a reason not to use the synchronous interface ? That would
> > simplify both this code and the callers, as they won't have to check
> > whether the firmware has been correctly loaded.
>
> I'm not clear what you mean by that, the firmware would be stored in the
> filesystem. If the driver is built-in, then the synchronous interface
> wouldn't work unless the firmware is appended to the kernel image. Am I
> missing something here? I'm not very aware of the firmware api.
request_firmware() would just sleep (with a 30 seconds timeout if I'm not
mistaken) until userspace provides the firmware. As devices are probed
asynchronously (in kernel threads) the system will just boot normally, and the
request_firmware() call will return when the firmware is available.
> >> + if (r) {
> >> + dev_err(dev, "firmware not available %s\n", VPDMA_FIRMWARE);
> >> + return r;
> >> + } else {
> >> + dev_info(dev, "loading firmware %s\n", VPDMA_FIRMWARE);
> >> + }
> >> +
> >> + return 0;
> >> +}
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-08-20 11:38 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 14:03 [PATCH 0/6] v4l: VPE mem to mem driver Archit Taneja
2013-08-02 14:03 ` [PATCH 1/6] v4l: ti-vpe: Create a vpdma helper library Archit Taneja
2013-08-05 8:13 ` Tomi Valkeinen
2013-08-05 11:26 ` Archit Taneja
2013-08-05 12:26 ` Tomi Valkeinen
2013-08-08 21:35 ` Laurent Pinchart
2013-08-14 10:19 ` Archit Taneja
2013-08-08 22:04 ` Laurent Pinchart
2013-08-14 10:57 ` Archit Taneja
2013-08-20 11:39 ` Laurent Pinchart [this message]
2013-08-20 12:51 ` Archit Taneja
2013-08-20 13:16 ` Archit Taneja
2013-08-20 13:56 ` Laurent Pinchart
2013-08-21 6:47 ` Archit Taneja
2013-08-02 14:03 ` [PATCH 2/6] v4l: ti-vpe: Add helpers for creating VPDMA descriptors Archit Taneja
2013-08-05 9:11 ` Tomi Valkeinen
2013-08-05 12:05 ` Archit Taneja
2013-08-05 13:03 ` Tomi Valkeinen
2013-08-02 14:03 ` [PATCH 3/6] v4l: ti-vpe: Add VPE mem to mem driver Archit Taneja
2013-08-02 14:36 ` Hans Verkuil
2013-08-02 14:55 ` Archit Taneja
2013-08-05 9:18 ` Tomi Valkeinen
2013-08-02 14:03 ` [PATCH 4/6] v4l: ti-vpe: Add de-interlacer support in VPE Archit Taneja
2013-08-02 14:40 ` Hans Verkuil
2013-08-02 14:03 ` [PATCH 5/6] arm: dra7xx: hwmod data: add VPE hwmod data and ocp_if info Archit Taneja
2013-08-02 14:03 ` [PATCH 6/6] experimental: arm: dts: dra7xx: Add a DT node for VPE Archit Taneja
2013-08-08 22:11 ` Laurent Pinchart
2013-10-25 10:35 ` Archit Taneja
2013-12-03 10:08 ` Archit Taneja
2013-08-20 11:00 ` [PATCH v2 0/6] v4l: VPE mem to mem driver Archit Taneja
2013-08-20 11:00 ` [PATCH v2 1/6] v4l: ti-vpe: Create a vpdma helper library Archit Taneja
2013-08-20 11:00 ` [PATCH v2 2/6] v4l: ti-vpe: Add helpers for creating VPDMA descriptors Archit Taneja
2013-08-20 11:00 ` [PATCH v2 3/6] v4l: ti-vpe: Add VPE mem to mem driver Archit Taneja
2013-08-20 11:00 ` [PATCH v2 4/6] v4l: ti-vpe: Add de-interlacer support in VPE Archit Taneja
2013-08-20 11:00 ` [PATCH v2 5/6] arm: dra7xx: hwmod data: add VPE hwmod data and ocp_if info Archit Taneja
2013-08-20 11:00 ` [PATCH v2 6/6] experimental: arm: dts: dra7xx: Add a DT node for VPE Archit Taneja
2013-08-29 12:32 ` [PATCH v3 0/6] v4l: VPE mem to mem driver Archit Taneja
2013-08-29 12:32 ` [PATCH v3 1/6] v4l: ti-vpe: Create a vpdma helper library Archit Taneja
2013-08-29 12:32 ` [PATCH v3 2/6] v4l: ti-vpe: Add helpers for creating VPDMA descriptors Archit Taneja
2013-08-29 12:32 ` [PATCH v3 3/6] v4l: ti-vpe: Add VPE mem to mem driver Archit Taneja
2013-08-29 13:28 ` Hans Verkuil
2013-08-30 6:47 ` Archit Taneja
2013-08-30 7:07 ` Hans Verkuil
2013-08-30 10:05 ` Archit Taneja
2013-08-30 10:44 ` Hans Verkuil
2013-09-05 5:56 ` Archit Taneja
2013-08-29 12:32 ` [PATCH v3 4/6] v4l: ti-vpe: Add de-interlacer support in VPE Archit Taneja
2013-08-29 12:32 ` [PATCH v3 5/6] arm: dra7xx: hwmod data: add VPE hwmod data and ocp_if info Archit Taneja
2013-08-29 12:42 ` Rajendra Nayak
2013-08-29 13:42 ` Archit Taneja
2013-08-29 12:32 ` [PATCH v3 6/6] experimental: arm: dts: dra7xx: Add a DT node for VPE Archit Taneja
2013-09-06 10:12 ` [PATCH v4 0/4] v4l: VPE mem to mem driver Archit Taneja
2013-09-06 10:12 ` [PATCH v4 1/4] v4l: ti-vpe: Create a vpdma helper library Archit Taneja
2013-10-07 7:46 ` Hans Verkuil
2013-09-06 10:12 ` [PATCH v4 2/4] v4l: ti-vpe: Add helpers for creating VPDMA descriptors Archit Taneja
2013-10-07 7:46 ` Hans Verkuil
2013-09-06 10:12 ` [PATCH v4 3/4] v4l: ti-vpe: Add VPE mem to mem driver Archit Taneja
2013-10-07 7:55 ` Hans Verkuil
2013-10-07 9:16 ` Archit Taneja
2013-10-07 9:34 ` Hans Verkuil
2013-10-07 10:22 ` Archit Taneja
2013-10-07 14:02 ` Hans Verkuil
2013-10-07 14:34 ` Archit Taneja
2013-09-06 10:12 ` [PATCH v4 4/4] v4l: ti-vpe: Add de-interlacer support in VPE Archit Taneja
2013-10-07 7:57 ` Hans Verkuil
2013-09-16 6:59 ` [PATCH v4 0/4] v4l: VPE mem to mem driver Archit Taneja
2013-10-07 6:39 ` Archit Taneja
2013-10-09 14:29 ` [PATCH v5 3/4] v4l: ti-vpe: Add " Archit Taneja
2013-10-11 7:46 ` Hans Verkuil
2013-10-15 13:47 ` Archit Taneja
2013-10-15 13:51 ` Hans Verkuil
2013-10-15 14:13 ` Kamil Debski
2013-10-15 15:54 ` Kamil Debski
2013-10-16 5:08 ` Archit Taneja
2013-10-16 5:36 ` [PATCH v5 0/4] v4l: " Archit Taneja
2013-10-16 5:36 ` [PATCH v5 1/4] v4l: ti-vpe: Create a vpdma helper library Archit Taneja
2013-10-16 5:36 ` [PATCH v5 2/4] v4l: ti-vpe: Add helpers for creating VPDMA descriptors Archit Taneja
2013-10-16 5:36 ` [PATCH v5 3/4] v4l: ti-vpe: Add VPE mem to mem driver Archit Taneja
2013-10-16 5:36 ` [PATCH v5 4/4] v4l: ti-vpe: Add de-interlacer support in VPE Archit Taneja
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=1436822.NCo0PqzB8p@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=archit@ti.com \
--cc=dagriego@biglakesoftware.com \
--cc=dale@farnsworth.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=pawel@osciak.com \
--cc=tomi.valkeinen@ti.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