summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-15 17:39:39 +0100
committerErik Andr?n <erik.andren@gmail.com>2009-01-15 17:39:39 +0100
commitbad672aa254ea85d9bee65a66d738bc3499f29f3 (patch)
tree710798588913921e24d58937317a1d9e8072ce77
parent0d279bbfcf3b99473811cd64982fdcaefe5de8e2 (diff)
downloadmediapointer-dvb-s2-bad672aa254ea85d9bee65a66d738bc3499f29f3.tar.gz
mediapointer-dvb-s2-bad672aa254ea85d9bee65a66d738bc3499f29f3.tar.bz2
gspca - m5602-po1030: Setup window per resolution
From: Erik Andr?n <erik.andren@gmail.com> This patch for the po1030 sets the drawing window for the VGA resolution Priority: normal Signed-off-by: Erik Andr?n <erik.andren@gmail.com>
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_po1030.c29
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_po1030.h11
2 files changed, 28 insertions, 12 deletions
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c
index ee8e49609..af0e93745 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -321,7 +321,34 @@ int po1030_init(struct sd *sd)
int po1030_start(struct sd *sd)
{
+ struct cam *cam = &sd->gspca_dev.cam;
int i, err = 0;
+ int width = cam->cam_mode[sd->gspca_dev.curr_mode].width;
+ int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
+ u8 data;
+
+ switch (width) {
+ case 640:
+ data = ((width + 7) >> 8) & 0xff;
+ err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_H, &data, 1);
+ if (err < 0)
+ return err;
+
+ data = (width + 7) & 0xff;
+ err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_L, &data, 1);
+ if (err < 0)
+ return err;
+
+ data = ((height + 3) >> 8) & 0xff;
+ err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_H, &data, 1);
+ if (err < 0)
+ return err;
+
+ data = (height + 3) & 0xff;
+ err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1);
+ break;
+ }
+
/* Synthesize the vsync/hsync setup */
for (i = 0; i < ARRAY_SIZE(start_po1030) && !err; i++) {
if (start_po1030[i][0] == BRIDGE)
@@ -330,7 +357,7 @@ int po1030_start(struct sd *sd)
else if (start_po1030[i][0] == SENSOR) {
u8 data = start_po1030[i][2];
err = m5602_write_sensor(sd,
- start_po1030[i][1], &data, 1);
+ start_po1030[i][1], &data, 1);
}
}
return err;
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
index fb0accfa7..b47f590ef 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -272,17 +272,6 @@ static const unsigned char init_po1030[][3] =
static const unsigned char start_po1030[][3] =
{
- /* Set the window width to 647 */
- {SENSOR, PO1030_WINDOWWIDTH_H, 0x02},
- {SENSOR, PO1030_WINDOWWIDTH_L, 0x87},
-
- /* Set the window height to 483 */
- {SENSOR, PO1030_WINDOWHEIGHT_H, 0x01},
- {SENSOR, PO1030_WINDOWHEIGHT_L, 0xe3},
-
- {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
- {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
- {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
{BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
{BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
{BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},