diff options
author | Erik Andr?n <erik.andren@gmail.com> | 2009-01-15 12:05:35 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:33 -0400 |
commit | 9536a57e7783c627b2bb83f78a99f5c6dcf5d505 (patch) | |
tree | 42368bcde31ab746138eba9f584d887f4b5c0493 /drivers | |
parent | e807f20db4f4fbbf2b0c881f0b0dd5cf9c18b17c (diff) |
V4L/DVB (11534): gspca - m5602-po1030: 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')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_po1030.c | 59 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_po1030.h | 23 |
2 files changed, 47 insertions, 35 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c index af0e937451fc..d75b27221a5c 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/drivers/media/video/gspca/m5602/m5602_po1030.c | |||
@@ -50,7 +50,7 @@ static struct v4l2_pix_format po1030_modes[] = { | |||
50 | .sizeimage = 640 * 480, | 50 | .sizeimage = 640 * 480, |
51 | .bytesperline = 640, | 51 | .bytesperline = 640, |
52 | .colorspace = V4L2_COLORSPACE_SRGB, | 52 | .colorspace = V4L2_COLORSPACE_SRGB, |
53 | .priv = 0 | 53 | .priv = 2 |
54 | } | 54 | } |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -325,6 +325,7 @@ int po1030_start(struct sd *sd) | |||
325 | int i, err = 0; | 325 | int i, err = 0; |
326 | int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; | 326 | int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; |
327 | int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; | 327 | int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; |
328 | int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv; | ||
328 | u8 data; | 329 | u8 data; |
329 | 330 | ||
330 | switch (width) { | 331 | switch (width) { |
@@ -346,20 +347,54 @@ int po1030_start(struct sd *sd) | |||
346 | 347 | ||
347 | data = (height + 3) & 0xff; | 348 | data = (height + 3) & 0xff; |
348 | err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1); | 349 | err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1); |
350 | |||
351 | height += 12; | ||
352 | width -= 2; | ||
349 | break; | 353 | break; |
350 | } | 354 | } |
351 | 355 | ||
352 | /* Synthesize the vsync/hsync setup */ | 356 | err = m5602_write_bridge(sd, M5602_XB_LINE_OF_FRAME_H, 0x81); |
353 | for (i = 0; i < ARRAY_SIZE(start_po1030) && !err; i++) { | 357 | if (err < 0) |
354 | if (start_po1030[i][0] == BRIDGE) | 358 | return err; |
355 | err = m5602_write_bridge(sd, start_po1030[i][1], | 359 | |
356 | start_po1030[i][2]); | 360 | err = m5602_write_bridge(sd, M5602_XB_PIX_OF_LINE_H, 0x82); |
357 | else if (start_po1030[i][0] == SENSOR) { | 361 | if (err < 0) |
358 | u8 data = start_po1030[i][2]; | 362 | return err; |
359 | err = m5602_write_sensor(sd, | 363 | |
360 | start_po1030[i][1], &data, 1); | 364 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, |
361 | } | 365 | ((ver_offs >> 8) & 0xff)); |
362 | } | 366 | if (err < 0) |
367 | return err; | ||
368 | |||
369 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (ver_offs & 0xff)); | ||
370 | if (err < 0) | ||
371 | return err; | ||
372 | |||
373 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); | ||
374 | if (err < 0) | ||
375 | return err; | ||
376 | |||
377 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff); | ||
378 | if (err < 0) | ||
379 | return err; | ||
380 | |||
381 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff)); | ||
382 | if (err < 0) | ||
383 | return err; | ||
384 | |||
385 | for (i = 0; i < 2 && !err; i++) | ||
386 | err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); | ||
387 | |||
388 | for (i = 0; i < 2 && !err; i++) | ||
389 | err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, 0); | ||
390 | if (err < 0) | ||
391 | return err; | ||
392 | |||
393 | err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width >> 8) & 0xff); | ||
394 | if (err < 0) | ||
395 | return err; | ||
396 | |||
397 | err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width & 0xff)); | ||
363 | return err; | 398 | return err; |
364 | } | 399 | } |
365 | 400 | ||
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h index b47f590ef428..8ded84d20973 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.h +++ b/drivers/media/video/gspca/m5602/m5602_po1030.h | |||
@@ -270,27 +270,4 @@ static const unsigned char init_po1030[][3] = | |||
270 | {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, | 270 | {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, |
271 | }; | 271 | }; |
272 | 272 | ||
273 | static const unsigned char start_po1030[][3] = | ||
274 | { | ||
275 | {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, | ||
276 | {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, | ||
277 | {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, | ||
278 | {BRIDGE, M5602_XB_SIG_INI, 0x01}, | ||
279 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
280 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x02}, | ||
281 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
282 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
283 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, | ||
284 | {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, | ||
285 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
286 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
287 | {BRIDGE, M5602_XB_SIG_INI, 0x00}, | ||
288 | {BRIDGE, M5602_XB_SIG_INI, 0x00}, | ||
289 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, | ||
290 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, | ||
291 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, | ||
292 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x7e}, | ||
293 | {BRIDGE, M5602_XB_SIG_INI, 0x00}, | ||
294 | }; | ||
295 | |||
296 | #endif | 273 | #endif |