From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org,
"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
"Jacopo Mondi" <jacopo@jmondi.org>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Naushir Patuck" <naush@raspberrypi.com>,
"Dave Stevenson" <dave.stevenson@raspberrypi.com>
Subject: Re: [PATCH v2 04/34] media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Date: Tue, 15 Sep 2020 12:32:35 +0300 [thread overview]
Message-ID: <20200915093235.GC13260@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200915070326.GI834@valkosipuli.retiisi.org.uk>
Hi Sakari,
(With a question for Dave below)
I'm replying to the two main points of your review. All the other
comments look fine at a glance, Jacopo is having a more detailed look
and will incorporate them in v3.
On Tue, Sep 15, 2020 at 10:03:26AM +0300, Sakari Ailus wrote:
> Hi Laurent,
>
> Thanks for the patch, and my apologies for the late review. Please do cc me
> for v3.
>
> After a quick look I can already say this is the cleanest Unicam driver
> I've ever seen. But please also see my detailed comments below.
>
> On Mon, May 04, 2020 at 12:25:41PM +0300, Laurent Pinchart wrote:
> > From: Naushir Patuck <naush@raspberrypi.com>
> >
> > Add a driver for the Unicam camera receiver block on BCM283x processors.
> > Compared to the bcm2835-camera driver present in staging, this driver
> > handles the Unicam block only (CSI-2 receiver), and doesn't depend on
> > the VC4 firmware running on the VPU.
> >
> > The commit is made up of a series of changes cherry-picked from the
> > rpi-5.4.y branch of https://github.com/raspberrypi/linux/ with
> > additional enhancements, forward-ported to the mainline kernel.
> >
> > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > Changes since v1:
> >
> > - Re-fetch mbus code from subdev on a g_fmt call
> > - Group all ioctl disabling together
> > - Fix reference counting in unicam_open
> > - Add support for VIDIOC_[S|G]_SELECTION
> > ---
> > MAINTAINERS | 7 +
> > drivers/media/platform/Kconfig | 1 +
> > drivers/media/platform/Makefile | 2 +
> > drivers/media/platform/bcm2835/Kconfig | 15 +
> > drivers/media/platform/bcm2835/Makefile | 3 +
> > .../media/platform/bcm2835/bcm2835-unicam.c | 2825 +++++++++++++++++
> > .../media/platform/bcm2835/vc4-regs-unicam.h | 253 ++
> > 7 files changed, 3106 insertions(+)
> > create mode 100644 drivers/media/platform/bcm2835/Kconfig
> > create mode 100644 drivers/media/platform/bcm2835/Makefile
> > create mode 100644 drivers/media/platform/bcm2835/bcm2835-unicam.c
> > create mode 100644 drivers/media/platform/bcm2835/vc4-regs-unicam.h
[snip]
> > diff --git a/drivers/media/platform/bcm2835/bcm2835-unicam.c b/drivers/media/platform/bcm2835/bcm2835-unicam.c
> > new file mode 100644
> > index 000000000000..2e9387cbc1e0
> > --- /dev/null
> > +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
> > @@ -0,0 +1,2825 @@
[snip]
> > +static int unicam_enum_frameintervals(struct file *file, void *priv,
> > + struct v4l2_frmivalenum *fival)
> > +{
> > + struct unicam_node *node = video_drvdata(file);
> > + struct unicam_device *dev = node->dev;
> > + const struct unicam_fmt *fmt;
> > + struct v4l2_subdev_frame_interval_enum fie = {
> > + .index = fival->index,
> > + .width = fival->width,
> > + .height = fival->height,
> > + .which = V4L2_SUBDEV_FORMAT_ACTIVE,
> > + };
> > + int ret;
> > +
> > + fmt = find_format_by_pix(dev, fival->pixel_format);
> > + if (!fmt)
> > + return -EINVAL;
> > +
> > + fie.code = fmt->code;
> > + ret = v4l2_subdev_call(dev->sensor, pad, enum_frame_interval,
> > + NULL, &fie);
>
> You're adding a new CSI-2 receiver driver but your driver appears to be
> video node centric and does not use MC / V4L2 subdev uAPIs for pipeline
> configuration.
>
> This is effectively needed if you want to be able to capture embedded data.
>
> I'd also recommend it since this way the driver will be compliant with all
> camera sensor drivers, not just those that expose a single sub-device.
> There are no good ways to change this once your driver is in upstream
> kernel.
>
> This is also why e.g. ipu3-cio2 driver is MC-centric.
I've had lengthy discussions with Dave on this topic. While I agree with
you in principle, Dave had good arguments for keeping this
video-node-centric. We all agreed it wasn't a perfect solution, but it
could still be a pragmatic one.
If I remember correctly the discussion was in private e-mails though.
Dave, I'm pretty sure you're tired of repeating the same thing, but
Sakari can't be expected to know all we've talked about. I can try to
summarize your points, but I may not do a very good job at defending
your point of view given that I wish you would be wrong :-) Would you
like to summarize your position, or should I give it a go ?
> > + if (ret)
> > + return ret;
> > +
> > + fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
> > + fival->discrete = fie.interval;
> > +
> > + return 0;
> > +}
[snip]
> > +static int register_node(struct unicam_device *unicam, struct unicam_node *node,
> > + enum v4l2_buf_type type, int pad_id)
> > +{
[snip]
> > + if (pad_id != METADATA_PAD || unicam->sensor_embedded_data) {
> > + ret = media_create_pad_link(&unicam->sensor->entity, pad_id,
> > + &node->video_dev.entity, 0,
> > + MEDIA_LNK_FL_ENABLED |
> > + MEDIA_LNK_FL_IMMUTABLE);
>
> This does create two links between the sensor and the CSI-2 receiver,
> doesn't it?
>
> The links in Media controller represent physical links, not logical flows
> of data. At the time the API was added, it wasn't thought there would be a
> need to separate the two.
>
> There is an effort to add the concept of data flow to V4L2, but it's been
> complicated and we haven't had patches for the CSI-2 receiver driver to
> support it. Perhaps Unicam could be the first one to do that?
I agree that this is the right approach. The V4L2 multiplexed streams
support seems to be one of these cursed series, where bad things happen
to anyone who touches it. I was about to actively start working on it
again back in June for a different project, which then got frozen at the
last minute :-S
Would you like to give it a try ? :-) I'd be more than happy to provide
you hardware as a present.
> Alternatively support for embedded data could be removed in the meantime.
>
> The latest patchset is here I believe:
>
> <URL:https://patchwork.kernel.org/project/linux-media/list/?series=98277>
>
> > + if (ret)
> > + unicam_err(unicam, "Unable to create pad link for %s\n",
> > + vdev->name);
> > + }
> > +
> > + return ret;
> > +}
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-09-15 9:33 UTC|newest]
Thread overview: 111+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 9:25 [PATCH v2 00/34] Drivers for the BCM283x CSI-2/CCP2 receiver and ISP Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 01/34] media: uapi: v4l2-core: Add sensor ancillary data V4L2 fourcc type Laurent Pinchart
2020-05-04 13:48 ` Hans Verkuil
2020-05-04 14:39 ` Dave Stevenson
2020-05-04 15:32 ` Hans Verkuil
2020-05-04 16:08 ` Laurent Pinchart
2020-05-05 11:20 ` Dave Stevenson
2020-05-04 9:25 ` [PATCH v2 02/34] media: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 03/34] dt-bindings: media: Document BCM283x CSI2/CCP2 receiver Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 04/34] media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface Laurent Pinchart
2020-05-04 15:21 ` Hans Verkuil
2020-05-05 1:26 ` kbuild test robot
2020-05-05 1:26 ` kbuild test robot
2020-05-06 18:01 ` Nicolas Saenz Julienne
2020-08-29 11:20 ` Jacopo Mondi
2020-08-29 18:32 ` Laurent Pinchart
2020-08-31 7:38 ` Jacopo Mondi
2020-08-31 14:17 ` Laurent Pinchart
2020-08-31 14:46 ` Jacopo Mondi
2020-08-31 14:56 ` Laurent Pinchart
2020-09-01 8:41 ` Dave Stevenson
2020-09-01 10:22 ` Jacopo Mondi
2020-09-01 16:37 ` Dave Stevenson
2020-09-01 17:11 ` Laurent Pinchart
2020-09-15 7:03 ` Sakari Ailus
2020-09-15 9:32 ` Laurent Pinchart [this message]
2020-09-15 13:28 ` Dave Stevenson
2020-10-30 17:53 ` Jacopo Mondi
2020-09-15 17:30 ` Dave Stevenson
2020-05-04 9:25 ` [PATCH v2 05/34] ARM: dts: bcm2711: Add Unicam DT nodes Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 06/34] staging: vc04_services: Add new vc-sm-cma driver Laurent Pinchart
2020-05-05 2:38 ` kbuild test robot
2020-05-05 2:38 ` kbuild test robot
2020-05-05 12:17 ` kbuild test robot
2020-05-05 12:17 ` kbuild test robot
2020-05-06 3:05 ` kbuild test robot
2020-05-06 3:05 ` kbuild test robot
2020-05-06 18:04 ` Nicolas Saenz Julienne
2020-05-06 19:24 ` Dave Stevenson
2020-05-08 0:11 ` Laurent Pinchart
2020-05-18 12:06 ` Hans Verkuil
2020-08-24 16:39 ` Jacopo Mondi
2020-08-25 17:52 ` Dave Stevenson
2020-08-27 10:38 ` Jacopo Mondi
2020-08-27 12:51 ` Dave Stevenson
2020-08-27 16:46 ` Jacopo Mondi
2020-08-27 17:19 ` Dave Stevenson
2020-05-11 18:42 ` Nicolas Saenz Julienne
2020-05-18 15:48 ` Dave Stevenson
2020-05-20 14:41 ` Nicolas Saenz Julienne
2020-05-21 11:01 ` Dave Stevenson
2020-05-04 9:25 ` [PATCH v2 07/34] staging: bcm2835: Break MMAL support out from camera Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 08/34] staging: mmal-vchiq: Allocate and free components as required Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 09/34] staging: mmal-vchiq: Avoid use of bool in structures Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 10/34] staging: mmal-vchiq: Make timeout a defined parameter Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 11/34] staging: mmal-vchiq: Make a mmal_buf struct for passing parameters Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 12/34] staging: mmal-vchiq: Add support for event callbacks Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 13/34] staging: mmal-vchiq: Support sending data to MMAL ports Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 14/34] staging: mmal-vchiq: Fixup vchiq-mmal include ordering Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 15/34] staging: mmal-vchiq: Use vc-sm-cma to support zero copy Laurent Pinchart
2020-05-04 16:30 ` Nicolas Saenz Julienne
2020-05-05 16:07 ` kbuild test robot
2020-05-05 16:07 ` kbuild test robot
2020-05-11 19:15 ` Nicolas Saenz Julienne
2020-05-04 9:25 ` [PATCH v2 16/34] staging: mmal-vchiq: Fix client_component for 64 bit kernel Laurent Pinchart
2020-05-18 10:19 ` Hans Verkuil
2020-05-04 9:25 ` [PATCH v2 17/34] staging: mmal_vchiq: Add in the Bayer encoding formats Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 18/34] staging: mmal-vchiq: Always return the param size from param_get Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 19/34] staging: mmal-vchiq: If the VPU returns an error, don't negate it Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 20/34] staging: mmal-vchiq: Fix handling of VB2_MEMORY_DMABUF buffers Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 21/34] staging: mmal-vchiq: Update mmal_parameters.h with recently defined params Laurent Pinchart
2020-05-04 9:25 ` [PATCH v2 22/34] staging: mmal-vchiq: Free the event context for control ports Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 23/34] staging: mmal-vchiq: Fix memory leak in error path Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 24/34] staging: mmal-vchiq: Fix formatting errors in mmal_parameters.h Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 25/34] staging: vchiq_arm: Register vcsm-cma as a platform driver Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 26/34] staging: vchiq_arm: Set up dma ranges on child devices Laurent Pinchart
2020-05-04 16:54 ` Nicolas Saenz Julienne
2020-08-25 16:57 ` Jacopo Mondi
2020-05-04 9:26 ` [PATCH v2 27/34] staging: vchiq: Use the old dma controller for OF config on platform devices Laurent Pinchart
2020-05-04 15:44 ` Nicolas Saenz Julienne
2020-05-04 9:26 ` [PATCH v2 28/34] staging: vchiq_2835_arm: Implement a DMA pool for small bulk transfers Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 29/34] staging: vchiq: Add 36-bit address support Laurent Pinchart
2020-05-04 17:40 ` Nicolas Saenz Julienne
2020-05-04 20:46 ` Phil Elwell
2020-05-05 10:13 ` Nicolas Saenz Julienne
2020-05-05 10:57 ` Phil Elwell
2020-05-05 13:22 ` kbuild test robot
2020-05-05 13:22 ` kbuild test robot
2020-05-04 9:26 ` [PATCH v2 30/34] staging: vchiq_arm: Give vchiq children DT nodes Laurent Pinchart
2020-05-04 17:12 ` Nicolas Saenz Julienne
2020-05-04 19:42 ` Phil Elwell
2020-05-05 10:37 ` Nicolas Saenz Julienne
2020-05-05 10:50 ` Phil Elwell
2020-05-04 9:26 ` [PATCH v2 31/34] staging: vchiq_arm: Add a matching unregister call Laurent Pinchart
2020-05-04 9:26 ` [PATCH v2 32/34] media: videobuf2: Allow exporting of a struct dmabuf Laurent Pinchart
2020-05-04 13:36 ` Hans Verkuil
2020-05-04 9:26 ` [PATCH v2 33/34] staging: bcm2835-isp: Add support for BC2835 ISP Laurent Pinchart
2020-05-11 19:19 ` Nicolas Saenz Julienne
2020-05-18 13:38 ` Dave Stevenson
2020-05-20 13:46 ` Nicolas Saenz Julienne
2020-05-18 12:02 ` Hans Verkuil
2020-05-18 14:36 ` Dave Stevenson
2020-05-18 15:07 ` Hans Verkuil
2020-05-19 12:47 ` Naushir Patuck
2020-05-19 13:03 ` Jacopo Mondi
2020-06-24 11:28 ` Hans Verkuil
2020-05-04 9:26 ` [PATCH v2 34/34] staging: vchiq: Load bcm2835_isp driver from vchiq Laurent Pinchart
2020-05-04 15:15 ` [PATCH v2 00/34] Drivers for the BCM283x CSI-2/CCP2 receiver and ISP Nicolas Saenz Julienne
2020-05-04 15:38 ` Laurent Pinchart
2020-05-04 16:15 ` Nicolas Saenz Julienne
-- strict thread matches above, loose matches on Subject: below --
2020-05-05 13:31 [PATCH v2 04/34] media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface kbuild test robot
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=20200915093235.GC13260@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=jacopo@jmondi.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=naush@raspberrypi.com \
--cc=niklas.soderlund@ragnatech.se \
--cc=sakari.ailus@iki.fi \
/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.