aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9t031.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-12-11 09:14:46 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 06:27:13 -0500
commit325361088b73269f4cc96256276a142addbf3454 (patch)
tree6a18f4b10d1df53bfae4a773480fdadfad587b62 /drivers/media/video/mt9t031.c
parent11e3d1adbe0246fc8d6c06f7e42aff5bead25670 (diff)
V4L/DVB (13644): v4l: add new v4l2-subdev sensor operations, use g_skip_top_lines in soc-camera
Introduce new v4l2-subdev sensor operations, move .enum_framesizes() and .enum_frameintervals() methods to it, add a new .g_skip_top_lines() method and switch soc-camera to use it instead of .y_skip_top soc_camera_device member, which can now be removed. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Sergio Aguirre <saaguirre@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9t031.c')
-rw-r--r--drivers/media/video/mt9t031.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index 6966f644977e..1adbb7b2b580 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -74,6 +74,7 @@ struct mt9t031 {
74 u16 xskip; 74 u16 xskip;
75 u16 yskip; 75 u16 yskip;
76 unsigned int gain; 76 unsigned int gain;
77 unsigned short y_skip_top; /* Lines to skip at the top */
77 unsigned int exposure; 78 unsigned int exposure;
78 unsigned char autoexposure; 79 unsigned char autoexposure;
79}; 80};
@@ -301,9 +302,9 @@ static int mt9t031_set_params(struct soc_camera_device *icd,
301 ret = reg_write(client, MT9T031_WINDOW_WIDTH, rect->width - 1); 302 ret = reg_write(client, MT9T031_WINDOW_WIDTH, rect->width - 1);
302 if (ret >= 0) 303 if (ret >= 0)
303 ret = reg_write(client, MT9T031_WINDOW_HEIGHT, 304 ret = reg_write(client, MT9T031_WINDOW_HEIGHT,
304 rect->height + icd->y_skip_top - 1); 305 rect->height + mt9t031->y_skip_top - 1);
305 if (ret >= 0 && mt9t031->autoexposure) { 306 if (ret >= 0 && mt9t031->autoexposure) {
306 unsigned int total_h = rect->height + icd->y_skip_top + vblank; 307 unsigned int total_h = rect->height + mt9t031->y_skip_top + vblank;
307 ret = set_shutter(client, total_h); 308 ret = set_shutter(client, total_h);
308 if (ret >= 0) { 309 if (ret >= 0) {
309 const u32 shutter_max = MT9T031_MAX_HEIGHT + vblank; 310 const u32 shutter_max = MT9T031_MAX_HEIGHT + vblank;
@@ -657,7 +658,7 @@ static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
657 const u16 vblank = MT9T031_VERTICAL_BLANK; 658 const u16 vblank = MT9T031_VERTICAL_BLANK;
658 const u32 shutter_max = MT9T031_MAX_HEIGHT + vblank; 659 const u32 shutter_max = MT9T031_MAX_HEIGHT + vblank;
659 unsigned int total_h = mt9t031->rect.height + 660 unsigned int total_h = mt9t031->rect.height +
660 icd->y_skip_top + vblank; 661 mt9t031->y_skip_top + vblank;
661 662
662 if (set_shutter(client, total_h) < 0) 663 if (set_shutter(client, total_h) < 0)
663 return -EIO; 664 return -EIO;
@@ -714,6 +715,16 @@ static int mt9t031_video_probe(struct i2c_client *client)
714 return ret; 715 return ret;
715} 716}
716 717
718static int mt9t031_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
719{
720 struct i2c_client *client = sd->priv;
721 struct mt9t031 *mt9t031 = to_mt9t031(client);
722
723 *lines = mt9t031->y_skip_top;
724
725 return 0;
726}
727
717static struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = { 728static struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = {
718 .g_ctrl = mt9t031_g_ctrl, 729 .g_ctrl = mt9t031_g_ctrl,
719 .s_ctrl = mt9t031_s_ctrl, 730 .s_ctrl = mt9t031_s_ctrl,
@@ -734,9 +745,14 @@ static struct v4l2_subdev_video_ops mt9t031_subdev_video_ops = {
734 .cropcap = mt9t031_cropcap, 745 .cropcap = mt9t031_cropcap,
735}; 746};
736 747
748static struct v4l2_subdev_sensor_ops mt9t031_subdev_sensor_ops = {
749 .g_skip_top_lines = mt9t031_g_skip_top_lines,
750};
751
737static struct v4l2_subdev_ops mt9t031_subdev_ops = { 752static struct v4l2_subdev_ops mt9t031_subdev_ops = {
738 .core = &mt9t031_subdev_core_ops, 753 .core = &mt9t031_subdev_core_ops,
739 .video = &mt9t031_subdev_video_ops, 754 .video = &mt9t031_subdev_video_ops,
755 .sensor = &mt9t031_subdev_sensor_ops,
740}; 756};
741 757
742static int mt9t031_probe(struct i2c_client *client, 758static int mt9t031_probe(struct i2c_client *client,
@@ -773,8 +789,8 @@ static int mt9t031_probe(struct i2c_client *client,
773 789
774 /* Second stage probe - when a capture adapter is there */ 790 /* Second stage probe - when a capture adapter is there */
775 icd->ops = &mt9t031_ops; 791 icd->ops = &mt9t031_ops;
776 icd->y_skip_top = 0;
777 792
793 mt9t031->y_skip_top = 0;
778 mt9t031->rect.left = MT9T031_COLUMN_SKIP; 794 mt9t031->rect.left = MT9T031_COLUMN_SKIP;
779 mt9t031->rect.top = MT9T031_ROW_SKIP; 795 mt9t031->rect.top = MT9T031_ROW_SKIP;
780 mt9t031->rect.width = MT9T031_MAX_WIDTH; 796 mt9t031->rect.width = MT9T031_MAX_WIDTH;