From 6af4e7a15086782c7702491774cbb349ec763fb8 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Thu, 29 Jan 2009 16:34:25 -0300 Subject: [PATCH] V4L/DVB (10424): gspca - vc032x: Add resolution 1280x1024 for sensor mi1310_soc. Signed-off-by: Jean-Francois Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/vc032x.c | 213 +++++++++++++++++++++-------- 1 file changed, 157 insertions(+), 56 deletions(-) diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 1b34906ac1b9..4ffdc64e2016 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -149,6 +149,11 @@ static const struct v4l2_pix_format vc0323_mode[] = { .sizeimage = 640 * 480 * 3 / 8 + 590, .colorspace = V4L2_COLORSPACE_JPEG, .priv = 0}, + {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi1310_soc only */ + .bytesperline = 1280, + .sizeimage = 1280 * 1024 * 1 / 4 + 590, + .colorspace = V4L2_COLORSPACE_JPEG, + .priv = 2}, }; static const struct v4l2_pix_format svga_mode[] = { @@ -623,6 +628,113 @@ static const __u8 mi1310_socinitQVGA_JPG[][4] = { {0xb8, 0xa0, 0x12, 0xcc}, {}, }; +static const u8 mi1310_soc_InitSXGA_JPG[][4] = { + {0xb0, 0x03, 0x19, 0xcc}, + {0xb0, 0x04, 0x02, 0xcc}, + {0xb3, 0x00, 0x24, 0xcc}, + {0xb3, 0x00, 0x25, 0xcc}, + {0xb3, 0x05, 0x00, 0xcc}, + {0xb3, 0x06, 0x01, 0xcc}, + {0xb3, 0x5c, 0x01, 0xcc}, + {0xb3, 0x08, 0x01, 0xcc}, + {0xb3, 0x09, 0x0c, 0xcc}, + {0xb3, 0x34, 0x02, 0xcc}, + {0xb3, 0x35, 0xdd, 0xcc}, + {0xb3, 0x03, 0x0a, 0xcc}, + {0xb3, 0x04, 0x0d, 0xcc}, + {0xb3, 0x20, 0x00, 0xcc}, + {0xb3, 0x21, 0x00, 0xcc}, + {0xb3, 0x22, 0x04, 0xcc}, + {0xb3, 0x23, 0x00, 0xcc}, + {0xb3, 0x14, 0x00, 0xcc}, + {0xb3, 0x15, 0x00, 0xcc}, + {0xb3, 0x16, 0x04, 0xcc}, + {0xb3, 0x17, 0xff, 0xcc}, + {0xb8, 0x01, 0x7d, 0xcc}, + {0xb8, 0x81, 0x09, 0xcc}, + {0xb8, 0x27, 0x20, 0xcc}, + {0xb8, 0x26, 0x80, 0xcc}, + {0xb8, 0x06, 0x00, 0xcc}, + {0xb8, 0x07, 0x05, 0xcc}, + {0xb8, 0x08, 0x00, 0xcc}, + {0xb8, 0x09, 0x04, 0xcc}, + {0xb3, 0x00, 0x25, 0xcc}, + {0xb8, 0x00, 0x11, 0xcc}, + {0xbc, 0x00, 0x71, 0xcc}, + {0xb8, 0x81, 0x01, 0xcc}, + {0xb8, 0x2c, 0x5a, 0xcc}, + {0xb8, 0x2d, 0xff, 0xcc}, + {0xb8, 0x2e, 0xee, 0xcc}, + {0xb8, 0x2f, 0xfb, 0xcc}, + {0xb8, 0x30, 0x52, 0xcc}, + {0xb8, 0x31, 0xf8, 0xcc}, + {0xb8, 0x32, 0xf1, 0xcc}, + {0xb8, 0x33, 0xff, 0xcc}, + {0xb8, 0x34, 0x54, 0xcc}, + {0xf0, 0x00, 0x00, 0xbb}, + {0x00, 0x01, 0x00, 0xdd}, + {0x0d, 0x00, 0x09, 0xbb}, + {0x0d, 0x00, 0x08, 0xbb}, + {0xf0, 0x00, 0x01, 0xbb}, + {0x00, 0x01, 0x00, 0xdd}, + {0x06, 0x00, 0x14, 0xbb}, + {0x3a, 0x10, 0x00, 0xbb}, + {0x00, 0x00, 0x10, 0xdd}, + {0x9b, 0x10, 0x00, 0xbb}, + {0x00, 0x00, 0x10, 0xdd}, + {0xf0, 0x00, 0x00, 0xbb}, + {0x00, 0x01, 0x00, 0xdd}, + {0x2b, 0x00, 0x28, 0xbb}, + {0x2c, 0x00, 0x30, 0xbb}, + {0x2d, 0x00, 0x30, 0xbb}, + {0x2e, 0x00, 0x28, 0xbb}, + {0x41, 0x00, 0xd7, 0xbb}, + {0x09, 0x02, 0x3a, 0xbb}, + {0x0c, 0x00, 0x00, 0xbb}, + {0x20, 0x00, 0x00, 0xbb}, + {0x05, 0x00, 0x8c, 0xbb}, + {0x06, 0x00, 0x32, 0xbb}, + {0x07, 0x00, 0xc6, 0xbb}, + {0x08, 0x00, 0x19, 0xbb}, + {0x24, 0x80, 0x6f, 0xbb}, + {0xc8, 0x00, 0x0f, 0xbb}, + {0x20, 0x00, 0x03, 0xbb}, + {0xb6, 0x00, 0x00, 0xcc}, + {0xb6, 0x03, 0x05, 0xcc}, + {0xb6, 0x02, 0x00, 0xcc}, + {0xb6, 0x05, 0x04, 0xcc}, + {0xb6, 0x04, 0x00, 0xcc}, + {0xb6, 0x12, 0xf8, 0xcc}, + {0xb6, 0x18, 0x0a, 0xcc}, + {0xb6, 0x17, 0x00, 0xcc}, + {0xb6, 0x16, 0x00, 0xcc}, + {0xb6, 0x22, 0x12, 0xcc}, + {0xb6, 0x23, 0x0b, 0xcc}, + {0xb3, 0x02, 0x02, 0xcc}, + {0xbf, 0xc0, 0x39, 0xcc}, + {0xbf, 0xc1, 0x04, 0xcc}, + {0xbf, 0xcc, 0x10, 0xcc}, + {0xb9, 0x12, 0x00, 0xcc}, + {0xb9, 0x13, 0x14, 0xcc}, + {0xb9, 0x14, 0x14, 0xcc}, + {0xb9, 0x15, 0x14, 0xcc}, + {0xb9, 0x16, 0x14, 0xcc}, + {0xb9, 0x18, 0x00, 0xcc}, + {0xb9, 0x19, 0x1e, 0xcc}, + {0xb9, 0x1a, 0x1e, 0xcc}, + {0xb9, 0x1b, 0x1e, 0xcc}, + {0xb9, 0x1c, 0x1e, 0xcc}, + {0xb3, 0x01, 0x41, 0xcc}, + {0xb8, 0x8e, 0x00, 0xcc}, + {0xb8, 0x8f, 0xff, 0xcc}, + {0xb6, 0x12, 0xf8, 0xcc}, + {0xb8, 0x0c, 0x20, 0xcc}, + {0xb8, 0x0d, 0x70, 0xcc}, + {0xb6, 0x13, 0x13, 0xcc}, + {0x2f, 0x00, 0xC0, 0xbb}, + {0xb8, 0xa0, 0x12, 0xcc}, + {} +}; static const __u8 mi1320_gamma[17] = { 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, @@ -2022,7 +2134,10 @@ static int sd_config(struct gspca_dev *gspca_dev, } else { if (sensor != SENSOR_PO1200) { cam->cam_mode = vc0323_mode; - cam->nmodes = ARRAY_SIZE(vc0323_mode); + if (sd->sensor != SENSOR_MI1310_SOC) + cam->nmodes = ARRAY_SIZE(vc0323_mode); + else /* no SXGA */ + cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1; } else { cam->cam_mode = svga_mode; cam->nmodes = ARRAY_SIZE(svga_mode); @@ -2124,6 +2239,7 @@ static void setsharpness(struct gspca_dev *gspca_dev) static int sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; + const __u8 (*init)[4]; const __u8 *GammaT = NULL; const __u8 *MatrixT = NULL; int mode; @@ -2141,96 +2257,81 @@ static int sd_start(struct gspca_dev *gspca_dev) case SENSOR_HV7131R: GammaT = hv7131r_gamma; MatrixT = hv7131r_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, hv7131r_initQVGA_data); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, hv7131r_initVGA_data); - } + if (mode) + init = hv7131r_initQVGA_data; /* 320x240 */ + else + init = hv7131r_initVGA_data; /* 640x480 */ break; case SENSOR_OV7660: GammaT = ov7660_gamma; MatrixT = ov7660_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, ov7660_initQVGA_data); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, ov7660_initVGA_data); - } + if (mode) + init = ov7660_initQVGA_data; /* 320x240 */ + else + init = ov7660_initVGA_data; /* 640x480 */ break; case SENSOR_OV7670: /*GammaT = ov7660_gamma; */ /*MatrixT = ov7660_matrix; */ - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, ov7670_initQVGA_JPG); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, ov7670_initVGA_JPG); - } + if (mode) + init = ov7670_initQVGA_JPG; /* 320x240 */ + else + init = ov7670_initVGA_JPG; /* 640x480 */ break; case SENSOR_MI0360: GammaT = mi1320_gamma; MatrixT = mi0360_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, mi0360_initQVGA_JPG); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, mi0360_initVGA_JPG); - } + if (mode) + init = mi0360_initQVGA_JPG; /* 320x240 */ + else + init = mi0360_initVGA_JPG; /* 640x480 */ break; case SENSOR_MI1310_SOC: GammaT = mi1320_gamma; MatrixT = mi0360_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, mi1310_socinitQVGA_JPG); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, mi1310_socinitVGA_JPG); + switch (mode) { + case 1: + init = mi1310_socinitQVGA_JPG; /* 320x240 */ + break; + case 0: + init = mi1310_socinitVGA_JPG; /* 640x480 */ + break; + default: + init = mi1310_soc_InitSXGA_JPG; /* 1280xq024 */ + break; } break; case SENSOR_MI1320: GammaT = mi1320_gamma; MatrixT = mi1320_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, mi1320_initQVGA_data); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, mi1320_initVGA_data); - } + if (mode) + init = mi1320_initQVGA_data; /* 320x240 */ + else + init = mi1320_initVGA_data; /* 640x480 */ break; case SENSOR_PO3130NC: GammaT = po3130_gamma; MatrixT = po3130_matrix; - if (mode) { - /* 320x240 */ - usb_exchange(gspca_dev, po3130_initQVGA_data); - } else { - /* 640x480 */ - usb_exchange(gspca_dev, po3130_initVGA_data); - } - usb_exchange(gspca_dev, po3130_rundata); + if (mode) + init = po3130_initQVGA_data; /* 320x240 */ + else + init = po3130_initVGA_data; /* 640x480 */ + usb_exchange(gspca_dev, init); + init = po3130_rundata; break; - case SENSOR_PO1200: + default: +/* case SENSOR_PO1200: */ GammaT = po1200_gamma; MatrixT = po1200_matrix; - usb_exchange(gspca_dev, po1200_initVGA_data); + init = po1200_initVGA_data; break; - default: - PDEBUG(D_PROBE, "Damned !! no sensor found Bye"); - return -EMEDIUMTYPE; } + usb_exchange(gspca_dev, init); if (GammaT && MatrixT) { put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a); put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b); put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c); put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c); - /* Seem SHARPNESS */ /* reg_w(gspca_dev->dev, 0xa0, 0x80, 0xb80a); -- 2.39.5