sonixj.c

来自「trident tm5600的linux驱动」· C语言 代码 · 共 1,721 行 · 第 1/4 页

C
1,721
字号
	{0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10},	{0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10},	{0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10},	{0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10},	{0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10},	{0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10},	{0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10},	{0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10},	{0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10},	{0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10},	{0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10},	{0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10},	{0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10},	{0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10},	{0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10},	{0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10},	{0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10},	{0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10},/* */	{0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},/*fixme: + 0x12, 0x04*//*	{0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10},  * COMN							 * set by setvflip */	{0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10},/* */	{0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10},/* */	{0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10},/*	{0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */	{}};static const __u8 ov7660_sensor_init[][8] = {	{0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB *//*		(delay 20ms) */	{0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},						/* Outformat = rawRGB */	{0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */	{0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10},						/* GAIN BLUE RED VREF */	{0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10},						/* COM 1 BAVE GEAVE AECHH */	{0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */	{0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */	{0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10},						/* AECH CLKRC COM7 COM8 */	{0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */	{0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10},						/* HSTART HSTOP VSTRT VSTOP */	{0xa1, 0x21, 0x1b, 0x02, 0x00, 0x00, 0x00, 0x10}, /* PSHFT */	{0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */	{0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10},					/* BOS GBOS GROS ROS (BGGR offset) *//*	{0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, */	{0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10},						/* AEW AEB VPT BBIAS */	{0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10},						/* GbBIAS RSVD EXHCH EXHCL */	{0xd1, 0x21, 0x2c, 0x80, 0x00, 0x00, 0x62, 0x10},						/* RBIAS ADVFL ASDVFH YAVE */	{0xc1, 0x21, 0x30, 0x08, 0x30, 0xb4, 0x00, 0x10},						/* HSYST HSYEN HREF */	{0xd1, 0x21, 0x33, 0x00, 0x07, 0x84, 0x00, 0x10}, /* reserved */	{0xd1, 0x21, 0x37, 0x0c, 0x02, 0x43, 0x00, 0x10},						/* ADC ACOM OFON TSLB */	{0xd1, 0x21, 0x3b, 0x02, 0x6c, 0x19, 0x0e, 0x10},						/* COM11 COM12 COM13 COM14 */	{0xd1, 0x21, 0x3f, 0x41, 0xc1, 0x22, 0x08, 0x10},						/* EDGE COM15 COM16 COM17 */	{0xd1, 0x21, 0x43, 0xf0, 0x10, 0x78, 0xa8, 0x10}, /* reserved */	{0xd1, 0x21, 0x47, 0x60, 0x80, 0x00, 0x00, 0x10}, /* reserved */	{0xd1, 0x21, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* reserved */	{0xd1, 0x21, 0x4f, 0x46, 0x36, 0x0f, 0x17, 0x10}, /* MTX 1 2 3 4 */	{0xd1, 0x21, 0x53, 0x7f, 0x96, 0x40, 0x40, 0x10}, /* MTX 5 6 7 8 */	{0xb1, 0x21, 0x57, 0x40, 0x0f, 0x00, 0x00, 0x10}, /* MTX9 MTXS */	{0xd1, 0x21, 0x59, 0xba, 0x9a, 0x22, 0xb9, 0x10}, /* reserved */	{0xd1, 0x21, 0x5d, 0x9b, 0x10, 0xf0, 0x05, 0x10}, /* reserved */	{0xa1, 0x21, 0x61, 0x60, 0x00, 0x00, 0x00, 0x10}, /* reserved */	{0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10},						/* LCC1 LCC2 LCC3 LCC4 */	{0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10}, /* LCC5 */	{0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10}, /* MANU */	{0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10},					/* band gap reference [0:3] DBLV */	{0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x78, 0x34, 0x30, 0x2f, 0x2b, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x7c, 0x03, 0x07, 0x17, 0x34, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x80, 0x41, 0x4d, 0x58, 0x63, 0x10}, /* gamma curve */	{0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10}, /* gamma curve */	{0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */	{0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */	{0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H *//****** (some exchanges in the win trace) ******/	{0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */						/* bits[3..0]reserved */	{0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},						/* VREF vertical frame ctrl */	{0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* AECH 0x20 */	{0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFL */	{0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFH */	{0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, /* GAIN *//*	{0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, * BLUE *//****** (some exchanges in the win trace) ******/	{0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */	{0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10}, /* dummy line low */	{0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCH */	{0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCL *//*	{0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10},  * RED *//****** (some exchanges in the win trace) ******//******!! startsensor KO if changed !!****/	{0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10},	{}};/*	  reg 0x04	  reg 0x07		   reg 0x10 *//* expo = (COM1 & 0x02) | ((AECHH & 0x2f) << 10) | (AECh << 2) */static const __u8 ov7648_sensor_init[][8] = {	{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},	{0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00},	{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},	{0xA1, 0x6E, 0x3F, 0x20, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x04, 0x02, 0xB1, 0x02, 0x39, 0x10},	{0xD1, 0x6E, 0x08, 0x00, 0x01, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x0C, 0x02, 0x7F, 0x01, 0xE0, 0x10},	{0xD1, 0x6E, 0x12, 0x03, 0x02, 0x00, 0x03, 0x10},	{0xD1, 0x6E, 0x16, 0x85, 0x40, 0x4A, 0x40, 0x10},	{0xC1, 0x6E, 0x1A, 0x00, 0x80, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x1D, 0x08, 0x03, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x23, 0x00, 0xB0, 0x00, 0x94, 0x10},	{0xD1, 0x6E, 0x27, 0x58, 0x00, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x2D, 0x14, 0x35, 0x61, 0x84, 0x10},	{0xD1, 0x6E, 0x31, 0xA2, 0xBD, 0xD8, 0xFF, 0x10},	{0xD1, 0x6E, 0x35, 0x06, 0x1E, 0x12, 0x02, 0x10},	{0xD1, 0x6E, 0x39, 0xAA, 0x53, 0x37, 0xD5, 0x10},	{0xA1, 0x6E, 0x3D, 0xF2, 0x00, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x3E, 0x00, 0x00, 0x80, 0x03, 0x10},	{0xD1, 0x6E, 0x42, 0x03, 0x00, 0x00, 0x00, 0x10},	{0xC1, 0x6E, 0x46, 0x00, 0x80, 0x80, 0x00, 0x10},	{0xD1, 0x6E, 0x4B, 0x02, 0xEF, 0x08, 0xCD, 0x10},	{0xD1, 0x6E, 0x4F, 0x00, 0xD0, 0x00, 0xA0, 0x10},	{0xD1, 0x6E, 0x53, 0x01, 0xAA, 0x01, 0x40, 0x10},	{0xD1, 0x6E, 0x5A, 0x50, 0x04, 0x30, 0x03, 0x10},	{0xA1, 0x6E, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x5F, 0x10, 0x40, 0xFF, 0x00, 0x10},  /*	{0xD1, 0x6E, 0x63, 0x40, 0x40, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x67, 0x00, 0x00, 0x00, 0x00, 0x10}, * This is currently setting a * blue tint, and some things more , i leave it here for future test if * somene is having problems with color on this sensor	{0xD1, 0x6E, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xD1, 0x6E, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x10},	{0xC1, 0x6E, 0x73, 0x10, 0x80, 0xEB, 0x00, 0x10},	{0xA1, 0x6E, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x15, 0x01, 0x00, 0x00, 0x00, 0x10},	{0xC1, 0x6E, 0x16, 0x40, 0x40, 0x40, 0x00, 0x10},	{0xA1, 0x6E, 0x1D, 0x08, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x07, 0xB5, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x18, 0x6B, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x1D, 0x08, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},	{0xA1, 0x6E, 0x07, 0xB8, 0x00, 0x00, 0x00, 0x10},  */	{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},	{0xA1, 0x6E, 0x06, 0x03, 0x00, 0x00, 0x00, 0x10}, /* Bright... */	{0xA1, 0x6E, 0x07, 0x66, 0x00, 0x00, 0x00, 0x10}, /* B.. */	{0xC1, 0x6E, 0x1A, 0x03, 0x65, 0x90, 0x00, 0x10}, /* Bright/Witen....*//*	{0xC1, 0x6E, 0x16, 0x45, 0x40, 0x60, 0x00, 0x10},  * Bright/Witene */	{}};static const __u8 qtable4[] = {	0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06,	0x06, 0x08, 0x0A, 0x11,	0x0A, 0x0A, 0x08, 0x08, 0x0A, 0x15, 0x0F, 0x0F, 0x0C, 0x11, 0x19, 0x15,	0x19, 0x19, 0x17, 0x15,	0x17, 0x17, 0x1B, 0x1D, 0x25, 0x21, 0x1B, 0x1D, 0x23, 0x1D, 0x17, 0x17,	0x21, 0x2E, 0x21, 0x23,	0x27, 0x29, 0x2C, 0x2C, 0x2C, 0x19, 0x1F, 0x30, 0x32, 0x2E, 0x29, 0x32,	0x25, 0x29, 0x2C, 0x29,	0x06, 0x08, 0x08, 0x0A, 0x08, 0x0A, 0x13, 0x0A, 0x0A, 0x13, 0x29, 0x1B,	0x17, 0x1B, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,	0x29, 0x29, 0x29, 0x29};/* read <len> bytes to gspca_dev->usb_buf */static void reg_r(struct gspca_dev *gspca_dev,		  __u16 value, int len){#ifdef GSPCA_DEBUG	if (len > USB_BUF_SZ) {		err("reg_r: buffer overflow");		return;	}#endif	usb_control_msg(gspca_dev->dev,			usb_rcvctrlpipe(gspca_dev->dev, 0),			0,			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,			value, 0,			gspca_dev->usb_buf, len,			500);	PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]);}static void reg_w1(struct gspca_dev *gspca_dev,		   __u16 value,		   __u8 data){	PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data);	gspca_dev->usb_buf[0] = data;	usb_control_msg(gspca_dev->dev,			usb_sndctrlpipe(gspca_dev->dev, 0),			0x08,			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,			value,			0,			gspca_dev->usb_buf, 1,			500);}static void reg_w(struct gspca_dev *gspca_dev,			  __u16 value,			  const __u8 *buffer,			  int len){	PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..",		value, buffer[0], buffer[1]);#ifdef GSPCA_DEBUG	if (len > USB_BUF_SZ) {		err("reg_w: buffer overflow");		return;	}#endif	memcpy(gspca_dev->usb_buf, buffer, len);	usb_control_msg(gspca_dev->dev,			usb_sndctrlpipe(gspca_dev->dev, 0),			0x08,			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,			value, 0,			gspca_dev->usb_buf, len,			500);}/* I2C write 1 byte */static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val){	struct sd *sd = (struct sd *) gspca_dev;	PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val);	gspca_dev->usb_buf[0] = 0x81 | (2 << 4);	/* = a1 */	gspca_dev->usb_buf[1] = sd->i2c_base;	gspca_dev->usb_buf[2] = reg;	gspca_dev->usb_buf[3] = val;	gspca_dev->usb_buf[4] = 0;	gspca_dev->usb_buf[5] = 0;	gspca_dev->usb_buf[6] = 0;	gspca_dev->usb_buf[7] = 0x10;	usb_control_msg(gspca_dev->dev,			usb_sndctrlpipe(gspca_dev->dev, 0),			0x08,			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,			0x08,			/* value = i2c */			0,			gspca_dev->usb_buf, 8,			500);}/* I2C write 8 bytes */static void i2c_w8(struct gspca_dev *gspca_dev,		   const __u8 *buffer){	memcpy(gspca_dev->usb_buf, buffer, 8);	usb_control_msg(gspca_dev->dev,			usb_sndctrlpipe(gspca_dev->dev, 0),			0x08,			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,			0x08, 0,		/* value, index */			gspca_dev->usb_buf, 8,			500);	msleep(2);}/* read 5 bytes in gspca_dev->usb_buf */static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg){	struct sd *sd = (struct sd *) gspca_dev;	__u8 mode[8];	mode[0] = 0x81 | 0x10;	mode[1] = sd->i2c_base;	mode[2] = reg;	mode[3] = 0;	mode[4] = 0;	mode[5] = 0;	mode[6] = 0;	mode[7] = 0x10;	i2c_w8(gspca_dev, mode);	msleep(2);	mode[0] = 0x81 | (5 << 4) | 0x02;	mode[2] = 0;	i2c_w8(gspca_dev, mode);	msleep(2);	reg_r(gspca_dev, 0x0a, 5);}static int probesensor(struct gspca_dev *gspca_dev){	struct sd *sd = (struct sd *) gspca_dev;	i2c_w1(gspca_dev, 0x02, 0);			/* sensor wakeup */	msleep(10);	reg_w1(gspca_dev, 0x02, 0x66);			/* Gpio on */	msleep(10);	i2c_r5(gspca_dev, 0);				/* read sensor id */	if (gspca_dev->usb_buf[0] == 0x02	    && gspca_dev->usb_buf[1] == 0x09	    && gspca_dev->usb_buf[2] == 0x01	    && gspca_dev->usb_buf[3] == 0x00	    && gspca_dev->usb_buf[4] == 0x00) {		PDEBUG(D_PROBE, "Find Sensor sn9c102P HV7131R");		sd->sensor = SENSOR_HV7131R;		return SENSOR_HV7131R;	}	PDEBUG(D_PROBE, "Find Sensor 0x%02x 0x%02x 0x%02x",		gspca_dev->usb_buf[0], gspca_dev->usb_buf[1],		gspca_dev->usb_buf[2]);	PDEBUG(D_PROBE, "Sensor sn9c102P Not found");	return -ENODEV;}static int configure_gpio(struct gspca_dev *gspca_dev,			  const __u8 *sn9c1xx){	struct sd *sd = (struct sd *) gspca_dev;	const __u8 *reg9a;	static const __u8 reg9a_def[] =		{0x08, 0x40, 0x20, 0x10, 0x00, 0x04};	static const __u8 reg9a_sn9c325[] =		{0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};	static const __u8 regd4[] = {0x60, 0x00, 0x00};	reg_w1(gspca_dev, 0xf1, 0x00);#if 1	reg_w1(gspca_dev, 0x01, sn9c1xx[1]);#else	reg_w1(gspca_dev, 0x01, 0x00);		/*jfm: in some win traces*/#endif	/* configure gpio */	reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);	reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);	reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);	/* jfm len was 3 */	switch (sd->bridge) {	case BRIDGE_SN9C325:		reg9a = reg9a_sn9c325;		break;	default:		reg9a = reg9a_def;		break;	}	reg_w(gspca_dev, 0x9a, reg9a, 6);	reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); /*fixme:jfm was 60 only*/	reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);	switch (sd->sensor) {	case SENSOR_OM6802:		reg_w1(gspca_dev, 0x02, 0x71);		reg_w1(gspca_dev, 0x01, 0x42);		reg_w1(gspca_dev, 0x17, 0x64);		reg_w1(gspca_dev, 0x01, 0x42);		break;#if 1/*jfm: from win trace */	case SENSOR_OV7630:		reg_w1(gspca_dev, 0x01, 0x61);		reg_w1(gspca_dev, 0x17, 0xe2);		reg_w1(gspca_dev, 0x01, 0x60);		reg_w1(gspca_dev, 0x01, 0x40);		break;#endif	case SENSOR_OV7648:		reg_w1(gspca_dev, 0x01, 0x43);		reg_w1(gspca_dev, 0x17, 0xae);		reg_w1(gspca_dev, 0x01, 0x42);		break;#if 1/*jfm: from win trace */	case SENSOR_OV7660:		reg_w1(gspca_dev, 0x01, 0x61);		reg_w1(gspca_dev, 0x17, 0x20);		reg_w1(gspca_dev, 0x01, 0x60);		reg_w1(gspca_dev, 0x01, 0x40);		break;#endif	default:		reg_w1(gspca_dev, 0x01, 0x43);		reg_w1(gspca_dev, 0x17, 0x61);		reg_w1(gspca_dev, 0x01, 0x42);		if (sd->sensor == SENSOR_HV7131R) {			if (probesensor(gspca_dev) < 0)				return -ENODEV;		}		break;	}	return 0;}static void hv7131R_InitSensor(struct gspca_dev *gspca_dev)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?