aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/gspca/vc032x.c213
1 files 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[] = {
149 .sizeimage = 640 * 480 * 3 / 8 + 590, 149 .sizeimage = 640 * 480 * 3 / 8 + 590,
150 .colorspace = V4L2_COLORSPACE_JPEG, 150 .colorspace = V4L2_COLORSPACE_JPEG,
151 .priv = 0}, 151 .priv = 0},
152 {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, /* mi1310_soc only */
153 .bytesperline = 1280,
154 .sizeimage = 1280 * 1024 * 1 / 4 + 590,
155 .colorspace = V4L2_COLORSPACE_JPEG,
156 .priv = 2},
152}; 157};
153 158
154static const struct v4l2_pix_format svga_mode[] = { 159static const struct v4l2_pix_format svga_mode[] = {
@@ -623,6 +628,113 @@ static const __u8 mi1310_socinitQVGA_JPG[][4] = {
623 {0xb8, 0xa0, 0x12, 0xcc}, 628 {0xb8, 0xa0, 0x12, 0xcc},
624 {}, 629 {},
625}; 630};
631static const u8 mi1310_soc_InitSXGA_JPG[][4] = {
632 {0xb0, 0x03, 0x19, 0xcc},
633 {0xb0, 0x04, 0x02, 0xcc},
634 {0xb3, 0x00, 0x24, 0xcc},
635 {0xb3, 0x00, 0x25, 0xcc},
636 {0xb3, 0x05, 0x00, 0xcc},
637 {0xb3, 0x06, 0x01, 0xcc},
638 {0xb3, 0x5c, 0x01, 0xcc},
639 {0xb3, 0x08, 0x01, 0xcc},
640 {0xb3, 0x09, 0x0c, 0xcc},
641 {0xb3, 0x34, 0x02, 0xcc},
642 {0xb3, 0x35, 0xdd, 0xcc},
643 {0xb3, 0x03, 0x0a, 0xcc},
644 {0xb3, 0x04, 0x0d, 0xcc},
645 {0xb3, 0x20, 0x00, 0xcc},
646 {0xb3, 0x21, 0x00, 0xcc},
647 {0xb3, 0x22, 0x04, 0xcc},
648 {0xb3, 0x23, 0x00, 0xcc},
649 {0xb3, 0x14, 0x00, 0xcc},
650 {0xb3, 0x15, 0x00, 0xcc},
651 {0xb3, 0x16, 0x04, 0xcc},
652 {0xb3, 0x17, 0xff, 0xcc},
653 {0xb8, 0x01, 0x7d, 0xcc},
654 {0xb8, 0x81, 0x09, 0xcc},
655 {0xb8, 0x27, 0x20, 0xcc},
656 {0xb8, 0x26, 0x80, 0xcc},
657 {0xb8, 0x06, 0x00, 0xcc},
658 {0xb8, 0x07, 0x05, 0xcc},
659 {0xb8, 0x08, 0x00, 0xcc},
660 {0xb8, 0x09, 0x04, 0xcc},
661 {0xb3, 0x00, 0x25, 0xcc},
662 {0xb8, 0x00, 0x11, 0xcc},
663 {0xbc, 0x00, 0x71, 0xcc},
664 {0xb8, 0x81, 0x01, 0xcc},
665 {0xb8, 0x2c, 0x5a, 0xcc},
666 {0xb8, 0x2d, 0xff, 0xcc},
667 {0xb8, 0x2e, 0xee, 0xcc},
668 {0xb8, 0x2f, 0xfb, 0xcc},
669 {0xb8, 0x30, 0x52, 0xcc},
670 {0xb8, 0x31, 0xf8, 0xcc},
671 {0xb8, 0x32, 0xf1, 0xcc},
672 {0xb8, 0x33, 0xff, 0xcc},
673 {0xb8, 0x34, 0x54, 0xcc},
674 {0xf0, 0x00, 0x00, 0xbb},
675 {0x00, 0x01, 0x00, 0xdd},
676 {0x0d, 0x00, 0x09, 0xbb},
677 {0x0d, 0x00, 0x08, 0xbb},
678 {0xf0, 0x00, 0x01, 0xbb},
679 {0x00, 0x01, 0x00, 0xdd},
680 {0x06, 0x00, 0x14, 0xbb},
681 {0x3a, 0x10, 0x00, 0xbb},
682 {0x00, 0x00, 0x10, 0xdd},
683 {0x9b, 0x10, 0x00, 0xbb},
684 {0x00, 0x00, 0x10, 0xdd},
685 {0xf0, 0x00, 0x00, 0xbb},
686 {0x00, 0x01, 0x00, 0xdd},
687 {0x2b, 0x00, 0x28, 0xbb},
688 {0x2c, 0x00, 0x30, 0xbb},
689 {0x2d, 0x00, 0x30, 0xbb},
690 {0x2e, 0x00, 0x28, 0xbb},
691 {0x41, 0x00, 0xd7, 0xbb},
692 {0x09, 0x02, 0x3a, 0xbb},
693 {0x0c, 0x00, 0x00, 0xbb},
694 {0x20, 0x00, 0x00, 0xbb},
695 {0x05, 0x00, 0x8c, 0xbb},
696 {0x06, 0x00, 0x32, 0xbb},
697 {0x07, 0x00, 0xc6, 0xbb},
698 {0x08, 0x00, 0x19, 0xbb},
699 {0x24, 0x80, 0x6f, 0xbb},
700 {0xc8, 0x00, 0x0f, 0xbb},
701 {0x20, 0x00, 0x03, 0xbb},
702 {0xb6, 0x00, 0x00, 0xcc},
703 {0xb6, 0x03, 0x05, 0xcc},
704 {0xb6, 0x02, 0x00, 0xcc},
705 {0xb6, 0x05, 0x04, 0xcc},
706 {0xb6, 0x04, 0x00, 0xcc},
707 {0xb6, 0x12, 0xf8, 0xcc},
708 {0xb6, 0x18, 0x0a, 0xcc},
709 {0xb6, 0x17, 0x00, 0xcc},
710 {0xb6, 0x16, 0x00, 0xcc},
711 {0xb6, 0x22, 0x12, 0xcc},
712 {0xb6, 0x23, 0x0b, 0xcc},
713 {0xb3, 0x02, 0x02, 0xcc},
714 {0xbf, 0xc0, 0x39, 0xcc},
715 {0xbf, 0xc1, 0x04, 0xcc},
716 {0xbf, 0xcc, 0x10, 0xcc},
717 {0xb9, 0x12, 0x00, 0xcc},
718 {0xb9, 0x13, 0x14, 0xcc},
719 {0xb9, 0x14, 0x14, 0xcc},
720 {0xb9, 0x15, 0x14, 0xcc},
721 {0xb9, 0x16, 0x14, 0xcc},
722 {0xb9, 0x18, 0x00, 0xcc},
723 {0xb9, 0x19, 0x1e, 0xcc},
724 {0xb9, 0x1a, 0x1e, 0xcc},
725 {0xb9, 0x1b, 0x1e, 0xcc},
726 {0xb9, 0x1c, 0x1e, 0xcc},
727 {0xb3, 0x01, 0x41, 0xcc},
728 {0xb8, 0x8e, 0x00, 0xcc},
729 {0xb8, 0x8f, 0xff, 0xcc},
730 {0xb6, 0x12, 0xf8, 0xcc},
731 {0xb8, 0x0c, 0x20, 0xcc},
732 {0xb8, 0x0d, 0x70, 0xcc},
733 {0xb6, 0x13, 0x13, 0xcc},
734 {0x2f, 0x00, 0xC0, 0xbb},
735 {0xb8, 0xa0, 0x12, 0xcc},
736 {}
737};
626 738
627static const __u8 mi1320_gamma[17] = { 739static const __u8 mi1320_gamma[17] = {
628 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, 740 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
@@ -2022,7 +2134,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
2022 } else { 2134 } else {
2023 if (sensor != SENSOR_PO1200) { 2135 if (sensor != SENSOR_PO1200) {
2024 cam->cam_mode = vc0323_mode; 2136 cam->cam_mode = vc0323_mode;
2025 cam->nmodes = ARRAY_SIZE(vc0323_mode); 2137 if (sd->sensor != SENSOR_MI1310_SOC)
2138 cam->nmodes = ARRAY_SIZE(vc0323_mode);
2139 else /* no SXGA */
2140 cam->nmodes = ARRAY_SIZE(vc0323_mode) - 1;
2026 } else { 2141 } else {
2027 cam->cam_mode = svga_mode; 2142 cam->cam_mode = svga_mode;
2028 cam->nmodes = ARRAY_SIZE(svga_mode); 2143 cam->nmodes = ARRAY_SIZE(svga_mode);
@@ -2124,6 +2239,7 @@ static void setsharpness(struct gspca_dev *gspca_dev)
2124static int sd_start(struct gspca_dev *gspca_dev) 2239static int sd_start(struct gspca_dev *gspca_dev)
2125{ 2240{
2126 struct sd *sd = (struct sd *) gspca_dev; 2241 struct sd *sd = (struct sd *) gspca_dev;
2242 const __u8 (*init)[4];
2127 const __u8 *GammaT = NULL; 2243 const __u8 *GammaT = NULL;
2128 const __u8 *MatrixT = NULL; 2244 const __u8 *MatrixT = NULL;
2129 int mode; 2245 int mode;
@@ -2141,96 +2257,81 @@ static int sd_start(struct gspca_dev *gspca_dev)
2141 case SENSOR_HV7131R: 2257 case SENSOR_HV7131R:
2142 GammaT = hv7131r_gamma; 2258 GammaT = hv7131r_gamma;
2143 MatrixT = hv7131r_matrix; 2259 MatrixT = hv7131r_matrix;
2144 if (mode) { 2260 if (mode)
2145 /* 320x240 */ 2261 init = hv7131r_initQVGA_data; /* 320x240 */
2146 usb_exchange(gspca_dev, hv7131r_initQVGA_data); 2262 else
2147 } else { 2263 init = hv7131r_initVGA_data; /* 640x480 */
2148 /* 640x480 */
2149 usb_exchange(gspca_dev, hv7131r_initVGA_data);
2150 }
2151 break; 2264 break;
2152 case SENSOR_OV7660: 2265 case SENSOR_OV7660:
2153 GammaT = ov7660_gamma; 2266 GammaT = ov7660_gamma;
2154 MatrixT = ov7660_matrix; 2267 MatrixT = ov7660_matrix;
2155 if (mode) { 2268 if (mode)
2156 /* 320x240 */ 2269 init = ov7660_initQVGA_data; /* 320x240 */
2157 usb_exchange(gspca_dev, ov7660_initQVGA_data); 2270 else
2158 } else { 2271 init = ov7660_initVGA_data; /* 640x480 */
2159 /* 640x480 */
2160 usb_exchange(gspca_dev, ov7660_initVGA_data);
2161 }
2162 break; 2272 break;
2163 case SENSOR_OV7670: 2273 case SENSOR_OV7670:
2164 /*GammaT = ov7660_gamma; */ 2274 /*GammaT = ov7660_gamma; */
2165 /*MatrixT = ov7660_matrix; */ 2275 /*MatrixT = ov7660_matrix; */
2166 if (mode) { 2276 if (mode)
2167 /* 320x240 */ 2277 init = ov7670_initQVGA_JPG; /* 320x240 */
2168 usb_exchange(gspca_dev, ov7670_initQVGA_JPG); 2278 else
2169 } else { 2279 init = ov7670_initVGA_JPG; /* 640x480 */
2170 /* 640x480 */
2171 usb_exchange(gspca_dev, ov7670_initVGA_JPG);
2172 }
2173 break; 2280 break;
2174 case SENSOR_MI0360: 2281 case SENSOR_MI0360:
2175 GammaT = mi1320_gamma; 2282 GammaT = mi1320_gamma;
2176 MatrixT = mi0360_matrix; 2283 MatrixT = mi0360_matrix;
2177 if (mode) { 2284 if (mode)
2178 /* 320x240 */ 2285 init = mi0360_initQVGA_JPG; /* 320x240 */
2179 usb_exchange(gspca_dev, mi0360_initQVGA_JPG); 2286 else
2180 } else { 2287 init = mi0360_initVGA_JPG; /* 640x480 */
2181 /* 640x480 */
2182 usb_exchange(gspca_dev, mi0360_initVGA_JPG);
2183 }
2184 break; 2288 break;
2185 case SENSOR_MI1310_SOC: 2289 case SENSOR_MI1310_SOC:
2186 GammaT = mi1320_gamma; 2290 GammaT = mi1320_gamma;
2187 MatrixT = mi0360_matrix; 2291 MatrixT = mi0360_matrix;
2188 if (mode) { 2292 switch (mode) {
2189 /* 320x240 */ 2293 case 1:
2190 usb_exchange(gspca_dev, mi1310_socinitQVGA_JPG); 2294 init = mi1310_socinitQVGA_JPG; /* 320x240 */
2191 } else { 2295 break;
2192 /* 640x480 */ 2296 case 0:
2193 usb_exchange(gspca_dev, mi1310_socinitVGA_JPG); 2297 init = mi1310_socinitVGA_JPG; /* 640x480 */
2298 break;
2299 default:
2300 init = mi1310_soc_InitSXGA_JPG; /* 1280xq024 */
2301 break;
2194 } 2302 }
2195 break; 2303 break;
2196 case SENSOR_MI1320: 2304 case SENSOR_MI1320:
2197 GammaT = mi1320_gamma; 2305 GammaT = mi1320_gamma;
2198 MatrixT = mi1320_matrix; 2306 MatrixT = mi1320_matrix;
2199 if (mode) { 2307 if (mode)
2200 /* 320x240 */ 2308 init = mi1320_initQVGA_data; /* 320x240 */
2201 usb_exchange(gspca_dev, mi1320_initQVGA_data); 2309 else
2202 } else { 2310 init = mi1320_initVGA_data; /* 640x480 */
2203 /* 640x480 */
2204 usb_exchange(gspca_dev, mi1320_initVGA_data);
2205 }
2206 break; 2311 break;
2207 case SENSOR_PO3130NC: 2312 case SENSOR_PO3130NC:
2208 GammaT = po3130_gamma; 2313 GammaT = po3130_gamma;
2209 MatrixT = po3130_matrix; 2314 MatrixT = po3130_matrix;
2210 if (mode) { 2315 if (mode)
2211 /* 320x240 */ 2316 init = po3130_initQVGA_data; /* 320x240 */
2212 usb_exchange(gspca_dev, po3130_initQVGA_data); 2317 else
2213 } else { 2318 init = po3130_initVGA_data; /* 640x480 */
2214 /* 640x480 */ 2319 usb_exchange(gspca_dev, init);
2215 usb_exchange(gspca_dev, po3130_initVGA_data); 2320 init = po3130_rundata;
2216 }
2217 usb_exchange(gspca_dev, po3130_rundata);
2218 break; 2321 break;
2219 case SENSOR_PO1200: 2322 default:
2323/* case SENSOR_PO1200: */
2220 GammaT = po1200_gamma; 2324 GammaT = po1200_gamma;
2221 MatrixT = po1200_matrix; 2325 MatrixT = po1200_matrix;
2222 usb_exchange(gspca_dev, po1200_initVGA_data); 2326 init = po1200_initVGA_data;
2223 break; 2327 break;
2224 default:
2225 PDEBUG(D_PROBE, "Damned !! no sensor found Bye");
2226 return -EMEDIUMTYPE;
2227 } 2328 }
2329 usb_exchange(gspca_dev, init);
2228 if (GammaT && MatrixT) { 2330 if (GammaT && MatrixT) {
2229 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a); 2331 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
2230 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b); 2332 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb85b);
2231 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c); 2333 put_tab_to_reg(gspca_dev, GammaT, 17, 0xb86c);
2232 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c); 2334 put_tab_to_reg(gspca_dev, MatrixT, 9, 0xb82c);
2233
2234 /* Seem SHARPNESS */ 2335 /* Seem SHARPNESS */
2235 /* 2336 /*
2236 reg_w(gspca_dev->dev, 0xa0, 0x80, 0xb80a); 2337 reg_w(gspca_dev->dev, 0xa0, 0x80, 0xb80a);