public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OV5642: fix VIDIOC_S_GROP ioctl
@ 2012-11-05 23:14 Anatolij Gustschin
  2012-11-06 11:45 ` Guennadi Liakhovetski
  0 siblings, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2012-11-05 23:14 UTC (permalink / raw)
  To: linux-media; +Cc: Anatolij Gustschin, Guennadi Liakhovetski

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-28 20:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 23:14 [PATCH] OV5642: fix VIDIOC_S_GROP ioctl Anatolij Gustschin
2012-11-06 11:45 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox