int cmos_init_ov7675(cmos_init_arg_t *init_arg) { char *array_addr; char addr,data; int array_size, i; printk(" cmos_init_ov7675() \n"); if (init_arg->is_rawdata) { if(init_arg->width == 640) { array_size = sizeof(ov7675_640_480_raw); array_addr = ov7675_640_480_raw; }else{ /* Not-supported Resolution */ return -1; } }else { if( (init_arg->width == 320) && (init_arg->height == 240) ) { array_size = sizeof(ov7675_320_240); array_addr = ov7675_320_240; } else if(init_arg->width == 640) { array_size = sizeof(ov7675_640_480); array_addr = ov7675_640_480; }else{ /* Not-supported Resolution */ return -1; } } for (i = 0; i <array_size ; i+=2){ addr = array_addr[i]; data = array_addr[i+1]; wmt_vid_i2c_write( CMOS_OV7675_I2C_ADDR, addr, data); } if (((init_arg->pix_color_format == V4L2_PIX_FMT_RGB565) ||(init_arg->pix_color_format == V4L2_PIX_FMT_RGB32)) && (!init_arg->is_rawdata)) { printk("ov7675_cfg_rgb \n"); ov7675_cfg_rgb(); } data = 0x0; if (init_arg->cmos_v_flip) data |= 0x10; if (init_arg->cmos_h_flip) data |= 0x20; printk("set ov7675 mirror val 0x%02x cmos_v_flip 0x%02x cmos_h_flip 0x%02x\n",data, init_arg->cmos_v_flip, init_arg->cmos_h_flip); wmt_vid_i2c_write( CMOS_OV7675_I2C_ADDR, 0x1e, data); return 0; } /* End of cmos_init_ov7675() */
int cmos_siv120b_identify(void) { char data=0x0, data1 = 0x0; wmt_vid_i2c_write(CMOS_SIV120B_I2C_ADDR,0x0,0x0 ); data = wmt_vid_i2c_read(CMOS_SIV120B_I2C_ADDR, 0x1) ; data1 = wmt_vid_i2c_read(CMOS_SIV120B_I2C_ADDR, 0x2) ; printk("SIV120 data 0x%02x data1 0x%02x \n",data, data1); if ((data==0x12) && (data1==0x11)){ printk(" find SIV120B\n"); return 0; } return -1; }
int cmos_init_siv120d(int width, int height, int cmos_v_flip, int cmos_h_flip) { char *array_addr; char addr,data; int array_size, i; array_size = sizeof(SIV_120D); array_addr = SIV_120D; for (i = 0; i <array_size ; i+=2){ addr = array_addr[i]; data = array_addr[i+1]; // printk("addr 0x%02x data 0x%02x \n",addr ,data); wmt_vid_i2c_write( CMOS_SIV120B_I2C_ADDR, addr, data); } return 0; } /* End of cmos_init_ov7675() */
int cmos_init_gc0308(int width, int height, int cmos_v_flip, int cmos_h_flip) { unsigned char *array_addr,addr,data; unsigned int array_size,i; array_size=sizeof(gc0308); array_addr=gc0308; printk("cmos_init_gc0308 %d %d \n", width, height); for(i=0;i<array_size;i+=2) { addr = array_addr[i]; data = array_addr[i+1]; wmt_vid_i2c_write(CMOS_GC0308_I2C_ADDR,addr,data); } if((width == 320) && ( height == 240)) { printk("init gc0308_320_240 \n"); array_size=sizeof(gc0308_320_240); array_addr=gc0308_320_240; for(i=0;i<array_size;i+=2) { addr = array_addr[i]; data = array_addr[i+1]; wmt_vid_i2c_write(CMOS_GC0308_I2C_ADDR,addr,data); } } //set the blanking to default , fps will be 25 wmt_vid_i2c_write(CMOS_GC0308_I2C_ADDR, 0x1, 0x6a); wmt_vid_i2c_write(CMOS_GC0308_I2C_ADDR, 0x2, 0x70); wmt_vid_i2c_write(CMOS_GC0308_I2C_ADDR, 0xf, 0x0); data = wmt_vid_i2c_read(CMOS_GC0308_I2C_ADDR,0x14) ; data &= 0xfc; data |= 0x10; if (cmos_v_flip) data |= 0x2; if (cmos_h_flip) data |= 0x1; wmt_vid_i2c_write( CMOS_GC0308_I2C_ADDR, 0x14, data); return 0; }
void ov7675_cfg_rgb(void) { wmt_vid_i2c_write( CMOS_OV7675_I2C_ADDR, 0x12, 0x04); wmt_vid_i2c_write( CMOS_OV7675_I2C_ADDR, 0x40, 0xd0); }
int cmos_init_gc0307(int width, int height, int cmos_v_flip, int cmos_h_flip) { unsigned int * array_addr; unsigned int addr,data,array_size,i; array_size=sizeof(gc0307)/sizeof(unsigned int); array_addr=gc0307; for(i=0;i<array_size;i+=2) { addr = array_addr[i]; data = array_addr[i+1]; wmt_vid_i2c_write(CMOS_GC0307_I2C_ADDR,addr,data); } if ((cmos_v_flip == 0) &&(cmos_h_flip == 0)) { wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x0f, 0xb2); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x45, 0x27); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x47, 0x2c); }else if ((cmos_v_flip == 0) &&(cmos_h_flip == 1)){ wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x0f, 0xa2); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x45, 0x26); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x47, 0x28); }else if ((cmos_v_flip == 1) &&(cmos_h_flip == 0)){ wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x0f, 0x92); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x45, 0x25); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x47, 0x24); }else if ((cmos_v_flip == 1) &&(cmos_h_flip == 1)){ wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x0f, 0x82); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x45, 0x24); wmt_vid_i2c_write( CMOS_GC0307_I2C_ADDR, 0x47, 0x20); } return 0; }