All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Deepthy Ravi <deepthy.ravi@ti.com>
Subject: Re: [PATCH 8/9] V4L: mt9t112: add pad level operations
Date: Mon, 3 Oct 2011 13:14:36 +0200	[thread overview]
Message-ID: <201110031314.37234.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1317313137-4403-9-git-send-email-g.liakhovetski@gmx.de>

Hi Guennadi,

Thanks for the patch.

On Thursday 29 September 2011 18:18:56 Guennadi Liakhovetski wrote:
> On Media Controller enabled systems this patch allows the user to
> communicate with the driver directly over /dev/v4l-subdev* device nodes
> using VIDIOC_SUBDEV_* ioctl()s.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

[snip]

> diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
> index 32114a3..bb95ad1 100644
> --- a/drivers/media/video/mt9t112.c
> +++ b/drivers/media/video/mt9t112.c

[snip]

> @@ -739,8 +741,7 @@ static int mt9t112_init_camera(const struct i2c_client
> *client) static int mt9t112_g_chip_ident(struct v4l2_subdev *sd,
>  				struct v4l2_dbg_chip_ident *id)
>  {
> -	struct i2c_client *client = v4l2_get_subdevdata(sd);
> -	struct mt9t112_priv *priv = to_mt9t112(client);
> +	struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv,
> subdev);

What about modifying to_mt9t112() to take a subdev pointer, or possibly 
creating a sd_to_mt9t112() ?

>  	id->ident    = priv->model;
>  	id->revision = 0;

[snip]

> @@ -1018,14 +1015,67 @@ static struct v4l2_subdev_video_ops

[snip]

> +static int mt9t112_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh
> *fh, +			   struct v4l2_subdev_format *sd_fmt)
> +{
> +	struct v4l2_mbus_framefmt *mf;
> +
> +	if (sd_fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> +		return mt9t112_s_fmt(sd, &sd_fmt->format);
> +
> +	mf = v4l2_subdev_get_try_format(fh, sd_fmt->pad);
> +	*mf = sd_fmt->format;
> +	return mt9t112_try_fmt(sd, mf);

I think the code would be clea[nr]er if you split mt9t112_s_fmt() into try and 
set, and called try unconditionally in mt9t112_set_fmt().

> +}
> +
> +struct v4l2_subdev_pad_ops mt9t112_subdev_pad_ops = {
> +	.enum_mbus_code	= mt9t112_enum_mbus_code,
> +	.get_fmt	= mt9t112_get_fmt,
> +	.set_fmt	= mt9t112_set_fmt,

Having bot mt9t112_[gs]_fmt and mt9t112_[gs]et_fmt looks confusing to me. What 
about renaming the later mt9t112_[gs]et_pad_fmt ?

> +};
> +
>  static struct v4l2_subdev_ops mt9t112_subdev_ops = {
>  	.core	= &mt9t112_subdev_core_ops,
>  	.video	= &mt9t112_subdev_video_ops,
> +	.pad	= &mt9t112_subdev_pad_ops,
>  };
> 
> +static int mt9t112_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> +{
> +	struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(fh, 0);
> +	return mf ? mt9t112_try_fmt(sd, mf) : 0;

Can mf be NULL ?

> +}

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2011-10-03 11:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29 16:18 [PATCH 0/9] Media Controller for soc-camera Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 1/9] V4L: soc-camera: add a function to lookup xlate by mediabus code Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 2/9] sh_mobile_ceu_camera: simplify scaling and cropping algorithms Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 3/9] V4L: soc-camera: remove redundant parameter from the .set_bus_param() method Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 4/9] V4L: add convenience macros to the subdevice / Media Controller API Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 5/9] V4L: soc-camera: move bus parameter configuration to .vidioc_streamon() Guennadi Liakhovetski
2011-09-29 16:18 ` [PATCH 6/9] V4L: soc-camera: prepare hooks for Media Controller wrapper Guennadi Liakhovetski
2011-10-03 10:32   ` Laurent Pinchart
2011-09-29 16:18 ` [PATCH 7/9] V4L: soc-camera: add a " Guennadi Liakhovetski
2011-10-03 11:05   ` Laurent Pinchart
2011-10-03 15:29     ` Guennadi Liakhovetski
2011-10-03 20:44       ` Laurent Pinchart
2011-10-04 17:34         ` Guennadi Liakhovetski
2011-10-05 21:15           ` Laurent Pinchart
2011-09-29 16:18 ` [PATCH 8/9] V4L: mt9t112: add pad level operations Guennadi Liakhovetski
2011-10-03 11:14   ` Laurent Pinchart [this message]
2011-09-29 16:18 ` [PATCH 9/9] V4L: imx074: " Guennadi Liakhovetski
2011-10-03 11:21 ` [PATCH 0/9] Media Controller for soc-camera 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=201110031314.37234.laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=deepthy.ravi@ti.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.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.