aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-03-13 05:08:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:21 -0400
commit09e231b35173313cd92e27532e5028f2042dcee4 (patch)
tree3ecda063aa52f954d2f797921bdce131d7f1cc28 /drivers/media/video/soc_camera.c
parent1cd3c0fa927084549005fc22e54d99684b314f14 (diff)
V4L/DVB (11024): soc-camera: separate S_FMT and S_CROP operations
As host and camera drivers become more complex, differences between S_FMT and S_CROP functionality grow, this patch separates them. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index fcb05f06de8f..9939b045cb4c 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -417,9 +417,7 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
417 struct soc_camera_device *icd = icf->icd; 417 struct soc_camera_device *icd = icf->icd;
418 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 418 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
419 struct v4l2_pix_format *pix = &f->fmt.pix; 419 struct v4l2_pix_format *pix = &f->fmt.pix;
420 __u32 pixfmt = pix->pixelformat;
421 int ret; 420 int ret;
422 struct v4l2_rect rect;
423 421
424 WARN_ON(priv != file->private_data); 422 WARN_ON(priv != file->private_data);
425 423
@@ -435,23 +433,19 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
435 goto unlock; 433 goto unlock;
436 } 434 }
437 435
438 rect.left = icd->x_current; 436 ret = ici->ops->set_fmt(icd, f);
439 rect.top = icd->y_current;
440 rect.width = pix->width;
441 rect.height = pix->height;
442 ret = ici->ops->set_fmt(icd, pix->pixelformat, &rect);
443 if (ret < 0) { 437 if (ret < 0) {
444 goto unlock; 438 goto unlock;
445 } else if (!icd->current_fmt || 439 } else if (!icd->current_fmt ||
446 icd->current_fmt->fourcc != pixfmt) { 440 icd->current_fmt->fourcc != pix->pixelformat) {
447 dev_err(&ici->dev, 441 dev_err(&ici->dev,
448 "Host driver hasn't set up current format correctly!\n"); 442 "Host driver hasn't set up current format correctly!\n");
449 ret = -EINVAL; 443 ret = -EINVAL;
450 goto unlock; 444 goto unlock;
451 } 445 }
452 446
453 icd->width = rect.width; 447 icd->width = f->fmt.pix.width;
454 icd->height = rect.height; 448 icd->height = f->fmt.pix.height;
455 icf->vb_vidq.field = pix->field; 449 icf->vb_vidq.field = pix->field;
456 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 450 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
457 dev_warn(&icd->dev, "Attention! Wrong buf-type %d\n", 451 dev_warn(&icd->dev, "Attention! Wrong buf-type %d\n",
@@ -461,7 +455,7 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
461 icd->width, icd->height); 455 icd->width, icd->height);
462 456
463 /* set physical bus parameters */ 457 /* set physical bus parameters */
464 ret = ici->ops->set_bus_param(icd, pixfmt); 458 ret = ici->ops->set_bus_param(icd, pix->pixelformat);
465 459
466unlock: 460unlock:
467 mutex_unlock(&icf->vb_vidq.vb_lock); 461 mutex_unlock(&icf->vb_vidq.vb_lock);
@@ -685,7 +679,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
685 /* Cropping is allowed during a running capture, guard consistency */ 679 /* Cropping is allowed during a running capture, guard consistency */
686 mutex_lock(&icf->vb_vidq.vb_lock); 680 mutex_lock(&icf->vb_vidq.vb_lock);
687 681
688 ret = ici->ops->set_fmt(icd, 0, &a->c); 682 ret = ici->ops->set_crop(icd, &a->c);
689 if (!ret) { 683 if (!ret) {
690 icd->width = a->c.width; 684 icd->width = a->c.width;
691 icd->height = a->c.height; 685 icd->height = a->c.height;
@@ -918,6 +912,7 @@ int soc_camera_host_register(struct soc_camera_host *ici)
918 if (!ici || !ici->ops || 912 if (!ici || !ici->ops ||
919 !ici->ops->try_fmt || 913 !ici->ops->try_fmt ||
920 !ici->ops->set_fmt || 914 !ici->ops->set_fmt ||
915 !ici->ops->set_crop ||
921 !ici->ops->set_bus_param || 916 !ici->ops->set_bus_param ||
922 !ici->ops->querycap || 917 !ici->ops->querycap ||
923 !ici->ops->init_videobuf || 918 !ici->ops->init_videobuf ||
@@ -998,6 +993,7 @@ int soc_camera_device_register(struct soc_camera_device *icd)
998 !icd->ops->release || 993 !icd->ops->release ||
999 !icd->ops->start_capture || 994 !icd->ops->start_capture ||
1000 !icd->ops->stop_capture || 995 !icd->ops->stop_capture ||
996 !icd->ops->set_crop ||
1001 !icd->ops->set_fmt || 997 !icd->ops->set_fmt ||
1002 !icd->ops->try_fmt || 998 !icd->ops->try_fmt ||
1003 !icd->ops->query_bus_param || 999 !icd->ops->query_bus_param ||