All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hans Verkuil" <hverkuil@xs4all.nl>
To: "Laurent Pinchart" <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@maxwell.research.nokia.com
Subject: Re: [RFC/PATCH 4/6] v4l: subdev: Control ioctls support
Date: Wed, 7 Jul 2010 14:33:52 +0200	[thread overview]
Message-ID: <97beeba6e8a645b4d57e16ffa36f2321.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <1278503608-9126-5-git-send-email-laurent.pinchart@ideasonboard.com>


> Pass the control-related ioctls to the subdev driver through the core
> operations.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  Documentation/video4linux/v4l2-framework.txt |   24
> ++++++++++++++++++++++++
>  drivers/media/video/v4l2-subdev.c            |   24
> ++++++++++++++++++++++++
>  2 files changed, 48 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/video4linux/v4l2-framework.txt
> b/Documentation/video4linux/v4l2-framework.txt
> index e831aac..f315858 100644
> --- a/Documentation/video4linux/v4l2-framework.txt
> +++ b/Documentation/video4linux/v4l2-framework.txt
> @@ -314,6 +314,30 @@ controlled through GPIO pins. This distinction is
> only relevant when setting
>  up the device, but once the subdev is registered it is completely
> transparent.
>
>
> +V4L2 sub-device userspace API
> +-----------------------------
> +
> +Beside exposing a kernel API through the v4l2_subdev_ops structure, V4L2
> +sub-devices can also be controlled directly by userspace applications.
> +
> +When a sub-device is registered, a device node named subdevX is created
> in /dev.
> +The device node handles a subset of the V4L2 API.
> +
> +VIDIOC_QUERYCTRL
> +VIDIOC_QUERYMENU
> +VIDIOC_G_CTRL
> +VIDIOC_S_CTRL
> +VIDIOC_G_EXT_CTRLS
> +VIDIOC_S_EXT_CTRLS
> +VIDIOC_TRY_EXT_CTRLS
> +
> +	The controls ioctls are identical to the ones defined in V4L2. They
> +	behave identically, with the only exception that they deal only with
> +	controls implemented in the sub-device. Depending on the driver, those
> +	controls can be also be accessed through one (or several) V4L2 device
> +	nodes.
> +
> +
>  I2C sub-device drivers
>  ----------------------
>
> diff --git a/drivers/media/video/v4l2-subdev.c
> b/drivers/media/video/v4l2-subdev.c
> index a3672f0..141098b 100644
> --- a/drivers/media/video/v4l2-subdev.c
> +++ b/drivers/media/video/v4l2-subdev.c
> @@ -43,7 +43,31 @@ static int subdev_close(struct file *file)
>
>  static long subdev_do_ioctl(struct file *file, unsigned int cmd, void
> *arg)
>  {
> +	struct video_device *vdev = video_devdata(file);
> +	struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
> +
>  	switch (cmd) {
> +	case VIDIOC_QUERYCTRL:
> +		return v4l2_subdev_call(sd, core, queryctrl, arg);
> +
> +	case VIDIOC_QUERYMENU:
> +		return v4l2_subdev_call(sd, core, querymenu, arg);
> +
> +	case VIDIOC_G_CTRL:
> +		return v4l2_subdev_call(sd, core, g_ctrl, arg);
> +
> +	case VIDIOC_S_CTRL:
> +		return v4l2_subdev_call(sd, core, s_ctrl, arg);
> +
> +	case VIDIOC_G_EXT_CTRLS:
> +		return v4l2_subdev_call(sd, core, g_ext_ctrls, arg);
> +
> +	case VIDIOC_S_EXT_CTRLS:
> +		return v4l2_subdev_call(sd, core, s_ext_ctrls, arg);
> +
> +	case VIDIOC_TRY_EXT_CTRLS:
> +		return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
> +
>  	default:
>  		return -ENOIOCTLCMD;
>  	}
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

This should simplify substantially once the control framework is in place.

IMHO the control framework should go in first, then this code, updated for
the control framework.

Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco


  reply	other threads:[~2010-07-07 12:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 11:53 [RFC/PATCH 0/6] V4L2 subdev userspace API Laurent Pinchart
2010-07-07 11:53 ` [RFC/PATCH 1/6] v4l: subdev: Don't require core operations Laurent Pinchart
2010-07-07 12:21   ` Hans Verkuil
2010-07-07 14:05   ` Karicheri, Muralidharan
2010-07-07 11:53 ` [RFC/PATCH 2/6] v4l: subdev: Add device node support Laurent Pinchart
2010-07-07 12:30   ` Hans Verkuil
2010-07-07 12:53     ` Laurent Pinchart
2010-07-07 13:04       ` Hans Verkuil
2010-07-08 12:01         ` Laurent Pinchart
2010-07-08 12:34           ` Hans Verkuil
2010-07-07 12:43   ` Hans Verkuil
2010-07-07 14:00     ` Laurent Pinchart
2010-07-07 14:14   ` Karicheri, Muralidharan
2010-07-07 14:39     ` Sylwester Nawrocki
2010-07-07 15:08     ` Mauro Carvalho Chehab
2010-07-08  7:20     ` Pawel Osciak
2010-07-07 14:58   ` Mauro Carvalho Chehab
2010-07-07 19:44     ` Laurent Pinchart
2010-07-07 20:53       ` Mauro Carvalho Chehab
2010-07-08 12:08         ` Laurent Pinchart
2010-07-08 13:51           ` Mauro Carvalho Chehab
2010-07-09  8:57             ` Laurent Pinchart
2010-07-07 11:53 ` [RFC/PATCH 3/6] v4l: subdev: Uninline the v4l2_subdev_init function Laurent Pinchart
2010-07-07 12:31   ` Hans Verkuil
2010-07-07 11:53 ` [RFC/PATCH 4/6] v4l: subdev: Control ioctls support Laurent Pinchart
2010-07-07 12:33   ` Hans Verkuil [this message]
2010-07-07 12:35     ` Laurent Pinchart
2010-07-07 11:53 ` [RFC/PATCH 5/6] v4l: subdev: Events support Laurent Pinchart
2010-07-07 12:37   ` Hans Verkuil
2010-07-07 11:53 ` [RFC/PATCH 6/6] v4l: subdev: Generic ioctl support Laurent Pinchart
2010-07-07 12:38   ` Hans Verkuil

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=97beeba6e8a645b4d57e16ffa36f2321.squirrel@webmail.xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@maxwell.research.nokia.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 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.