From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: LMML <linux-media@vger.kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>
Cc: DLOS <davinci-linux-open-source@linux.davincidsp.com>,
LKML <linux-kernel@vger.kernel.org>,
"Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Subject: [PATCH v5 36/49] media: davinci: vpif_capture: use vb2_ioctl_* helpers
Date: Fri, 16 May 2014 19:03:42 +0530 [thread overview]
Message-ID: <1400247235-31434-39-git-send-email-prabhakar.csengg@gmail.com> (raw)
In-Reply-To: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com>
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
drivers/media/platform/davinci/vpif_capture.c | 240 +++----------------------
1 file changed, 22 insertions(+), 218 deletions(-)
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 6ad9e09..75015f4 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -208,6 +208,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
}
}
+ ret = v4l2_subdev_call(ch->sd, video, s_stream, 1);
+ if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
+ vpif_dbg(1, debug, "stream on failed in subdev\n");
+ goto err;
+ }
+
/* Call vpif_set_params function to set the parameters and addresses */
ret = vpif_set_video_params(vpif, ch->channel_id);
@@ -275,6 +281,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
struct channel_obj *ch = vb2_get_drv_priv(vq);
struct common_obj *common;
unsigned long flags;
+ int ret;
common = &ch->common[VPIF_VIDEO_INDEX];
@@ -290,6 +297,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
}
common->started = 0;
+ ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
+ if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
+ vpif_dbg(1, debug, "stream off failed in subdev\n");
+
/* release all active buffers */
spin_lock_irqsave(&common->irqlock, flags);
if (common->cur_frm == common->next_frm) {
@@ -751,218 +762,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
}
/**
- * vpif_reqbufs() - request buffer handler
- * @file: file ptr
- * @priv: file handle
- * @reqbuf: request buffer structure ptr
- */
-static int vpif_reqbufs(struct file *file, void *priv,
- struct v4l2_requestbuffers *reqbuf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common;
- u8 index = 0;
-
- vpif_dbg(2, debug, "vpif_reqbufs\n");
-
- if (V4L2_BUF_TYPE_VIDEO_CAPTURE != reqbuf->type || !vpif_dev)
- return -EINVAL;
-
- index = VPIF_VIDEO_INDEX;
-
- common = &ch->common[index];
-
- if (0 != common->io_usrs)
- return -EBUSY;
-
- /* Increment io usrs member of channel object to 1 */
- common->io_usrs = 1;
- /* Store type of memory requested in channel object */
- common->memory = reqbuf->memory;
-
- /* Allocate buffers */
- return vb2_reqbufs(&common->buffer_queue, reqbuf);
-}
-
-/**
- * vpif_querybuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_querybuf(struct file *file, void *priv,
- struct v4l2_buffer *buf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
- vpif_dbg(2, debug, "vpif_querybuf\n");
-
- if (common->fmt.type != buf->type)
- return -EINVAL;
-
- if (common->memory != V4L2_MEMORY_MMAP) {
- vpif_dbg(1, debug, "Invalid memory\n");
- return -EINVAL;
- }
-
- return vb2_querybuf(&common->buffer_queue, buf);
-}
-
-/**
- * vpif_qbuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- struct v4l2_buffer tbuf = *buf;
-
- vpif_dbg(2, debug, "vpif_qbuf\n");
-
- if (common->fmt.type != tbuf.type) {
- vpif_err("invalid buffer type\n");
- return -EINVAL;
- }
-
- return vb2_qbuf(&common->buffer_queue, buf);
-}
-
-/**
- * vpif_dqbuf() - query buffer handler
- * @file: file ptr
- * @priv: file handle
- * @buf: v4l2 buffer structure ptr
- */
-static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
- vpif_dbg(2, debug, "vpif_dqbuf\n");
-
- return vb2_dqbuf(&common->buffer_queue, buf,
- (file->f_flags & O_NONBLOCK));
-}
-
-/**
- * vpif_streamon() - streamon handler
- * @file: file ptr
- * @priv: file handle
- * @buftype: v4l2 buffer type
- */
-static int vpif_streamon(struct file *file, void *priv,
- enum v4l2_buf_type buftype)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
- struct vpif_params *vpif;
- int ret = 0;
-
- vpif_dbg(2, debug, "vpif_streamon\n");
-
- vpif = &ch->vpifparams;
-
- if (buftype != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
- vpif_dbg(1, debug, "buffer type not supported\n");
- return -EINVAL;
- }
-
- /* If Streaming is already started, return error */
- if (common->started) {
- vpif_dbg(1, debug, "channel->started\n");
- return -EBUSY;
- }
-
- if ((ch->channel_id == VPIF_CHANNEL0_VIDEO &&
- oth_ch->common[VPIF_VIDEO_INDEX].started &&
- vpif->std_info.ycmux_mode == 0) ||
- ((ch->channel_id == VPIF_CHANNEL1_VIDEO) &&
- (2 == oth_ch->common[VPIF_VIDEO_INDEX].started))) {
- vpif_dbg(1, debug, "other channel is being used\n");
- return -EBUSY;
- }
-
- ret = vpif_check_format(ch, &common->fmt.fmt.pix, 0);
- if (ret)
- return ret;
-
- /* Enable streamon on the sub device */
- ret = v4l2_subdev_call(ch->sd, video, s_stream, 1);
-
- if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
- vpif_dbg(1, debug, "stream on failed in subdev\n");
- return ret;
- }
-
- /* Call vb2_streamon to start streaming in videobuf2 */
- ret = vb2_streamon(&common->buffer_queue, buftype);
- if (ret) {
- vpif_dbg(1, debug, "vb2_streamon\n");
- return ret;
- }
-
- return ret;
-}
-
-/**
- * vpif_streamoff() - streamoff handler
- * @file: file ptr
- * @priv: file handle
- * @buftype: v4l2 buffer type
- */
-static int vpif_streamoff(struct file *file, void *priv,
- enum v4l2_buf_type buftype)
-{
-
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- int ret;
-
- vpif_dbg(2, debug, "vpif_streamoff\n");
-
- if (buftype != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
- vpif_dbg(1, debug, "buffer type not supported\n");
- return -EINVAL;
- }
-
- /* If streaming is not started, return error */
- if (!common->started) {
- vpif_dbg(1, debug, "channel->started\n");
- return -EINVAL;
- }
-
- /* disable channel */
- if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
- enable_channel0(0);
- channel0_intr_enable(0);
- } else {
- enable_channel1(0);
- channel1_intr_enable(0);
- }
-
- common->started = 0;
-
- ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
-
- if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
- vpif_dbg(1, debug, "stream off failed in subdev\n");
-
- return vb2_streamoff(&common->buffer_queue, buftype);
-}
-
-/**
* vpif_input_to_subdev() - Maps input to sub device
* @vpif_cfg - global config ptr
* @chan_cfg - channel config ptr
@@ -1531,15 +1330,20 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
.vidioc_enum_input = vpif_enum_input,
.vidioc_s_input = vpif_s_input,
.vidioc_g_input = vpif_g_input,
- .vidioc_reqbufs = vpif_reqbufs,
- .vidioc_querybuf = vpif_querybuf,
+
+ .vidioc_reqbufs = vb2_ioctl_reqbufs,
+ .vidioc_create_bufs = vb2_ioctl_create_bufs,
+ .vidioc_querybuf = vb2_ioctl_querybuf,
+ .vidioc_qbuf = vb2_ioctl_qbuf,
+ .vidioc_dqbuf = vb2_ioctl_dqbuf,
+ .vidioc_expbuf = vb2_ioctl_expbuf,
+ .vidioc_streamon = vb2_ioctl_streamon,
+ .vidioc_streamoff = vb2_ioctl_streamoff,
+
.vidioc_querystd = vpif_querystd,
.vidioc_s_std = vpif_s_std,
.vidioc_g_std = vpif_g_std,
- .vidioc_qbuf = vpif_qbuf,
- .vidioc_dqbuf = vpif_dqbuf,
- .vidioc_streamon = vpif_streamon,
- .vidioc_streamoff = vpif_streamoff,
+
.vidioc_cropcap = vpif_cropcap,
.vidioc_enum_dv_timings = vpif_enum_dv_timings,
.vidioc_query_dv_timings = vpif_query_dv_timings,
--
1.7.9.5
next prev parent reply other threads:[~2014-05-16 13:42 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 13:33 [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 01/49] media: davinci: vpif_display: initialize " Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails Lad, Prabhakar
2014-05-23 8:35 ` Hans Verkuil
2014-05-24 4:02 ` Prabhakar Lad
2014-05-16 13:33 ` [PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 19/49] media: davinci: vpif_display: drop cropcap Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 20/49] media: davinci: vpif_display: group v4l2_ioctl_ops Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 21/49] media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
2014-05-23 8:48 ` Hans Verkuil
2014-05-16 13:33 ` [PATCH v5 22/49] media: davinci: vpif_display: return -ENODATA for *dv_timings calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 23/49] media: davinci: vpif_display: return -ENODATA for *std calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 24/49] media: davinci; vpif_display: fix checkpatch error Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 25/49] media: davinci: vpif_display: fix v4l-complinace issues Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 26/49] media: davinci: vpif_capture: initalize vb2 queue and DMA context during probe Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 27/49] media: davinci: vpif_capture: drop buf_init() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 28/49] media: davinci: vpif_display: " Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 29/49] media: davinci: vpif_capture: release buffers in case start_streaming() call back fails Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 30/49] media: davinci: vpif_capture: drop buf_cleanup() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 31/49] media: davinci: vpif_capture: improve vpif_buffer_prepare() callback Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 32/49] media: davinci: vpif_capture: improve vpif_buffer_queue_setup() function Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 33/49] media: davinci: vpif_capture: improve start/stop_streaming callbacks Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 34/49] media: davinci: vpif_capture: use vb2_fop_mmap/poll Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 35/49] media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release Lad, Prabhakar
2014-05-16 13:33 ` Lad, Prabhakar [this message]
2014-05-16 13:33 ` [PATCH v5 37/49] media: davinci: vpif_capture: drop reserving memory for device Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 38/49] media: davinci: vpif_capture: drop unnecessary field memory Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 39/49] media: davinic: vpif_capture: drop started member from struct common_obj Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 41/49] media: davinci: vpif_capture: drop unneeded module params Lad, Prabhakar
2014-05-23 22:38 ` Mauro Carvalho Chehab
2014-05-24 4:27 ` Prabhakar Lad
2014-05-16 13:33 ` [PATCH v5 42/49] media: davinci: vpif_capture: drop cropcap Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 43/49] media: davinci: vpif_capture: group v4l2_ioctl_ops Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 44/49] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 45/49] media: davinci: vpif_capture: return -ENODATA for *dv_timings calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 46/49] media: davinci: vpif_capture: return -ENODATA for *std calls Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 47/49] media: davinci: vpif_capture: drop check __KERNEL__ Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 48/49] media: davinci: vpif_capture: fix v4l-complinace issues Lad, Prabhakar
2014-05-16 13:33 ` [PATCH v5 49/49] media: davinci: vpif: add Copyright message Lad, Prabhakar
2014-05-23 8:30 ` [PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes Hans Verkuil
2014-05-24 4:09 ` Prabhakar Lad
2014-05-23 9:05 ` 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=1400247235-31434-39-git-send-email-prabhakar.csengg@gmail.com \
--to=prabhakar.csengg@gmail.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®