aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9m001.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:46:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:18:43 -0400
commita0705b07f1816ae2b85388fcda71de69c221b4b8 (patch)
tree7406da18408564e38645eeaa22ea49324fd1ca6a /drivers/media/video/mt9m001.c
parent4a6110bc50da9a1883bf45614ac1d591253f0457 (diff)
V4L/DVB (12515): soc-camera: use struct v4l2_rect in struct soc_camera_device
Switch to using struct v4l2_rect in struct soc_camera_device for uniformity and simplicity. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9m001.c')
-rw-r--r--drivers/media/video/mt9m001.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 2a73dac11d3..8b36a74b1be 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -240,8 +240,8 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
240 struct i2c_client *client = sd->priv; 240 struct i2c_client *client = sd->priv;
241 struct soc_camera_device *icd = client->dev.platform_data; 241 struct soc_camera_device *icd = client->dev.platform_data;
242 struct v4l2_rect rect = { 242 struct v4l2_rect rect = {
243 .left = icd->x_current, 243 .left = icd->rect_current.left,
244 .top = icd->y_current, 244 .top = icd->rect_current.top,
245 .width = f->fmt.pix.width, 245 .width = f->fmt.pix.width,
246 .height = f->fmt.pix.height, 246 .height = f->fmt.pix.height,
247 }; 247 };
@@ -467,11 +467,13 @@ static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
467 case V4L2_CID_EXPOSURE_AUTO: 467 case V4L2_CID_EXPOSURE_AUTO:
468 if (ctrl->value) { 468 if (ctrl->value) {
469 const u16 vblank = 25; 469 const u16 vblank = 25;
470 if (reg_write(client, MT9M001_SHUTTER_WIDTH, icd->height + 470 if (reg_write(client, MT9M001_SHUTTER_WIDTH,
471 icd->rect_current.height +
471 icd->y_skip_top + vblank) < 0) 472 icd->y_skip_top + vblank) < 0)
472 return -EIO; 473 return -EIO;
473 qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE); 474 qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE);
474 icd->exposure = (524 + (icd->height + icd->y_skip_top + vblank - 1) * 475 icd->exposure = (524 + (icd->rect_current.height +
476 icd->y_skip_top + vblank - 1) *
475 (qctrl->maximum - qctrl->minimum)) / 477 (qctrl->maximum - qctrl->minimum)) /
476 1048 + qctrl->minimum; 478 1048 + qctrl->minimum;
477 mt9m001->autoexposure = 1; 479 mt9m001->autoexposure = 1;
@@ -613,16 +615,16 @@ static int mt9m001_probe(struct i2c_client *client,
613 v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops); 615 v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops);
614 616
615 /* Second stage probe - when a capture adapter is there */ 617 /* Second stage probe - when a capture adapter is there */
616 icd->ops = &mt9m001_ops; 618 icd->ops = &mt9m001_ops;
617 icd->x_min = 20; 619 icd->rect_max.left = 20;
618 icd->y_min = 12; 620 icd->rect_max.top = 12;
619 icd->x_current = 20; 621 icd->rect_max.width = 1280;
620 icd->y_current = 12; 622 icd->rect_max.height = 1024;
621 icd->width_min = 48; 623 icd->rect_current.left = 20;
622 icd->width_max = 1280; 624 icd->rect_current.top = 12;
623 icd->height_min = 32; 625 icd->width_min = 48;
624 icd->height_max = 1024; 626 icd->height_min = 32;
625 icd->y_skip_top = 1; 627 icd->y_skip_top = 1;
626 /* Simulated autoexposure. If enabled, we calculate shutter width 628 /* Simulated autoexposure. If enabled, we calculate shutter width
627 * ourselves in the driver based on vertical blanking and frame width */ 629 * ourselves in the driver based on vertical blanking and frame width */
628 mt9m001->autoexposure = 1; 630 mt9m001->autoexposure = 1;