aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-12-21 16:07:59 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:02 -0500
commit082aa8937c79a02397981b7543ccc65d2bdeaf97 (patch)
tree1f8de51c39d3a9b7f927d788a673326fa5a631c2 /drivers/media
parent3da3dce5afd267d354427042090aaf6370ebc15c (diff)
V4L/DVB (10036): m5602 - ov9650: Prepare the sensor to set multiple resolutions
Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.c24
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.h59
2 files changed, 57 insertions, 26 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c
index 96b7791b37dd..fcca3adefc5b 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c
@@ -143,6 +143,30 @@ int ov9650_init(struct sd *sd)
143 return err; 143 return err;
144} 144}
145 145
146int ov9650_start(struct sd *sd)
147{
148 int i, err = 0;
149 struct cam *cam = &sd->gspca_dev.cam;
150
151 switch (cam->cam_mode[sd->gspca_dev.curr_mode].width)
152 {
153 default:
154 case 640:
155 PDEBUG(D_V4L2, "Configuring camera for VGA mode");
156
157 for (i = 0; i < ARRAY_SIZE(VGA_ov9650) && !err; i++) {
158 u8 data = VGA_ov9650[i][2];
159 if (VGA_ov9650[i][0] == SENSOR)
160 err = m5602_write_sensor(sd,
161 VGA_ov9650[i][1], &data, 1);
162 else
163 err = m5602_write_bridge(sd, VGA_ov9650[i][1], data);
164 }
165 break;
166 }
167 return err;
168}
169
146int ov9650_power_down(struct sd *sd) 170int ov9650_power_down(struct sd *sd)
147{ 171{
148 int i, err = 0; 172 int i, err = 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h
index 9360b8bd92ae..17f3382af76a 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.h
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h
@@ -124,6 +124,7 @@ extern int dump_sensor;
124 124
125int ov9650_probe(struct sd *sd); 125int ov9650_probe(struct sd *sd);
126int ov9650_init(struct sd *sd); 126int ov9650_init(struct sd *sd);
127int ov9650_start(struct sd *sd);
127int ov9650_power_down(struct sd *sd); 128int ov9650_power_down(struct sd *sd);
128 129
129int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val); 130int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
@@ -151,6 +152,7 @@ static struct m5602_sensor ov9650 = {
151 .i2c_regW = 1, 152 .i2c_regW = 1,
152 .probe = ov9650_probe, 153 .probe = ov9650_probe,
153 .init = ov9650_init, 154 .init = ov9650_init,
155 .start = ov9650_start,
154 .power_down = ov9650_power_down, 156 .power_down = ov9650_power_down,
155 157
156 .nctrls = 8, 158 .nctrls = 8,
@@ -259,15 +261,15 @@ static struct m5602_sensor ov9650 = {
259 .nmodes = 1, 261 .nmodes = 1,
260 .modes = { 262 .modes = {
261 { 263 {
262 M5602_DEFAULT_FRAME_WIDTH, 264 640,
263 M5602_DEFAULT_FRAME_HEIGHT, 265 480,
264 V4L2_PIX_FMT_SBGGR8, 266 V4L2_PIX_FMT_SBGGR8,
265 V4L2_FIELD_NONE, 267 V4L2_FIELD_NONE,
266 .sizeimage = 268 .sizeimage =
267 M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT, 269 640 * 480,
268 .bytesperline = M5602_DEFAULT_FRAME_WIDTH, 270 .bytesperline = 640,
269 .colorspace = V4L2_COLORSPACE_SRGB, 271 .colorspace = V4L2_COLORSPACE_SRGB,
270 .priv = 1 272 .priv = 0
271 } 273 }
272 } 274 }
273}; 275};
@@ -414,27 +416,6 @@ static const unsigned char init_ov9650[][3] =
414 {SENSOR, OV9650_GAIN, GAIN_DEFAULT}, 416 {SENSOR, OV9650_GAIN, GAIN_DEFAULT},
415 {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT}, 417 {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT},
416 {SENSOR, OV9650_RED, RED_GAIN_DEFAULT}, 418 {SENSOR, OV9650_RED, RED_GAIN_DEFAULT},
417
418 {SENSOR, OV9650_COM3, OV9650_VARIOPIXEL},
419 {SENSOR, OV9650_COM5, OV9650_SYSTEM_CLK_SEL},
420
421 {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82},
422 {BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00},
423 {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
424 {BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00},
425 {BRIDGE, M5602_XB_SIG_INI, 0x01},
426 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
427 /* Moves the view window in a vertical orientation */
428 {BRIDGE, M5602_XB_VSYNC_PARA, 0x09},
429 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
430 {BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
431 {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0}, /* 480 */
432 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
433 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
434 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
435 {BRIDGE, M5602_XB_HSYNC_PARA, 0x64}, /* 100 */
436 {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, /* 640 + 100 */
437 {BRIDGE, M5602_XB_HSYNC_PARA, 0xe4}
438}; 419};
439 420
440static const unsigned char power_down_ov9650[][3] = 421static const unsigned char power_down_ov9650[][3] =
@@ -457,4 +438,30 @@ static const unsigned char power_down_ov9650[][3] =
457 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0} 438 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}
458}; 439};
459 440
441static const unsigned char VGA_ov9650[][3] =
442{
443 {SENSOR, OV9650_COM7, OV9650_VGA_SELECT |
444 OV9650_RGB_SELECT |
445 OV9650_RAW_RGB_SELECT},
446
447 {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82},
448 {BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00},
449 {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
450 {BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00},
451 {BRIDGE, M5602_XB_SIG_INI, 0x01},
452
453 /* Moves the view window in a vertical orientation */
454 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
455 {BRIDGE, M5602_XB_VSYNC_PARA, 0x09},
456 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
457 {BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
458 {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0}, /* 480 */
459 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
460 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
461 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
462 {BRIDGE, M5602_XB_HSYNC_PARA, 0x64}, /* 100 */
463 {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, /* 640 + 100 */
464 {BRIDGE, M5602_XB_HSYNC_PARA, 0xe4}
465};
466
460#endif 467#endif