Commit 9536a57e authored by Erik Andr?n's avatar Erik Andr?n Committed by Mauro Carvalho Chehab

V4L/DVB (11534): gspca - m5602-po1030: Synthesize the hsync/vsync setup

Signed-off-by: default avatarErik Andr?n <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e807f20d
...@@ -50,7 +50,7 @@ static struct v4l2_pix_format po1030_modes[] = { ...@@ -50,7 +50,7 @@ static struct v4l2_pix_format po1030_modes[] = {
.sizeimage = 640 * 480, .sizeimage = 640 * 480,
.bytesperline = 640, .bytesperline = 640,
.colorspace = V4L2_COLORSPACE_SRGB, .colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0 .priv = 2
} }
}; };
...@@ -325,6 +325,7 @@ int po1030_start(struct sd *sd) ...@@ -325,6 +325,7 @@ int po1030_start(struct sd *sd)
int i, err = 0; int i, err = 0;
int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; int width = cam->cam_mode[sd->gspca_dev.curr_mode].width;
int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; int height = cam->cam_mode[sd->gspca_dev.curr_mode].height;
int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv;
u8 data; u8 data;
switch (width) { switch (width) {
...@@ -346,20 +347,54 @@ int po1030_start(struct sd *sd) ...@@ -346,20 +347,54 @@ int po1030_start(struct sd *sd)
data = (height + 3) & 0xff; data = (height + 3) & 0xff;
err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1); err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1);
height += 12;
width -= 2;
break; break;
} }
/* Synthesize the vsync/hsync setup */ err = m5602_write_bridge(sd, M5602_XB_LINE_OF_FRAME_H, 0x81);
for (i = 0; i < ARRAY_SIZE(start_po1030) && !err; i++) { if (err < 0)
if (start_po1030[i][0] == BRIDGE) return err;
err = m5602_write_bridge(sd, start_po1030[i][1],
start_po1030[i][2]); err = m5602_write_bridge(sd, M5602_XB_PIX_OF_LINE_H, 0x82);
else if (start_po1030[i][0] == SENSOR) { if (err < 0)
u8 data = start_po1030[i][2]; return err;
err = m5602_write_sensor(sd,
start_po1030[i][1], &data, 1); err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA,
} ((ver_offs >> 8) & 0xff));
} if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (ver_offs & 0xff));
if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0);
if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff);
if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff));
if (err < 0)
return err;
for (i = 0; i < 2 && !err; i++)
err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0);
for (i = 0; i < 2 && !err; i++)
err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, 0);
if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width >> 8) & 0xff);
if (err < 0)
return err;
err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width & 0xff));
return err; return err;
} }
......
...@@ -270,27 +270,4 @@ static const unsigned char init_po1030[][3] = ...@@ -270,27 +270,4 @@ static const unsigned char init_po1030[][3] =
{BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, {BRIDGE, M5602_XB_GPIO_EN_L, 0x00},
}; };
static const unsigned char start_po1030[][3] =
{
{BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c},
{BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
{BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
{BRIDGE, M5602_XB_SIG_INI, 0x01},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x02},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x01},
{BRIDGE, M5602_XB_VSYNC_PARA, 0xec},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x02},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x7e},
{BRIDGE, M5602_XB_SIG_INI, 0x00},
};
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment