From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, dacohen@gmail.com, snjw23@gmail.com,
andriy.shevchenko@linux.intel.com, t.stanislaws@samsung.com,
tuukkat76@gmail.com, k.debski@samsung.com, riverful@gmail.com,
hverkuil@xs4all.nl, teturtia@gmail.com,
pradeep.sawlani@gmail.com
Subject: Re: [PATCH v5 27/35] omap3isp: Introduce isp_video_check_external_subdevs()
Date: Wed, 07 Mar 2012 11:43:31 +0100 [thread overview]
Message-ID: <51199527.ynQze3IDdP@avalon> (raw)
In-Reply-To: <1331051596-8261-27-git-send-email-sakari.ailus@iki.fi>
Hi Sakari,
Thanks for the patch.
On Tuesday 06 March 2012 18:33:08 Sakari Ailus wrote:
> isp_video_check_external_subdevs() will retrieve external subdev's
> bits-per-pixel and pixel rate for the use of other ISP subdevs at streamon
> time. isp_video_check_external_subdevs() is called after pipeline
> validation.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
> drivers/media/video/omap3isp/ispvideo.c | 75 ++++++++++++++++++++++++++++
> 1 files changed, 75 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/omap3isp/ispvideo.c
> b/drivers/media/video/omap3isp/ispvideo.c index 4bc9cca..ef5c770 100644
> --- a/drivers/media/video/omap3isp/ispvideo.c
> +++ b/drivers/media/video/omap3isp/ispvideo.c
> @@ -934,6 +934,77 @@ isp_video_dqbuf(struct file *file, void *fh, struct
> v4l2_buffer *b) file->f_flags & O_NONBLOCK);
> }
>
> +static int isp_video_check_external_subdevs(struct isp_pipeline *pipe)
> +{
> + struct isp_device *isp =
> + container_of(pipe, struct isp_video, pipe)->isp;
Any reason not to pass isp_device * from the caller to this function ?
> + struct media_entity *ents[] = {
> + &isp->isp_csi2a.subdev.entity,
> + &isp->isp_csi2c.subdev.entity,
> + &isp->isp_ccp2.subdev.entity,
> + &isp->isp_ccdc.subdev.entity
> + };
> + struct media_pad *source_pad;
> + struct media_entity *source = NULL;
> + struct media_entity *sink;
> + struct v4l2_subdev_format fmt;
> + struct v4l2_ext_controls ctrls;
> + struct v4l2_ext_control ctrl;
> + int i;
i is allowed to be unsigned in this driver as well ;-)
> + int ret = 0;
> +
> + for (i = 0; i < ARRAY_SIZE(ents); i++) {
> + /* Is the entity part of the pipeline? */
> + if (!(pipe->entities & (1 << ents[i]->id)))
> + continue;
> +
> + /* ISP entities have always sink pad == 0. Find source. */
> + source_pad = media_entity_remote_source(&ents[i]->pads[0]);
> +
Don't you usually avoid blank lines between a variable assignment and checking
it for an error condition ?
> + if (source_pad == NULL)
> + continue;
> +
> + source = source_pad->entity;
> + sink = ents[i];
> + break;
> + }
> +
> + if (!source || media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> + return 0;
> +
> + pipe->external = media_entity_to_v4l2_subdev(source);
> +
> + fmt.pad = source_pad->index;
> + fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> + ret = v4l2_subdev_call(media_entity_to_v4l2_subdev(sink),
> + pad, get_fmt, NULL, &fmt);
> + BUG_ON(ret < 0);
That's a bit harsh. I'd rather return an error.
> +
> + pipe->external_bpp = omap3isp_video_format_info(
> + fmt.format.code)->bpp;
Maybe you could teachs emacs that 78 characters fit in a 80-columns line ? :-)
> +
> + memset(&ctrls, 0, sizeof(ctrls));
> + memset(&ctrl, 0, sizeof(ctrl));
> +
> + ctrl.id = V4L2_CID_PIXEL_RATE;
> +
> + ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(ctrl.id);
You can leave ctrl_class to 0.
> + ctrls.count = 1;
> + ctrls.controls = &ctrl;
> +
> + ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls);
> + if (ret < 0) {
> + dev_warn(isp->dev,
> + "no pixel rate control in subdev %s\n",
No need to split this either.
> + pipe->external->name);
> + return ret;
> + }
> +
> + pipe->external_rate = ctrl.value64;
> +
> + return 0;
> +}
> +
> /*
> * Stream management
> *
> @@ -1010,6 +1081,10 @@ isp_video_streamon(struct file *file, void *fh, enum
> v4l2_buf_type type) while ((entity = media_entity_graph_walk_next(&graph)))
> pipe->entities |= 1 << entity->id;
>
> + ret = isp_video_check_external_subdevs(pipe);
> + if (ret < 0)
> + goto err_check_format;
> +
> /* Verify that the currently configured format matches the output of
> * the connected subdev.
> */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2012-03-07 10:43 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 16:32 [PATCH v5 0/35] V4L2 subdev and sensor control changes, SMIA++ driver and N9 camera board code Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 01/35] v4l: Introduce integer menu controls Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 02/35] v4l: Document " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 03/35] vivi: Add an integer menu test control Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 04/35] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 05/35] v4l: vdev_to_v4l2_subdev() should have return type "struct v4l2_subdev *" Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 06/35] v4l: Check pad number in get try pointer functions Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 07/35] v4l: Support s_crop and g_crop through s/g_selection Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 08/35] v4l: Add subdev selections documentation: svg and dia files Sakari Ailus
2012-03-06 16:42 ` Laurent Pinchart
2012-03-06 16:32 ` [PATCH v5 09/35] v4l: Add subdev selections documentation Sakari Ailus
2012-03-06 16:44 ` Laurent Pinchart
2012-03-07 8:53 ` Michael Jones
2012-03-07 18:11 ` Sakari Ailus
2012-03-15 9:55 ` Sylwester Nawrocki
2012-03-15 13:00 ` Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 10/35] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 11/35] v4l: Image source control class Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 12/35] v4l: Image processing " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 13/35] v4l: Document raw bayer 4CC codes Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 14/35] v4l: Add DPCM compressed raw bayer pixel formats Sakari Ailus
2012-03-21 9:37 ` Prabhakar Lad
2012-03-21 9:53 ` Sakari Ailus
2012-03-21 11:44 ` [PATCH v5.5 14/40] " Sakari Ailus
2012-03-21 12:08 ` Prabhakar Lad
2012-03-06 16:32 ` [PATCH v5 15/35] media: Add link_validate() op to check links to the sink pad Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 16/35] v4l: Improve sub-device documentation for pad ops Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 17/35] v4l: Implement v4l2_subdev_link_validate() Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 18/35] v4l: Allow changing control handler lock Sakari Ailus
2012-05-14 15:27 ` Sylwester Nawrocki
2012-05-14 15:45 ` Sakari Ailus
2012-05-14 16:02 ` Sylwester Nawrocki
2012-05-14 15:48 ` Sylwester Nawrocki
2012-03-06 16:33 ` [PATCH v5 19/35] omap3isp: Support additional in-memory compressed bayer formats Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 20/35] omap3isp: Move definitions required by board code under include/media Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 21/35] omap3: add definition for CONTROL_CAMERA_PHY_CTRL Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 22/35] omap3isp: Move setting constaints above media_entity_pipeline_start Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 23/35] omap3isp: Assume media_entity_pipeline_start may fail Sakari Ailus
2012-03-06 16:45 ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 24/35] omap3isp: Add lane configuration to platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 25/35] omap3isp: Collect entities that are part of the pipeline Sakari Ailus
2012-03-07 10:35 ` Laurent Pinchart
2012-03-07 17:20 ` Sakari Ailus
2012-03-07 17:22 ` [PATCH v5.1 " Sakari Ailus
2012-03-07 23:50 ` Laurent Pinchart
2012-03-09 18:44 ` [PATCH " Sakari Ailus
2012-03-09 20:31 ` [PATCH v5.3 " Sakari Ailus
2012-03-09 20:34 ` Laurent Pinchart
2012-03-08 17:05 ` Sakari Ailus
2012-03-07 10:50 ` [PATCH v5 " Laurent Pinchart
2012-03-07 15:24 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 26/35] omap3isp: Add information on external subdev to struct isp_pipeline Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 27/35] omap3isp: Introduce isp_video_check_external_subdevs() Sakari Ailus
2012-03-07 10:43 ` Laurent Pinchart [this message]
2012-03-07 17:49 ` Sakari Ailus
2012-03-07 18:52 ` Laurent Pinchart
2012-03-07 23:57 ` Sakari Ailus
2012-03-08 17:04 ` [PATCH v5.3 " Sakari Ailus
2012-03-08 18:05 ` Laurent Pinchart
2012-03-07 18:14 ` [PATCH v5.1 " Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 28/35] omap3isp: Use external rate instead of vpcfg Sakari Ailus
2012-03-07 10:53 ` Laurent Pinchart
2012-03-07 17:54 ` Sakari Ailus
2012-03-07 18:34 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 29/35] omap3isp: Default link validation for ccp2, csi2, preview and resizer Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 30/35] omap3isp: Move CCDC link validation to ccdc_link_validate() Sakari Ailus
2012-03-07 11:00 ` Laurent Pinchart
2012-03-07 18:02 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 31/35] omap3isp: Configure CSI-2 phy based on platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 32/35] omap3isp: Add resizer data rate configuration to resizer_link_validate Sakari Ailus
2012-03-07 11:01 ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 33/35] omap3isp: Find source pad from external entity Sakari Ailus
2012-03-07 11:04 ` Laurent Pinchart
2012-03-07 18:08 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 34/35] smiapp: Generic SMIA++/SMIA PLL calculator Sakari Ailus
2012-03-07 12:26 ` Laurent Pinchart
2012-03-08 13:29 ` Sakari Ailus
2012-03-08 13:57 ` [PATCH v5.1 " Sakari Ailus
2012-03-08 14:38 ` Laurent Pinchart
2012-03-08 14:48 ` Sakari Ailus
2012-03-08 14:49 ` [PATCH v5.2 " Sakari Ailus
2012-03-08 14:51 ` Laurent Pinchart
2012-03-08 13:57 ` [PATCH v5.1 35/35] smiapp: Add driver Sakari Ailus
2012-03-08 14:46 ` Laurent Pinchart
2012-03-08 16:49 ` [PATCH v5.3 " Sakari Ailus
2012-03-11 13:37 ` Laurent Pinchart
2012-03-11 14:03 ` Sakari Ailus
2012-03-11 14:45 ` [PATCH v5.4 " Sakari Ailus
2012-03-11 16:32 ` Laurent Pinchart
2012-03-08 15:06 ` [PATCH v5.1 " jean-philippe francois
2012-03-11 9:04 ` Sakari Ailus
2012-03-12 9:44 ` jean-philippe francois
2012-03-06 16:33 ` [PATCH v5 35/35] rm680: Add camera init Sakari Ailus
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=51199527.ynQze3IDdP@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dacohen@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=k.debski@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=pradeep.sawlani@gmail.com \
--cc=riverful@gmail.com \
--cc=sakari.ailus@iki.fi \
--cc=snjw23@gmail.com \
--cc=t.stanislaws@samsung.com \
--cc=teturtia@gmail.com \
--cc=tuukkat76@gmail.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