V4L/DVB (11684): gspca - m5602-s5k4aa: Add experimental SXGA support

Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Erik Andrén 2009-01-29 13:34:41 -03:00 committed by Mauro Carvalho Chehab
parent 27d4032143
commit 4fcec145e9
2 changed files with 95 additions and 0 deletions

View File

@ -64,6 +64,17 @@ static
};
static struct v4l2_pix_format s5k4aa_modes[] = {
{
1280,
1024,
V4L2_PIX_FMT_SBGGR8,
V4L2_FIELD_NONE,
.sizeimage =
1280 * 1024,
.bytesperline = 1280,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0
},
{
640,
480,
@ -257,6 +268,38 @@ int s5k4aa_start(struct sd *sd)
struct cam *cam = &sd->gspca_dev.cam;
switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) {
case 1280:
PDEBUG(D_V4L2, "Configuring camera for SXGA mode");
for (i = 0; i < ARRAY_SIZE(SXGA_s5k4aa); i++) {
switch (SXGA_s5k4aa[i][0]) {
case BRIDGE:
err = m5602_write_bridge(sd,
SXGA_s5k4aa[i][1],
SXGA_s5k4aa[i][2]);
break;
case SENSOR:
data[0] = SXGA_s5k4aa[i][2];
err = m5602_write_sensor(sd,
SXGA_s5k4aa[i][1],
data, 1);
break;
case SENSOR_LONG:
data[0] = SXGA_s5k4aa[i][2];
data[1] = SXGA_s5k4aa[i][3];
err = m5602_write_sensor(sd,
SXGA_s5k4aa[i][1],
data, 2);
break;
default:
err("Invalid stream command, exiting init");
return -EINVAL;
}
}
case 640:
PDEBUG(D_V4L2, "Configuring camera for VGA mode");

View File

@ -235,4 +235,56 @@ static const unsigned char VGA_s5k4aa[][4] =
{SENSOR, 0x02, 0x0e, 0x00},
};
static const unsigned char SXGA_s5k4aa[][4] =
{
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
{BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
{BRIDGE, M5602_XB_SENSOR_TYPE, 0x08, 0x00},
{BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
{BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
/* VSYNC_PARA, VSYNC_PARA : img height 1024 = 0x0400 */
{BRIDGE, M5602_XB_VSYNC_PARA, 0x04, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
/* HSYNC_PARA, HSYNC_PARA : img width 1280 = 0x0500 */
{BRIDGE, M5602_XB_HSYNC_PARA, 0x05, 0x00},
{BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xa0, 0x00}, /* 48 MHz */
{SENSOR, S5K4AA_PAGE_MAP, 0x02, 0x00},
{SENSOR, S5K4AA_READ_MODE, S5K4AA_RM_H_FLIP | S5K4AA_RM_ROW_SKIP_2X
| S5K4AA_RM_COL_SKIP_2X, 0x00},
{SENSOR, 0x37, 0x01, 0x00},
{SENSOR, S5K4AA_ROWSTART_HI, 0x00, 0x00},
{SENSOR, S5K4AA_ROWSTART_LO, 0x0a, 0x00},
{SENSOR, S5K4AA_COLSTART_HI, 0x00, 0x00},
{SENSOR, S5K4AA_COLSTART_LO, 0x0b, 0x00},
{SENSOR, S5K4AA_WINDOW_HEIGHT_HI, 0x04, 0x00},
{SENSOR, S5K4AA_WINDOW_HEIGHT_LO, 0x00, 0x00},
{SENSOR, S5K4AA_WINDOW_WIDTH_HI, 0x05, 0x00},
{SENSOR, S5K4AA_WINDOW_WIDTH_LO, 0x00, 0x00},
{SENSOR, S5K4AA_H_BLANK_HI__, 0x00, 0x00},
{SENSOR, S5K4AA_H_BLANK_LO__, 0xa8, 0x00},
{SENSOR, S5K4AA_EXPOSURE_HI, 0x01, 0x00},
{SENSOR, S5K4AA_EXPOSURE_LO, 0x00, 0x00},
{SENSOR, 0x11, 0x04, 0x00},
{SENSOR, 0x12, 0xc3, 0x00},
{SENSOR, S5K4AA_PAGE_MAP, 0x02, 0x00},
{SENSOR, 0x02, 0x0e, 0x00},
};
#endif