All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: sakari.ailus@maxwell.research.nokia.com
Subject: [SAMPLE v3 06/12] v4l: Add subdev userspace API to enumerate and configure frame interval
Date: Thu, 29 Jul 2010 18:06:50 +0200	[thread overview]
Message-ID: <1280419616-7658-18-git-send-email-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1280419616-7658-1-git-send-email-laurent.pinchart@ideasonboard.com>

The three new ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL,
VIDIOC_SUBDEV_G_FRAME_INTERVAL and VIDIOC_SUBDEV_S_FRAME_INTERVAL can be
used to enumerate and configure a subdev's frame rate from userspace.

Two new video::g/s_frame_interval subdev operations are introduced to
support those ioctls. The existing video::g/s_parm operations are
deprecated and shouldn't be used anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
---
 drivers/media/video/v4l2-subdev.c |   16 ++++++++++++++++
 include/linux/v4l2-subdev.h       |   24 ++++++++++++++++++++++++
 include/media/v4l2-subdev.h       |    7 +++++++
 3 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index d8b261f..8ddb2fb 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -208,6 +208,22 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 					fse);
 	}
 
+	case VIDIOC_SUBDEV_G_FRAME_INTERVAL:
+		return v4l2_subdev_call(sd, video, g_frame_interval, arg);
+
+	case VIDIOC_SUBDEV_S_FRAME_INTERVAL:
+		return v4l2_subdev_call(sd, video, s_frame_interval, arg);
+
+	case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL: {
+		struct v4l2_subdev_frame_interval_enum *fie = arg;
+
+		if (fie->pad >= sd->entity.num_pads)
+			return -EINVAL;
+
+		return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh,
+					fie);
+	}
+
 	default:
 		return -ENOIOCTLCMD;
 	}
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 6504f22..e3362aa 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -56,11 +56,35 @@ struct v4l2_subdev_frame_size_enum {
 	__u32 reserved[9];
 };
 
+/**
+ * struct v4l2_subdev_pad_frame_rate
+ */
+struct v4l2_subdev_frame_interval {
+	struct v4l2_fract interval;
+	__u32 reserved[6];
+};
+
+struct v4l2_subdev_frame_interval_enum {
+	__u32 index;
+	__u32 pad;
+	__u32 code;
+	__u32 width;
+	__u32 height;
+	struct v4l2_fract interval;
+	__u32 reserved[9];
+};
+
 #define VIDIOC_SUBDEV_G_FMT	_IOWR('V',  4, struct v4l2_subdev_pad_format)
 #define VIDIOC_SUBDEV_S_FMT	_IOWR('V',  5, struct v4l2_subdev_pad_format)
+#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
+			_IOWR('V', 6, struct v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
+			_IOWR('V', 7, struct v4l2_subdev_frame_interval)
 #define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
 			_IOWR('V', 8, struct v4l2_subdev_pad_mbus_code_enum)
 #define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
 			_IOWR('V', 9, struct v4l2_subdev_frame_size_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
+			_IOWR('V', 10, struct v4l2_subdev_frame_interval_enum)
 
 #endif
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index acbcd8f..58ef923 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -245,6 +245,10 @@ struct v4l2_subdev_video_ops {
 	int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
 	int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
 	int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
+	int (*g_frame_interval)(struct v4l2_subdev *sd,
+				struct v4l2_subdev_frame_interval *interval);
+	int (*s_frame_interval)(struct v4l2_subdev *sd,
+				struct v4l2_subdev_frame_interval *interval);
 	int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
 	int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
 	int (*enum_dv_presets) (struct v4l2_subdev *sd,
@@ -406,6 +410,9 @@ struct v4l2_subdev_pad_ops {
 	int (*enum_frame_size)(struct v4l2_subdev *sd,
 			       struct v4l2_subdev_fh *fh,
 			       struct v4l2_subdev_frame_size_enum *fse);
+	int (*enum_frame_interval)(struct v4l2_subdev *sd,
+				   struct v4l2_subdev_fh *fh,
+				   struct v4l2_subdev_frame_interval_enum *fie);
 	int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
 		       unsigned int pad, struct v4l2_mbus_framefmt *fmt,
 		       enum v4l2_subdev_format which);
-- 
1.7.1


  parent reply	other threads:[~2010-07-29 16:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 16:06 [RFC/PATCH v3 00/10] Media controller (core and V4L2) Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 01/10] media: Media device node support Laurent Pinchart
2010-08-01 11:14   ` Hans Verkuil
2010-08-02 13:55     ` Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 02/10] media: Media device Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 03/10] media: Entities, pads and links Laurent Pinchart
2010-07-30 14:00   ` Sakari Ailus
2010-08-02 14:05     ` Laurent Pinchart
2010-08-01 11:32   ` Hans Verkuil
2010-08-02 14:19     ` Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 04/10] media: Entity graph traversal Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 05/10] media: Reference count and power handling Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 06/10] media: Entities, pads and links enumeration Laurent Pinchart
2010-08-01 11:58   ` Hans Verkuil
2010-08-02 14:35     ` Laurent Pinchart
2010-08-02 21:01       ` Hans Verkuil
2010-08-03  9:22         ` Laurent Pinchart
2010-08-04 19:28           ` Marko Ristola
2010-08-05  9:38             ` Laurent Pinchart
2010-08-05 19:45               ` Marko Ristola
2010-07-29 16:06 ` [RFC/PATCH v3 07/10] media: Links setup Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 08/10] v4l: Add a media_device pointer to the v4l2_device structure Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 09/10] v4l: Make video_device inherit from media_entity Laurent Pinchart
2010-07-29 16:06 ` [RFC/PATCH v3 10/10] v4l: Make v4l2_subdev " Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 00/12] V4L2 API additions and OMAP3 ISP driver Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 01/12] v4l: Move the media/v4l2-mediabus.h header to include/linux Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 02/12] v4l: Add 16 bit YUYV and SGRBG10 media bus format codes Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 03/12] v4l: Create v4l2 subdev file handle structure Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 04/12] v4l-subdev: Add pads operations Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 05/12] v4l: v4l2_subdev userspace format API Laurent Pinchart
2010-07-29 16:06 ` Laurent Pinchart [this message]
2010-07-29 16:06 ` [SAMPLE v3 07/12] v4l: Add crop ioctl to V4L2 subdev API Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 08/12] v4l: subdev: Generic ioctl support Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 09/12] ARM: OMAP3: Update Camera ISP definitions for OMAP3630 Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 10/12] omap3: Export omap3isp platform device structure Laurent Pinchart
2010-07-29 16:06 ` [SAMPLE v3 11/12] omap34xxcam: Register the ISP platform device during omap34xxcam probe Laurent Pinchart
2010-08-19 19:09 ` [RFC/PATCH v3 00/10] Media controller (core and V4L2) Aguirre, Sergio
2010-08-19 19:12   ` Laurent Pinchart
2010-08-19 19:13     ` Aguirre, Sergio
2010-08-20 15:25     ` Laurent Pinchart
2010-08-20 15:26       ` Aguirre, Sergio
2010-08-20 15:31         ` 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=1280419616-7658-18-git-send-email-laurent.pinchart@ideasonboard.com \
    --to=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.