50 #define MODULE_NAME "sonixb"
52 #include <linux/input.h>
55 MODULE_AUTHOR(
"Jean-François Moine <http://moinejf.free.fr>");
81 #define SENSOR_HV7131D 0
82 #define SENSOR_HV7131R 1
83 #define SENSOR_OV6650 2
84 #define SENSOR_OV7630 3
85 #define SENSOR_PAS106 4
86 #define SENSOR_PAS202 5
87 #define SENSOR_TAS5110C 6
88 #define SENSOR_TAS5110D 7
89 #define SENSOR_TAS5130CXX 8
107 #define MODE_RAW 0x10
108 #define MODE_REDUCED_SIF 0x20
113 #define MCK_INIT 0x63
114 #define MCK_INIT1 0x20
118 #define SENS(bridge, sensor, _flags, _sensor_addr) \
120 .bridge_init = bridge, \
121 .sensor_init = sensor, \
122 .sensor_init_size = sizeof(sensor), \
123 .flags = _flags, .sensor_addr = _sensor_addr \
130 #define AUTOGAIN_IGNORE_FRAMES 1
135 .sizeimage = 160 * 120,
140 .sizeimage = 160 * 120 * 5 / 4,
145 .sizeimage = 320 * 240 * 5 / 4,
150 .sizeimage = 640 * 480 * 5 / 4,
157 .sizeimage = 160 * 120,
162 .sizeimage = 160 * 120 * 5 / 4,
167 .sizeimage = 176 * 144,
172 .sizeimage = 176 * 144 * 5 / 4,
177 .sizeimage = 320 * 240 * 5 / 4,
182 .sizeimage = 352 * 288 * 5 / 4,
187 static const __u8 initHv7131d[] = {
188 0x04, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00,
190 0x00, 0x00, 0x00, 0x02, 0x02, 0x00,
191 0x28, 0x1e, 0x60, 0x8e, 0x42,
193 static const __u8 hv7131d_sensor_init[][8] = {
194 {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17},
195 {0xa0, 0x11, 0x02, 0x00, 0x00, 0x00, 0x00, 0x17},
196 {0xa0, 0x11, 0x28, 0x00, 0x00, 0x00, 0x00, 0x17},
197 {0xa0, 0x11, 0x30, 0x30, 0x00, 0x00, 0x00, 0x17},
198 {0xa0, 0x11, 0x34, 0x02, 0x00, 0x00, 0x00, 0x17},
201 static const __u8 initHv7131r[] = {
202 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00,
204 0x00, 0x00, 0x00, 0x02, 0x01, 0x00,
205 0x28, 0x1e, 0x60, 0x8a, 0x20,
207 static const __u8 hv7131r_sensor_init[][8] = {
208 {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10},
209 {0xa0, 0x11, 0x01, 0x08, 0x2a, 0x2e, 0x00, 0x10},
210 {0xb0, 0x11, 0x20, 0x00, 0xd0, 0x2e, 0x00, 0x10},
211 {0xc0, 0x11, 0x25, 0x03, 0x0e, 0x28, 0x00, 0x16},
212 {0xa0, 0x11, 0x30, 0x10, 0x0e, 0x28, 0x00, 0x15},
214 static const __u8 initOv6650[] = {
215 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
216 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b,
220 static const __u8 ov6650_sensor_init[][8] = {
226 {0xa0, 0x60, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
228 {0xd0, 0x60, 0x11, 0xc0, 0x1b, 0x18, 0xc1, 0x10},
230 {0xb0, 0x60, 0x15, 0x00, 0x02, 0x18, 0xc1, 0x10},
235 {0xd0, 0x60, 0x26, 0x01, 0x14, 0xd8, 0xa4, 0x10},
236 {0xd0, 0x60, 0x26, 0x01, 0x14, 0xd8, 0xa4, 0x10},
237 {0xa0, 0x60, 0x30, 0x3d, 0x0a, 0xd8, 0xa4, 0x10},
239 {0xa0, 0x60, 0x61, 0x08, 0x00, 0x00, 0x00, 0x10},
248 {0xa0, 0x60, 0x68, 0x04, 0x68, 0xd8, 0xa4, 0x10},
249 {0xd0, 0x60, 0x17, 0x24, 0xd6, 0x04, 0x94, 0x10},
252 static const __u8 initOv7630[] = {
253 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
254 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255 0x00, 0x01, 0x01, 0x0a,
259 static const __u8 ov7630_sensor_init[][8] = {
260 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
261 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
263 {0xd0, 0x21, 0x12, 0x5c, 0x00, 0x80, 0x34, 0x10},
264 {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10},
265 {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10},
266 {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10},
267 {0xd0, 0x21, 0x26, 0xa0, 0x9a, 0xa0, 0x30, 0x10},
268 {0xb0, 0x21, 0x2a, 0x80, 0x00, 0xa0, 0x30, 0x10},
269 {0xb0, 0x21, 0x2f, 0x3d, 0x24, 0xa0, 0x30, 0x10},
270 {0xa0, 0x21, 0x32, 0x86, 0x24, 0xa0, 0x30, 0x10},
271 {0xb0, 0x21, 0x60, 0xa9, 0x4a, 0xa0, 0x30, 0x10},
273 {0xa0, 0x21, 0x65, 0x00, 0x42, 0xa0, 0x30, 0x10},
274 {0xa0, 0x21, 0x69, 0x38, 0x42, 0xa0, 0x30, 0x10},
275 {0xc0, 0x21, 0x6f, 0x88, 0x0b, 0x00, 0x30, 0x10},
276 {0xc0, 0x21, 0x74, 0x21, 0x8e, 0x00, 0x30, 0x10},
277 {0xa0, 0x21, 0x7d, 0xf7, 0x8e, 0x00, 0x30, 0x10},
278 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10},
281 static const __u8 initPas106[] = {
282 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x04, 0x01, 0x00,
312 static const __u8 pas106_sensor_init[][8] = {
314 { 0xa1, 0x40, 0x02, 0x04, 0x00, 0x00, 0x00, 0x14 },
316 { 0xa1, 0x40, 0x03, 0x13, 0x00, 0x00, 0x00, 0x14 },
318 { 0xa1, 0x40, 0x04, 0x06, 0x00, 0x00, 0x00, 0x14 },
320 { 0xa1, 0x40, 0x05, 0x65, 0x00, 0x00, 0x00, 0x14 },
322 { 0xa1, 0x40, 0x06, 0xcd, 0x00, 0x00, 0x00, 0x14 },
324 { 0xa1, 0x40, 0x07, 0xc1, 0x00, 0x00, 0x00, 0x14 },
326 { 0xa1, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0x14 },
327 { 0xa1, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0x14 },
329 { 0xa1, 0x40, 0x09, 0x05, 0x00, 0x00, 0x00, 0x14 },
331 { 0xa1, 0x40, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x14 },
333 { 0xa1, 0x40, 0x0b, 0x04, 0x00, 0x00, 0x00, 0x14 },
335 { 0xa1, 0x40, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x14 },
337 { 0xa1, 0x40, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x14 },
339 { 0xa1, 0x40, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x14 },
341 { 0xa1, 0x40, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x14 },
343 { 0xa1, 0x40, 0x10, 0x06, 0x00, 0x00, 0x00, 0x14 },
345 { 0xa1, 0x40, 0x11, 0x06, 0x00, 0x00, 0x00, 0x14 },
347 { 0xa1, 0x40, 0x12, 0x06, 0x00, 0x00, 0x00, 0x14 },
349 { 0xa1, 0x40, 0x14, 0x02, 0x00, 0x00, 0x00, 0x14 },
351 { 0xa1, 0x40, 0x13, 0x01, 0x00, 0x00, 0x00, 0x14 },
354 static const __u8 initPas202[] = {
355 0x44, 0x44, 0x21, 0x30, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a,
358 0x28, 0x1e, 0x20, 0x89, 0x20,
378 static const __u8 pas202_sensor_init[][8] = {
382 {0xa0, 0x40, 0x02, 0x04, 0x00, 0x00, 0x00, 0x10},
383 {0xd0, 0x40, 0x04, 0x07, 0x34, 0x00, 0x09, 0x10},
384 {0xd0, 0x40, 0x08, 0x01, 0x00, 0x00, 0x01, 0x10},
385 {0xd0, 0x40, 0x0c, 0x00, 0x0c, 0x01, 0x32, 0x10},
386 {0xd0, 0x40, 0x10, 0x00, 0x01, 0x00, 0x63, 0x10},
387 {0xa0, 0x40, 0x15, 0x70, 0x01, 0x00, 0x63, 0x10},
388 {0xa0, 0x40, 0x18, 0x00, 0x01, 0x00, 0x63, 0x10},
389 {0xa0, 0x40, 0x11, 0x01, 0x01, 0x00, 0x63, 0x10},
390 {0xa0, 0x40, 0x03, 0x56, 0x01, 0x00, 0x63, 0x10},
391 {0xa0, 0x40, 0x11, 0x01, 0x01, 0x00, 0x63, 0x10},
394 static const __u8 initTas5110c[] = {
395 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a,
398 0x16, 0x12, 0x60, 0x86, 0x2b,
401 static const __u8 initTas5110d[] = {
402 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
404 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a,
405 0x16, 0x12, 0x60, 0x86, 0x2b,
408 static const __u8 tas5110c_sensor_init[][8] = {
409 {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10},
410 {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10},
417 static const __u8 tas5110d_sensor_init[][8] = {
418 {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17},
421 static const __u8 initTas5130[] = {
422 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
424 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a,
427 static const __u8 tas5130_sensor_init[][8] = {
430 {0x30, 0x11, 0x00, 0x40, 0x01, 0x00, 0x00, 0x10},
432 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10},
436 SENS(initHv7131d, hv7131d_sensor_init, 0, 0),
437 SENS(initHv7131r, hv7131r_sensor_init, 0, 0),
438 SENS(initOv6650, ov6650_sensor_init,
F_SIF, 0x60),
439 SENS(initOv7630, ov7630_sensor_init, 0, 0x21),
440 SENS(initPas106, pas106_sensor_init,
F_SIF, 0),
441 SENS(initPas202, pas202_sensor_init, 0, 0),
442 SENS(initTas5110c, tas5110c_sensor_init,
F_SIF, 0),
443 SENS(initTas5110d, tas5110d_sensor_init,
F_SIF, 0),
444 SENS(initTas5130, tas5130_sensor_init, 0, 0),
457 usb_rcvctrlpipe(gspca_dev->
dev, 0),
467 "Error reading register %02x: %d\n", value, res);
472 static void reg_w(
struct gspca_dev *gspca_dev,
484 usb_sndctrlpipe(gspca_dev->
dev, 0),
494 "Error writing register %02x: %d\n", value, res);
499 static void i2c_w(
struct gspca_dev *gspca_dev,
const __u8 *buffer)
507 reg_w(gspca_dev, 0x08, buffer, 8);
512 reg_r(gspca_dev, 0x08);
513 if (gspca_dev->
usb_buf[0] & 0x04) {
514 if (gspca_dev->
usb_buf[0] & 0x08) {
516 "i2c write error\n");
527 static void i2c_w_vector(
struct gspca_dev *gspca_dev,
528 const __u8 buffer[][8],
int len)
533 reg_w(gspca_dev, 0x08, *buffer, 8);
541 static void setbrightness(
struct gspca_dev *gspca_dev)
543 struct sd *
sd = (
struct sd *) gspca_dev;
549 {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10};
554 i2c_w(gspca_dev, i2cOV);
560 {0xb0, 0x40, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x16};
562 {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
572 i2cpbright[3] = 0x01;
578 i2c_w(gspca_dev, i2cpbright);
579 i2c_w(gspca_dev, i2cpdoit);
587 static void setgain(
struct gspca_dev *gspca_dev)
589 struct sd *sd = (
struct sd *) gspca_dev;
595 {0xc0, 0x11, 0x31, 0x00, 0x00, 0x00, 0x00, 0x17};
597 i2c[3] = 0x3f -
gain;
598 i2c[4] = 0x3f -
gain;
599 i2c[5] = 0x3f -
gain;
601 i2c_w(gspca_dev, i2c);
607 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
610 i2c_w(gspca_dev, i2c);
615 0xb0, 0x61, 0x02, 0x00, 0x10, 0x00, 0x00, 0x17 };
618 i2c[3] |= (gain & 0x80) >> 7;
619 i2c[3] |= (gain & 0x40) >> 5;
620 i2c[3] |= (gain & 0x20) >> 3;
621 i2c[3] |= (gain & 0x10) >> 1;
622 i2c[3] |= (gain & 0x08) << 1;
623 i2c[3] |= (gain & 0x04) << 3;
624 i2c[3] |= (gain & 0x02) << 5;
625 i2c[3] |= (gain & 0x01) << 7;
626 i2c_w(gspca_dev, i2c);
631 __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10};
642 i2c_w(gspca_dev, i2c);
648 {0xa0, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x15};
649 __u8 i2cpcolorgain[] =
650 {0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x15};
652 {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
657 i2cpcolorgain[0] = 0xd0;
658 i2cpcolorgain[2] = 0x09;
663 i2cpcolorgain[3] = gain >> 1;
664 i2cpcolorgain[4] = gain >> 1;
665 i2cpcolorgain[5] = gain >> 1;
666 i2cpcolorgain[6] = gain >> 1;
668 i2c_w(gspca_dev, i2cpgain);
669 i2c_w(gspca_dev, i2cpcolorgain);
670 i2c_w(gspca_dev, i2cpdoit);
676 reg_w(gspca_dev, 0x05, buf, 3);
679 buf[0] = gain << 4 |
gain;
681 reg_w(gspca_dev, 0x10, buf, 2);
686 static void setexposure(
struct gspca_dev *gspca_dev)
688 struct sd *sd = (
struct sd *) gspca_dev;
694 __u8 i2c[] = {0xc0, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x17};
699 i2c_w(gspca_dev, i2c);
709 reg = (reg << 4) | 0x0b;
710 reg_w(gspca_dev, 0x19, ®, 1);
729 __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10};
730 int reg10,
reg11, reg10_max;
744 reg11 = (15 * gspca_dev->
exposure->val + 999) / 1000;
753 if (gspca_dev->
width == 640 && reg11 < 4)
759 reg10 = (gspca_dev->
exposure->val * 15 * reg10_max)
766 if (gspca_dev->
autogain->val && reg10 < 10)
768 else if (reg10 > reg10_max)
777 if (sd->
reg11 == reg11)
780 i2c_w(gspca_dev, i2c);
786 __u8 i2cpframerate[] =
787 {0xb0, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x16};
789 {0xa0, 0x40, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x16};
790 const __u8 i2cpdoit[] =
791 {0xa0, 0x40, 0x11, 0x01, 0x00, 0x00, 0x00, 0x16};
804 if (gspca_dev->
exposure->val < 200) {
805 i2cpexpo[3] = 255 - (gspca_dev->
exposure->val * 255)
807 framerate_ctrl = 500;
812 framerate_ctrl = (gspca_dev->
exposure->val - 200)
816 i2cpframerate[3] = framerate_ctrl >> 6;
817 i2cpframerate[4] = framerate_ctrl & 0x3f;
818 i2c_w(gspca_dev, i2cpframerate);
819 i2c_w(gspca_dev, i2cpexpo);
820 i2c_w(gspca_dev, i2cpdoit);
824 __u8 i2cpframerate[] =
825 {0xb1, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x14};
827 {0xa1, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x14};
828 const __u8 i2cpdoit[] =
829 {0xa1, 0x40, 0x13, 0x01, 0x00, 0x00, 0x00, 0x14};
834 if (gspca_dev->
exposure->val < 150) {
835 i2cpexpo[3] = 150 - gspca_dev->
exposure->val;
836 framerate_ctrl = 300;
841 framerate_ctrl = (gspca_dev->
exposure->val - 150)
845 i2cpframerate[3] = framerate_ctrl >> 4;
846 i2cpframerate[4] = framerate_ctrl & 0x0f;
847 i2c_w(gspca_dev, i2cpframerate);
848 i2c_w(gspca_dev, i2cpexpo);
849 i2c_w(gspca_dev, i2cpdoit);
857 static void setfreq(
struct gspca_dev *gspca_dev)
859 struct sd *sd = (
struct sd *) gspca_dev;
866 __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10};
867 switch (sd->
plfreq->val) {
879 i2c_w(gspca_dev, i2c);
883 static void do_autogain(
struct gspca_dev *gspca_dev)
885 struct sd *sd = (
struct sd *) gspca_dev;
886 int deadzone, desired_avg_lum,
avg_lum;
902 desired_avg_lum = 5000;
905 desired_avg_lum = 13000;
909 desired_avg_lum = sd->
brightness->val * desired_avg_lum / 127;
911 if (gspca_dev->
exposure->maximum < 500) {
913 desired_avg_lum, deadzone))
916 int gain_knee = gspca_dev->
gain->maximum * 9 / 10;
924 static int sd_config(
struct gspca_dev *gspca_dev,
927 struct sd *sd = (
struct sd *) gspca_dev;
930 reg_r(gspca_dev, 0x00);
931 if (gspca_dev->
usb_buf[0] != 0x10)
935 sd->
sensor =
id->driver_info >> 8;
936 sd->
bridge =
id->driver_info & 0xff;
938 cam = &gspca_dev->
cam;
952 static int sd_init(
struct gspca_dev *gspca_dev)
956 reg_w(gspca_dev, 0x01, &stop, 1);
963 struct gspca_dev *gspca_dev =
965 struct sd *sd = (
struct sd *)gspca_dev;
974 gspca_dev->
gain->val = gspca_dev->
gain->default_value;
984 setbrightness(gspca_dev);
988 setexposure(gspca_dev);
1002 .s_ctrl = sd_s_ctrl,
1006 static int sd_init_controls(
struct gspca_dev *gspca_dev)
1008 struct sd *sd = (
struct sd *) gspca_dev;
1011 gspca_dev->
vdev.ctrl_handler = hdl;
1085 pr_err(
"Could not initialize controls\n");
1096 static int sd_start(
struct gspca_dev *gspca_dev)
1098 struct sd *sd = (
struct sd *) gspca_dev;
1099 struct cam *cam = &gspca_dev->
cam;
1107 regs[0x18] |= mode << 4;
1137 for (i = 0; i < 16; i++)
1138 regs[0x20 + i] = i * 16;
1139 regs[0x20 +
i] = 255;
1148 regs[0x19] = mode ? 0x23 : 0x43;
1162 regs[0x18] &= ~0x80;
1168 regs[0x15] = 320 / 16;
1169 regs[0x16] = 240 / 16;
1173 reg_w(gspca_dev, 0x01, ®s[0x01], 1);
1175 reg_w(gspca_dev, 0x17, ®s[0x17], 1);
1177 reg_w(gspca_dev, 0x01, ®s[0x01],
1187 const __u8 i2cpclockdiv[] =
1188 {0xa0, 0x40, 0x02, 0x03, 0x00, 0x00, 0x00, 0x10};
1191 i2c_w(gspca_dev, i2cpclockdiv);
1198 const __u8 i2c[] = { 0xa0, 0x21, 0x13,
1199 0x80, 0x00, 0x00, 0x00, 0x10 };
1200 i2c_w(gspca_dev, i2c);
1205 reg_w(gspca_dev, 0x15, ®s[0x15], 2);
1207 reg_w(gspca_dev, 0x18, ®s[0x18], 1);
1209 reg_w(gspca_dev, 0x12, ®s[0x12], 1);
1211 reg_w(gspca_dev, 0x13, ®s[0x13], 1);
1214 reg_w(gspca_dev, 0x17, ®s[0x17], 1);
1216 reg_w(gspca_dev, 0x19, ®s[0x19], 1);
1218 reg_w(gspca_dev, 0x1c, ®s[0x1c], 4);
1220 reg_w(gspca_dev, 0x01, ®s[0x01], 1);
1222 reg_w(gspca_dev, 0x18, ®s[0x18], 2);
1228 setbrightness(gspca_dev);
1229 setexposure(gspca_dev);
1240 static void sd_stopN(
struct gspca_dev *gspca_dev)
1245 static u8* find_sof(
struct gspca_dev *gspca_dev,
u8 *
data,
int len)
1247 struct sd *sd = (
struct sd *) gspca_dev;
1259 for (i = 0; i < len; i++) {
1262 if (data[i] == 0xff)
1266 if (data[i] == 0xff)
1272 if (data[i] == 0x00)
1274 else if (data[i] != 0xff)
1278 if (data[i] == 0xc4)
1280 else if (data[i] == 0xff)
1286 if (data[i] == 0xc4)
1288 else if (data[i] == 0xff)
1294 if (data[i] == 0x96)
1296 else if (data[i] == 0xff)
1306 return data + i + 1;
1313 static void sd_pkt_scan(
struct gspca_dev *gspca_dev,
1317 int fr_h_sz = 0, lum_offset = 0, len_after_sof = 0;
1318 struct sd *sd = (
struct sd *) gspca_dev;
1319 struct cam *cam = &gspca_dev->
cam;
1322 sof = find_sof(gspca_dev, data, len);
1332 len_after_sof = len - (sof -
data);
1333 len = (sof -
data) - fr_h_sz;
1345 if (used + len > size)
1352 int lum = sd->
header[lum_offset] +
1353 (sd->
header[lum_offset + 1] << 8);
1379 static int sd_querymenu(
struct gspca_dev *gspca_dev,
1384 switch (menu->
index) {
1400 #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
1401 static int sd_int_pkt_scan(
struct gspca_dev *gspca_dev,
1407 if (len == 1 && data[0] == 1) {
1408 input_report_key(gspca_dev->input_dev,
KEY_CAMERA, 1);
1409 input_sync(gspca_dev->input_dev);
1410 input_report_key(gspca_dev->input_dev,
KEY_CAMERA, 0);
1411 input_sync(gspca_dev->input_dev);
1422 .config = sd_config,
1424 .init_controls = sd_init_controls,
1427 .pkt_scan = sd_pkt_scan,
1428 .querymenu = sd_querymenu,
1429 .dq_callback = do_autogain,
1430 #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
1431 .int_pkt_scan = sd_int_pkt_scan,
1436 #define SB(sensor, bridge) \
1437 .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge
1441 {USB_DEVICE(0x0c45, 0x6001),
SB(TAS5110C, 102)},
1442 {USB_DEVICE(0x0c45, 0x6005),
SB(TAS5110C, 101)},
1443 {USB_DEVICE(0x0c45, 0x6007),
SB(TAS5110D, 101)},
1444 {USB_DEVICE(0x0c45, 0x6009),
SB(PAS106, 101)},
1445 {USB_DEVICE(0x0c45, 0x600d),
SB(PAS106, 101)},
1446 {USB_DEVICE(0x0c45, 0x6011),
SB(OV6650, 101)},
1447 {USB_DEVICE(0x0c45, 0x6019),
SB(OV7630, 101)},
1448 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
1449 {USB_DEVICE(0x0c45, 0x6024),
SB(TAS5130CXX, 102)},
1450 {USB_DEVICE(0x0c45, 0x6025),
SB(TAS5130CXX, 102)},
1452 {USB_DEVICE(0x0c45, 0x6028),
SB(PAS202, 102)},
1453 {USB_DEVICE(0x0c45, 0x6029),
SB(PAS106, 102)},
1454 {USB_DEVICE(0x0c45, 0x602a),
SB(HV7131D, 102)},
1456 {USB_DEVICE(0x0c45, 0x602c),
SB(OV7630, 102)},
1457 {USB_DEVICE(0x0c45, 0x602d),
SB(HV7131R, 102)},
1458 {USB_DEVICE(0x0c45, 0x602e),
SB(OV7630, 102)},
1461 {USB_DEVICE(0x0c45, 0x6083),
SB(HV7131D, 103)},
1462 {USB_DEVICE(0x0c45, 0x608c),
SB(HV7131R, 103)},
1464 {USB_DEVICE(0x0c45, 0x608f),
SB(OV7630, 103)},
1465 {USB_DEVICE(0x0c45, 0x60a8),
SB(PAS106, 103)},
1466 {USB_DEVICE(0x0c45, 0x60aa),
SB(TAS5130CXX, 103)},
1467 {USB_DEVICE(0x0c45, 0x60af),
SB(PAS202, 103)},
1468 {USB_DEVICE(0x0c45, 0x60b0),
SB(OV7630, 103)},
1481 static struct usb_driver sd_driver = {
1483 .id_table = device_table,
1487 .suspend = gspca_suspend,
1488 .resume = gspca_resume,
1489 .reset_resume = gspca_resume,