aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/m5602
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-15 11:39:39 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:33 -0400
commite807f20db4f4fbbf2b0c881f0b0dd5cf9c18b17c (patch)
treee88b8356ffa2d60d2a0f44d85b66c5acd0275f3c /drivers/media/video/gspca/m5602
parentc86da6b33f1d268483fbdbeaec0b98779d0317c1 (diff)
V4L/DVB (11533): gspca - m5602-po1030: Setup window per resolution
This patch for the po1030 sets the drawing window for the VGA resolution Signed-off-by: Erik Andr?n <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/m5602')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c29
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.h11
2 files changed, 28 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index ee8e496090a..af0e937451f 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -321,7 +321,34 @@ int po1030_init(struct sd *sd)
321 321
322int po1030_start(struct sd *sd) 322int po1030_start(struct sd *sd)
323{ 323{
324 struct cam *cam = &sd->gspca_dev.cam;
324 int i, err = 0; 325 int i, err = 0;
326 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width;
327 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
328 u8 data;
329
330 switch (width) {
331 case 640:
332 data = ((width + 7) >> 8) & 0xff;
333 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_H, &data, 1);
334 if (err < 0)
335 return err;
336
337 data = (width + 7) & 0xff;
338 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_L, &data, 1);
339 if (err < 0)
340 return err;
341
342 data = ((height + 3) >> 8) & 0xff;
343 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_H, &data, 1);
344 if (err < 0)
345 return err;
346
347 data = (height + 3) & 0xff;
348 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1);
349 break;
350 }
351
325 /* Synthesize the vsync/hsync setup */ 352 /* Synthesize the vsync/hsync setup */
326 for (i = 0; i < ARRAY_SIZE(start_po1030) && !err; i++) { 353 for (i = 0; i < ARRAY_SIZE(start_po1030) && !err; i++) {
327 if (start_po1030[i][0] == BRIDGE) 354 if (start_po1030[i][0] == BRIDGE)
@@ -330,7 +357,7 @@ int po1030_start(struct sd *sd)
330 else if (start_po1030[i][0] == SENSOR) { 357 else if (start_po1030[i][0] == SENSOR) {
331 u8 data = start_po1030[i][2]; 358 u8 data = start_po1030[i][2];
332 err = m5602_write_sensor(sd, 359 err = m5602_write_sensor(sd,
333 start_po1030[i][1], &data, 1); 360 start_po1030[i][1], &data, 1);
334 } 361 }
335 } 362 }
336 return err; 363 return err;
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h
index fb0accfa77a..b47f590ef42 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -272,17 +272,6 @@ static const unsigned char init_po1030[][3] =
272 272
273static const unsigned char start_po1030[][3] = 273static const unsigned char start_po1030[][3] =
274{ 274{
275 /* Set the window width to 647 */
276 {SENSOR, PO1030_WINDOWWIDTH_H, 0x02},
277 {SENSOR, PO1030_WINDOWWIDTH_L, 0x87},
278
279 /* Set the window height to 483 */
280 {SENSOR, PO1030_WINDOWHEIGHT_H, 0x01},
281 {SENSOR, PO1030_WINDOWHEIGHT_L, 0xe3},
282
283 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
284 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
285 {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
286 {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, 275 {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
287 {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, 276 {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
288 {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, 277 {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},