aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-20 02:05:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:35 -0400
commite7ae60f73eebd16cc13e616b096e8b1488915d96 (patch)
treea37e9b77a057e22d2cc4306894af016924b45443 /drivers/media
parentbce0d2d4aefdb258bd4a69e2de2e0d1bed0e5531 (diff)
V4L/DVB (11542): gspca - m5602-mt9m111: Synthesize the hsync/vsync setup
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_mt9m111.c51
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.h14
2 files changed, 51 insertions, 14 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
index edf502041b80..7986ef074c55 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
@@ -269,6 +269,10 @@ int mt9m111_start(struct sd *sd)
269{ 269{
270 int i, err = 0; 270 int i, err = 0;
271 u8 data[2]; 271 u8 data[2];
272 struct cam *cam = &sd->gspca_dev.cam;
273
274 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width;
275 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
272 276
273 for (i = 0; i < ARRAY_SIZE(start_mt9m111) && !err; i++) { 277 for (i = 0; i < ARRAY_SIZE(start_mt9m111) && !err; i++) {
274 if (start_mt9m111[i][0] == BRIDGE) { 278 if (start_mt9m111[i][0] == BRIDGE) {
@@ -282,6 +286,53 @@ int mt9m111_start(struct sd *sd)
282 start_mt9m111[i][1], data, 2); 286 start_mt9m111[i][1], data, 2);
283 } 287 }
284 } 288 }
289 if (err < 0)
290 return err;
291
292 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff);
293 if (err < 0)
294 return err;
295
296 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff));
297 if (err < 0)
298 return err;
299
300 for (i = 0; i < 2 && !err; i++)
301 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0);
302 if (err < 0)
303 return err;
304
305 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0);
306 if (err < 0)
307 return err;
308
309 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 2);
310 if (err < 0)
311 return err;
312
313 for (i = 0; i < 2 && !err; i++)
314 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, 0);
315 if (err < 0)
316 return err;
317
318 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA,
319 (width >> 8) & 0xff);
320 if (err < 0)
321 return err;
322
323 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, width & 0xff);
324 if (err < 0)
325 return err;
326
327 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0);
328 if (err < 0)
329 return err;
330
331 switch (width) {
332 case 640:
333 PDEBUG(D_V4L2, "Configuring camera for VGA mode");
334 break;
335 }
285 return err; 336 return err;
286} 337}
287 338
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
index 6598dd9c438e..7c8c700bab95 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.h
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
@@ -275,20 +275,6 @@ static const unsigned char start_mt9m111[][4] =
275 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00}, 275 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
276 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00}, 276 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
277 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00}, 277 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
278 {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
279 {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0, 0x00}, /* 480 */
280 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
281 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
282 {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
283 {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
284 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
285 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
286 {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00}, /* 639*/
287 {BRIDGE, M5602_XB_HSYNC_PARA, 0x7f, 0x00},
288 {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
289 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
290 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
291}; 278};
292 279
293
294#endif 280#endif