From: Anatolij Gustschin <agust@denx.de>
To: linux-media@vger.kernel.org
Cc: Anatolij Gustschin <agust@denx.de>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: [PATCH] OV5642: fix VIDIOC_S_GROP ioctl
Date: Tue, 6 Nov 2012 00:14:50 +0100 [thread overview]
Message-ID: <1352157290-13201-1-git-send-email-agust@denx.de> (raw)
VIDIOC_S_GROP ioctl doesn't work, soc-camera driver reports:
soc-camera-pdrv soc-camera-pdrv.0: S_CROP denied: getting current crop failed
The issue is caused by checking for V4L2_BUF_TYPE_VIDEO_CAPTURE type
in driver's g_crop callback. This check should be in s_crop instead,
g_crop should just set the type field to V4L2_BUF_TYPE_VIDEO_CAPTURE
as other drivers do. Move the V4L2_BUF_TYPE_VIDEO_CAPTURE type check
to s_crop callback.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/media/i2c/soc_camera/ov5642.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c
index 8577e0c..19863e5 100644
--- a/drivers/media/i2c/soc_camera/ov5642.c
+++ b/drivers/media/i2c/soc_camera/ov5642.c
@@ -872,6 +872,9 @@ static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
struct v4l2_rect rect = a->c;
int ret;
+ if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+ return -EINVAL;
+
v4l_bound_align_image(&rect.width, 48, OV5642_MAX_WIDTH, 1,
&rect.height, 32, OV5642_MAX_HEIGHT, 1, 0);
@@ -899,9 +902,7 @@ static int ov5642_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
struct ov5642 *priv = to_ov5642(client);
struct v4l2_rect *rect = &a->c;
- if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
-
+ a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
*rect = priv->crop_rect;
return 0;
--
1.7.1
next reply other threads:[~2012-11-05 23:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 23:14 Anatolij Gustschin [this message]
2012-11-06 11:45 ` [PATCH] OV5642: fix VIDIOC_S_GROP ioctl Guennadi Liakhovetski
2012-11-06 13:18 ` Anatolij Gustschin
2012-11-26 15:20 ` Guennadi Liakhovetski
2012-11-28 20:15 ` [PATCH] soc_camera: " Anatolij Gustschin
2012-11-28 20:18 ` [PATCH] OV5642: " Anatolij Gustschin
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=1352157290-13201-1-git-send-email-agust@denx.de \
--to=agust@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox