summaryrefslogtreecommitdiff
path: root/drivers/media/video/wmt_v4l2/sensors/gc2155
diff options
context:
space:
mode:
authorSrikant Patnaik2015-01-11 12:28:04 +0530
committerSrikant Patnaik2015-01-11 12:28:04 +0530
commit871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch)
tree8718f573808810c2a1e8cb8fb6ac469093ca2784 /drivers/media/video/wmt_v4l2/sensors/gc2155
parent9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff)
downloadFOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz
FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2
FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized. Changes are basically to make it look like kernel structure.
Diffstat (limited to 'drivers/media/video/wmt_v4l2/sensors/gc2155')
-rwxr-xr-xdrivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.c388
-rwxr-xr-xdrivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.h1074
2 files changed, 1462 insertions, 0 deletions
diff --git a/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.c b/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.c
new file mode 100755
index 00000000..5369dd18
--- /dev/null
+++ b/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.c
@@ -0,0 +1,388 @@
+
+#include "../cmos-subdev.h"
+#include "../../wmt-vid.h"
+#include "gc2155.h"
+
+#define sensor_write_array(sd, arr, sz) \
+ cmos_init_8bit_addr(arr, sz, (sd)->i2c_addr)
+
+#define sensor_read(sd, reg) \
+ wmt_vid_i2c_read(sd->i2c_addr, reg)
+
+#define sensor_write(sd, reg, val) \
+ wmt_vid_i2c_write(sd->i2c_addr, reg, val)
+
+struct cmos_win_size {
+ char *name;
+ int width;
+ int height;
+ uint8_t *regs;
+ size_t size;
+};
+
+#define CMOS_WIN_SIZE(n, w, h, r) \
+ {.name = n, .width = w , .height = h, .regs = r, .size = ARRAY_SIZE(r) }
+
+#define FILP_REG_INIT_VALUE 0x14
+#define DELAY_INTERVAL 50
+#define RETRY_TIMES 10
+
+static const struct cmos_win_size cmos_supported_win_sizes[] = {
+ //CMOS_WIN_SIZE("QVGA", 320, 240, gc2155_320_240_regs),
+ CMOS_WIN_SIZE("VGA", 640, 480, gc2155_640_480_regs),
+ CMOS_WIN_SIZE("UXGA", 1600, 1200, gc2155_1600_1200_regs),
+};
+
+static const struct cmos_win_size *cmos_select_win(u32 *width, u32 *height)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(cmos_supported_win_sizes); i++) {
+ if (cmos_supported_win_sizes[i].width == *width &&
+ cmos_supported_win_sizes[i].height == *height) {
+ *width = cmos_supported_win_sizes[i].width;
+ *height = cmos_supported_win_sizes[i].height;
+ return &cmos_supported_win_sizes[i];
+ }
+ }
+ return NULL;
+}
+
+static int sensor_s_wb(struct cmos_subdev *sd, enum v4l2_wb_mode value)
+{
+ uint8_t *regs;
+ size_t size;
+
+ switch (value) {
+ case WHITE_BALANCE_AUTO:
+ regs = gc2155_wb_auto;
+ size = ARRAY_SIZE(gc2155_wb_auto);
+ break;
+ case WHITE_BALANCE_INCANDESCENCE:
+ regs = gc2155_wb_incandescent;
+ size = ARRAY_SIZE(gc2155_wb_incandescent);
+ break;
+ case WHITE_BALANCE_DAYLIGHT:
+ regs = gc2155_wb_daylight;
+ size = ARRAY_SIZE(gc2155_wb_daylight);
+ break;
+ case WHITE_BALANCE_CLOUDY:
+ regs = gc2155_wb_cloudy;
+ size = ARRAY_SIZE(gc2155_wb_cloudy);
+ break;
+ case WHITE_BALANCE_FLUORESCENT:
+ regs = gc2155_wb_fluorescent;
+ size = ARRAY_SIZE(gc2155_wb_fluorescent);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ sensor_write_array(sd, regs, size);
+ return 0;
+}
+
+static int sensor_s_scenemode(struct cmos_subdev *sd, enum v4l2_scene_mode value)
+{
+ uint8_t *regs;
+ size_t size;
+
+ switch (value) {
+ case SCENE_MODE_AUTO:
+ regs = gc2155_scene_mode_auto;
+ size = ARRAY_SIZE(gc2155_scene_mode_auto);
+ break;
+ case SCENE_MODE_NIGHTSHOT:
+ regs = gc2155_scene_mode_night;
+ size = ARRAY_SIZE(gc2155_scene_mode_night);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ sensor_write_array(sd, regs, size);
+ return 0;
+}
+
+static int sensor_s_exposure(struct cmos_subdev *sd, enum v4l2_exposure_mode value)
+{
+ uint8_t *regs;
+ size_t size;
+
+ switch (value) {
+ case -2:
+ regs = gc2155_exposure_neg6;
+ size = ARRAY_SIZE(gc2155_exposure_neg6);
+ break;
+ case -1:
+ regs = gc2155_exposure_neg3;
+ size = ARRAY_SIZE(gc2155_exposure_neg3);
+ break;
+ case 0:
+ regs = gc2155_exposure_zero;
+ size = ARRAY_SIZE(gc2155_exposure_zero);
+ break;
+ case 1:
+ regs = gc2155_exposure_pos3;
+ size = ARRAY_SIZE(gc2155_exposure_pos3);
+ break;
+ case 2:
+ regs = gc2155_exposure_pos6;
+ size = ARRAY_SIZE(gc2155_exposure_pos6);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ sensor_write_array(sd, regs, size);
+ return 0;
+}
+
+static int sensor_s_antibanding(struct cmos_subdev *sd, int value)
+{
+ uint8_t *regs;
+ size_t size;
+
+ switch (value) {
+ case 0:
+ regs = gc2155_antibanding_auto;
+ size = ARRAY_SIZE(gc2155_antibanding_auto);
+ break;
+ case 1:
+ regs = gc2155_antibanding_50hz;
+ size = ARRAY_SIZE(gc2155_antibanding_50hz);
+ break;
+ case 2:
+ regs = gc2155_antibanding_60hz;
+ size = ARRAY_SIZE(gc2155_antibanding_60hz);
+ break;
+ case 3:
+ regs = gc2155_antibanding_off;
+ size = ARRAY_SIZE(gc2155_antibanding_off);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ sensor_write_array(sd, regs, size);
+
+ return 0;
+}
+
+static int sensor_s_hflip(struct cmos_subdev *sd, int value)
+{
+ uint8_t data,tmp=0 ;
+ uint8_t retry_times=0;
+
+ sensor_write(sd, 0xfe, 0x00); // set page0
+ data=sensor_read(sd, 0x17);
+
+ switch (value) {
+ case 0:
+ data &= ~0x01;
+ break;
+ case 1:
+ data |= 0x01;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tmp=data | FILP_REG_INIT_VALUE;
+ for(retry_times=0;retry_times<RETRY_TIMES;retry_times++){
+ sensor_write(sd, 0x17, tmp);
+ msleep(50+retry_times*DELAY_INTERVAL);
+ if(sensor_read(sd, 0x17)==tmp)
+ break;
+ }
+
+ return 0;
+}
+
+static int sensor_s_vflip(struct cmos_subdev *sd, int value)
+{
+ uint8_t data,tmp=0;
+ uint8_t retry_times=0;
+
+ sensor_write(sd, 0xfe, 0x00); // set page0
+ data=sensor_read(sd, 0x17);
+
+ switch (value) {
+ case 0:
+ data &= ~0x02;
+ break;
+ case 1:
+ data |= 0x02;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tmp=data | FILP_REG_INIT_VALUE;
+ for(retry_times=0;retry_times<RETRY_TIMES;retry_times++){
+ sensor_write(sd, 0x17, tmp);
+ msleep(50+retry_times*DELAY_INTERVAL);
+ if(sensor_read(sd, 0x17)==tmp)
+ break;
+ }
+ return 0;
+}
+
+static int sensor_queryctrl(struct cmos_subdev *sd, struct v4l2_queryctrl *qc)
+{
+ switch (qc->id) {
+ case V4L2_CID_VFLIP:
+ case V4L2_CID_HFLIP:
+ return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
+ case V4L2_CID_CAMERA_SCENE_MODE:
+ return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
+ case V4L2_CID_DO_WHITE_BALANCE:
+ return v4l2_ctrl_query_fill(qc, 0, 3, 1, 0);
+ case V4L2_CID_EXPOSURE:
+ return v4l2_ctrl_query_fill(qc, -2, 2, 1, 0);
+ }
+ return -EINVAL;
+}
+
+static int sensor_s_ctrl(struct cmos_subdev *sd, struct v4l2_control *ctrl)
+{
+ switch (ctrl->id) {
+ case V4L2_CID_CAMERA_SCENE_MODE:
+ return sensor_s_scenemode(sd, ctrl->value);
+ case V4L2_CID_DO_WHITE_BALANCE:
+ return sensor_s_wb(sd, ctrl->value);
+ case V4L2_CID_EXPOSURE:
+ return sensor_s_exposure(sd, ctrl->value);
+ case V4L2_CID_HFLIP:
+ return sensor_s_hflip(sd, ctrl->value);
+ case V4L2_CID_VFLIP:
+ return sensor_s_vflip(sd, ctrl->value);
+ case V4L2_CID_CAMERA_ANTI_BANDING:
+ return sensor_s_antibanding(sd, ctrl->value);
+ default:
+ case WMT_V4L2_CID_CAMERA_ANTIBANDING:
+ return -EINVAL;
+ }
+ return -EINVAL;
+}
+
+static int sensor_g_mbus_fmt(struct cmos_subdev *sd,
+ struct v4l2_mbus_framefmt *mf)
+{
+ return -EINVAL;
+}
+
+static int sensor_s_mbus_fmt(struct cmos_subdev *sd,
+ struct v4l2_mbus_framefmt *mf)
+{
+ const struct cmos_win_size *win;
+
+ printk(KERN_DEBUG "%s, s_mbus_fmt width %d, height %d\n",
+ sd->name, mf->width, mf->height);
+
+ win = cmos_select_win(&mf->width, &mf->height);
+ if (!win) {
+ pr_err("%s, s_mbus_fmt failed, width %d, height %d\n",
+ sd->name, mf->width, mf->height);
+ return -EINVAL;
+ }
+
+ sensor_write_array(sd, win->regs, win->size);
+ msleep(150);
+ //msleep(500);
+ return 0;
+}
+
+static int sensor_try_mbus_fmt(struct cmos_subdev *sd,
+ struct v4l2_mbus_framefmt *mf)
+{
+ return 0;
+}
+
+static int sensor_enum_framesizes(struct cmos_subdev *sd,
+ struct v4l2_frmsizeenum *fsize)
+{
+ int i;
+ int num_valid = -1;
+ __u32 index = fsize->index;
+
+ for (i = 0; i < ARRAY_SIZE(cmos_supported_win_sizes); i++) {
+ const struct cmos_win_size *win = &cmos_supported_win_sizes[index];
+ if (index == ++num_valid) {
+ fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
+ fsize->discrete.width = win->width;
+ fsize->discrete.height = win->height;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+static int sensor_identify(struct cmos_subdev *sd)
+{
+ uint32_t data = 0;
+
+ data |= (sensor_read(sd, 0xf0) & 0xff) << 8;
+ data |= (sensor_read(sd, 0xf1) & 0xff);
+
+ return (data == sd->id) ? 0 : -EINVAL;
+}
+
+static int sensor_init(struct cmos_subdev *sd)
+{
+ if (sensor_identify(sd)) {
+ return -1;
+ }
+
+ sensor_write_array(sd, gc2155_default_regs_init,
+ ARRAY_SIZE(gc2155_default_regs_init));
+
+ msleep(100);
+ return 0;
+}
+
+static int sensor_exit(struct cmos_subdev *sd)
+{
+ sensor_write_array(sd, gc2155_default_regs_exit,
+ ARRAY_SIZE(gc2155_default_regs_exit));
+ return 0;
+}
+
+static struct cmos_subdev_ops gc2155_ops = {
+ .identify = sensor_identify,
+ .init = sensor_init,
+ .exit = sensor_exit,
+ .queryctrl = sensor_queryctrl,
+ .s_ctrl = sensor_s_ctrl,
+ .s_mbus_fmt = sensor_s_mbus_fmt,
+ .g_mbus_fmt = sensor_g_mbus_fmt,
+ .try_mbus_fmt = sensor_try_mbus_fmt,
+ .enum_framesizes = sensor_enum_framesizes,
+};
+
+struct cmos_subdev gc2155 = {
+ .name = "gc2155",
+ .i2c_addr = 0x3c,
+ .id = 0x2155,
+ .max_width = 1600,
+ .max_height = 1200,
+ .ops = &gc2155_ops,
+};
+
+#if 0
+static int __init gc2155_init(void)
+{
+ return cmos_register_sudbdev(&gc2155);
+}
+
+static void __exit gc2155_exit(void)
+{
+ return cmos_unregister_subdev(&gc2155);
+}
+
+module_init(gc2155_init);
+module_exit(gc2155_exit);
+
+MODULE_LICENSE("GPL");
+#endif
diff --git a/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.h b/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.h
new file mode 100755
index 00000000..74d11e72
--- /dev/null
+++ b/drivers/media/video/wmt_v4l2/sensors/gc2155/gc2155.h
@@ -0,0 +1,1074 @@
+#ifndef GC2155_H
+#define GC2155_H
+
+
+// Scene Mode
+uint8_t gc2155_scene_mode_auto[] = {
+ 0xfe,0x01,
+
+ 0x3c,0x40,
+ 0xfe,0x00,
+};
+
+uint8_t gc2155_scene_mode_night[] = {
+ 0xfe,0x01,
+
+ 0x3c,0x60,
+ 0xfe,0x00,
+};
+
+uint8_t gc2155_wb_auto [] = {
+ 0xfe , 0x00,
+ 0x82 , 0xfe,
+};
+
+uint8_t gc2155_wb_incandescent [] = {
+ 0xfe, 0x00,
+ 0x82, 0xfc,
+ 0xb3, 0x50,
+ 0xb4, 0x40,
+ 0xb5, 0xa8,
+
+};
+
+uint8_t gc2155_wb_fluorescent [] = {
+ 0xfe, 0x00,
+ 0x82, 0xfc,
+ 0xb3, 0x50,
+ 0xb4, 0x40,
+ 0xb5, 0xb8,
+};
+
+uint8_t gc2155_wb_daylight [] = {
+ 0xfe , 0x00,
+ 0x82 , 0xfc,
+ 0xb3 , 0x70,
+ 0xb4 , 0x40,
+ 0xb5 , 0x50,
+
+};
+
+uint8_t gc2155_wb_cloudy [] = {
+ 0xfe , 0x00,
+ 0x82 , 0xfc,
+ 0xb3 , 0x58,
+ 0xb4 , 0x40,
+ 0xb5 , 0x50,
+};
+
+
+// Exposure
+uint8_t gc2155_exposure_neg6[] = {
+ 0xfe, 0x01,
+ 0x13, 0x10,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_exposure_neg3[] = {
+ 0xfe, 0x01,
+ 0x13, 0x20,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_exposure_zero[] = {
+ 0xfe, 0x01,
+ 0x13, 0x30,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_exposure_pos3[] = {
+ 0xfe, 0x01,
+ 0x13, 0x40,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_exposure_pos6[] = {
+ 0xfe, 0x01,
+ 0x13, 0x50,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_antibanding_auto[] = {
+
+};
+
+uint8_t gc2155_antibanding_50hz[] = {
+
+};
+
+uint8_t gc2155_antibanding_60hz[] = {
+
+};
+
+uint8_t gc2155_antibanding_off[] = {
+
+};
+
+uint8_t gc2155_176_144_regs[]={
+
+};
+
+uint8_t gc2155_320_240_regs[]={
+
+};
+
+uint8_t gc2155_1280_720_regs[]= {
+#if defined(GC2155_SUBSAMPLE) //subsample for 720P
+ 0xfe , 0x00,
+ //0xfa , 0x11,
+ 0xb6 , 0x01,
+ 0xfd , 0x00,
+ //// crop window
+ 0xfe , 0x00,
+ 0x99 , 0x55,
+ 0x9a , 0x06,
+ 0x9b , 0x00,
+ 0x9c , 0x00,
+ 0x9d , 0x01,
+ 0x9e , 0x23,
+ 0x9f , 0x00,
+ 0xa0 , 0x00,
+ 0xa1 , 0x01,
+ 0xa2 , 0x23,
+
+ 0x90 , 0x01,
+ 0x91 , 0x00,
+ 0x92 , 0x78,
+ 0x93 , 0x00,
+ 0x94 , 0x00,
+ 0x95 , 0x02,
+ 0x96 , 0xd0,
+ 0x97 , 0x05,
+ 0x98 , 0x00,
+
+ //// AWB
+ 0xfe , 0x00,
+ 0xec , 0x02,
+ 0xed , 0x04,
+ 0xee , 0x60,
+ 0xef , 0x90,
+ 0xfe , 0x01,
+ 0x74 , 0x01,
+ //// AEC
+ 0xfe , 0x01,
+ 0x01 , 0x08,
+ 0x02 , 0xc0,
+ 0x03 , 0x04,
+ 0x04 , 0x90,
+ 0x05 , 0x30,
+ 0x06 , 0x98,
+ 0x07 , 0x28,
+ 0x08 , 0x6c,
+ 0x0a , 0xc2,
+ 0x21 , 0x15,
+ 0xfe , 0x00,
+ ///////banding setting 20fps fixed///
+ 0xfe , 0x00,
+ 0x03 , 0x03,
+ 0x04 , 0xe8,
+ 0x05 , 0x01,
+ 0x06 , 0x56,
+ 0x07 , 0x00,
+ 0x08 , 0x32,
+ 0xfe , 0x01,
+ 0x25 , 0x00,
+ 0x26 , 0xfa,
+ 0x27 , 0x04,
+ 0x28 , 0xe2, //20fps
+ 0x29 , 0x04,
+ 0x2a , 0xe2, //16fps 5dc
+ 0x2b , 0x04,
+ 0x2c , 0xe2, //16fps 6d6 5dc
+ 0x2d , 0x04,
+ 0x2e , 0xe2, //8fps bb8
+ 0x3c , 0x00, //8fps
+
+ 0xfe , 0x00,
+#else
+ ////////windowing 1280X720///////
+ 0xfe,0x00,
+ 0xb6,0x01,
+ 0xfd,0x00,//close scaler
+
+ //windowing setting
+ 0xfe,0x00,
+ 0x09,0x00,
+ 0x0a,0xf0, //row start (1280-720)/2
+ 0x0b,0x00,
+ 0x0c,0xa0, //col start (1600-1280)/2
+ 0x0d,0x02,
+ 0x0e,0xe0,//D8
+ 0x0f,0x05, //Window setting
+ 0x10,0x10, //18
+
+ 0x99,0x11,
+ 0x9a,0x06,
+ 0x9b,0x00,
+ 0x9c,0x00,
+ 0x9d,0x00,
+ 0x9e,0x00,
+ 0x9f,0x00,
+ 0xa0,0x00,
+ 0xa1,0x00,
+ 0xa2,0x00,
+
+ 0x90,0x01, //crop enable
+ 0x95,0x02,
+ 0x96,0xd0,
+ 0x97,0x05,
+ 0x98,0x00,
+
+ //// AWB
+ 0xfe , 0x00,
+ 0xec , 0x04,
+ 0xed , 0x02,
+ 0xee , 0x50,
+ 0xef , 0x5a,
+ 0xfe , 0x01,
+ 0x74 , 0x01,
+ //// AEC
+ 0xfe , 0x01,
+ 0x01,0x04,
+ 0x02,0x50,
+ 0x03,0x02,
+ 0x04,0x58,
+ 0x05,0x20,
+ 0x06,0x30,
+ 0x07,0x20,
+ 0x08,0x40,
+ 0x09,0x80,
+ 0x0a,0xc2,
+ 0x21,0x15,
+ 0xfe,0x00,
+
+ //banding setting
+#if 0 ///just fixed 20fps frame rate
+ 0xfe,0x00,
+ 0x03,0x04,
+ 0x04,0xe7,//N*STEP
+
+ 0x05,0x01,
+ 0x06,0xf1,//HB
+ 0x07,0x00,
+ 0x08,0x80,//VB
+ 0xfe,0x01,
+ 0x25,0x00,
+ 0x26,0xfb,//STEP
+ 0x27,0x04,
+ 0x28,0xe7,
+ 0x29,0x04,
+ 0x2a,0xe7,
+ 0x2b,0x04,
+ 0x2c,0xe7,
+ 0x2d,0x04,
+ 0x2e,0xe7,
+ 0x3c,0x00,
+ 0xfe,0x00,
+
+#endif
+
+/******720P high Frame Rate 16fps~32fps,start set***********************/
+ //banding setting
+ 0xfe,0x00,
+ 0x03,0x02,
+ 0x04,0x34,//N*STEP
+ 0x05,0x01,
+ 0x06,0x6e,//HB
+ 0x07,0x00,
+ 0x08,0x80,//VB
+ 0xfe,0x01,
+ 0x25,0x01,
+ 0x26,0x1a,//STEP
+
+ 0x27,0x03,
+ 0x28,0x4e,//lev 1 32fps
+
+ 0x29,0x04,
+ 0x2a,0x68,//lev 2 24fps
+
+ 0x2b,0x05,
+ 0x2c,0x82,//lev 3 20fps
+
+ 0x2d,0x06,
+ 0x2e,0x9c,//lev 4 16fps
+ 0x3c,0x00,
+ 0xfe,0x00,
+/////////if you set highest Frame Rate,please write 0x00 to 0x3c register//
+/******720P high Frame Rate 16fps~32fps,end set*************************/
+#endif
+};
+
+uint8_t gc2155_1600_1200_regs[]={
+ //SENSORDB("GC2155_Sensor_2M",
+ 0xfe , 0x00,
+ 0xb6 , 0x00,
+ 0xfa , 0x11,
+ 0xfd , 0x00,
+ //// crop window
+ 0xfe , 0x00,
+ 0x90 , 0x01,
+ 0x91 , 0x00,
+ 0x92 , 0x00,
+ 0x93 , 0x00,
+ 0x94 , 0x00,
+ 0x95 , 0x04,
+ 0x96 , 0xb0,
+ 0x97 , 0x06,
+ 0x98 , 0x40,
+ 0x99 , 0x11,
+ 0x9a , 0x06,
+
+ 0x9b , 0x00,
+ 0x9c , 0x00,
+ 0x9d , 0x00,
+ 0x9e , 0x00,
+ 0x9f , 0x00,
+ 0xa0 , 0x00,
+ 0xa1 , 0x00,
+ 0xa2 ,0x00,
+
+ //// AWB
+ 0xfe , 0x00,
+ 0xec , 0x02,
+ 0xed , 0x04,
+ 0xee , 0x60,
+ 0xef , 0x90,
+ 0xfe , 0x01,
+ 0x74 , 0x01,
+ //// AEC
+ 0xfe , 0x01,
+ 0x01 , 0x08,
+ 0x02 , 0xc0,
+ 0x03 , 0x04,
+ 0x04 , 0x90,
+ 0x05 , 0x30,
+ 0x06 , 0x98,
+ 0x07 , 0x28,
+ 0x08 , 0x6c,
+ 0x0a , 0xc2,
+ 0x21 , 0x15, //if 0xfa=11,then 0x21=15;else if 0xfa=00,then 0x21=14
+ 0xfe , 0x00,
+ //// gamma
+ 0xfe , 0x00,
+ 0xc3 , 0x00, //if shutter/2 when capture,then exp_gamma_th/2
+ 0xc4 , 0x90,
+ 0xc5 , 0x98,
+ 0xfe , 0x00,
+};
+
+uint8_t gc2155_800_600_regs[]= {
+ //SENSORDB("GC2155_Sensor_SVGA",
+ 0xfe , 0x00,
+ 0xb6 , 0x01,
+ 0xfa , 0x00,
+ 0xfd , 0x01,
+
+////window setting/////
+ 0x09 , 0x00,
+ 0x0a , 0x00,
+ 0x0b , 0x00,
+ 0x0c , 0x00,
+ 0x0d , 0x04,
+ 0x0e , 0xc0,
+ 0x0f , 0x06,
+ 0x10 , 0x50,
+
+ //// crop window
+ 0xfe , 0x00,
+ 0x90 , 0x01,
+ 0x91 , 0x00,
+ 0x92 , 0x00,
+ 0x93 , 0x00,
+ 0x94 , 0x00,
+ 0x95 , 0x02,
+ 0x96 , 0x58,
+ 0x97 , 0x03,
+ 0x98 , 0x20,
+ 0x99 , 0x11,
+ 0x9a , 0x06,
+ 0x9b , 0x00,
+ 0x9c , 0x00,
+ 0x9d , 0x00,
+ 0x9e , 0x00,
+ 0x9f , 0x00,
+ 0xa0 , 0x00,
+ 0xa1 , 0x00,
+ 0xa2 ,0x00,
+
+ //// AWB
+ 0xfe , 0x00,
+ 0xec , 0x01,
+ 0xed , 0x02,
+ 0xee , 0x30,
+ 0xef , 0x48,
+ 0xfe , 0x01,
+ 0x74 , 0x00,
+ //// AEC
+ 0xfe , 0x01,
+ 0x01 , 0x04,
+ 0x02 , 0x60,
+ 0x03 , 0x02,
+ 0x04 , 0x48,
+ 0x05 , 0x18,
+ 0x06 , 0x4c,
+ 0x07 , 0x14,
+ 0x08 , 0x36,
+ 0x0a , 0xc0,
+ 0x21 , 0x14,
+ 0xfe , 0x00,
+ //// gamma
+ 0xfe , 0x00,
+ 0xc3 , 0x11,
+ 0xc4 , 0x20,
+ 0xc5 , 0x30,
+ 0xfe , 0x00,
+
+//////////////frame rate 50Hz/////////
+#if 1
+ 0xfe , 0x00,
+ 0x05 , 0x01,
+ 0x06 , 0x56,
+ 0x07 , 0x00,
+ 0x08 , 0x32,
+ 0xfe , 0x01,
+ 0x25 , 0x00,
+ 0x26 , 0xfa,
+ 0x27 , 0x04,
+ 0x28 , 0xe2, //20fps
+ 0x29 , 0x06,
+ 0x2a , 0xd6, //16fps
+ 0x2b , 0x07,
+ 0x2c , 0xd0, //12fps
+ 0x2d , 0x0b,
+ 0x2e , 0xb8, //8fps
+ 0xfe , 0x00,
+#else
+ //////////////frame rate 50Hz
+ 0xfe, 0x00,
+ 0x05, 0x02,
+ 0x06, 0x2d,
+ 0x07, 0x00,
+ 0x08, 0xa0,
+ 0xfe, 0x01,
+ 0x25, 0x00,
+ 0x26, 0xd4,
+ 0x27, 0x04,
+ 0x28, 0xf8,
+ 0x29, 0x08,
+ 0x2a, 0x48,
+ 0x2b, 0x0a,
+ 0x2c, 0xc4,
+ 0x2d, 0x0f,
+ 0x2e, 0xbc,
+ 0xfe, 0x00,
+#endif
+
+};
+
+uint8_t gc2155_640_480_regs[]= {
+ 0xfe , 0x00,
+ 0xfa , 0x00,
+ 0xfd , 0x01,
+ 0xb6 , 0x01,
+ //// crop window
+ 0xfe , 0x00,
+ 0x99 , 0x55,
+ 0x9a , 0x06,
+ 0x9b , 0x01,
+ 0x9c , 0x34,
+ 0x9d , 0x00,
+ 0x9e , 0x00,
+ 0x9f , 0x01,
+ 0xa0 , 0x34,
+ 0xa1 , 0x00,
+ 0xa2 ,0x00,
+ 0x90 , 0x01, //crop enable
+ 0x91 , 0x00,
+ 0x92 , 0x00,
+ 0x93 , 0x00,
+ 0x94 , 0x00,
+ 0x95 , 0x01,
+ 0x96 , 0xe0,
+ 0x97 , 0x02,
+ 0x98 , 0x80,
+
+ //// AWB
+ 0xfe , 0x00,
+ 0xec , 0x01,
+ 0xed , 0x02,
+ 0xee , 0x30,
+ 0xef , 0x48,
+ 0xfe , 0x01,
+ 0x74 , 0x00,
+ //// AEC
+ 0xfe , 0x01,
+ 0x01 , 0x04,
+ 0x02 , 0x60,
+ 0x03 , 0x02,
+ 0x04 , 0x48,
+ 0x05 , 0x18,
+ 0x06 , 0x4c,
+ 0x07 , 0x14,
+ 0x08 , 0x36,
+ 0x0a , 0xc0,
+ 0x21 , 0x14,
+ 0xfe , 0x00,
+};
+
+uint8_t gc2155_default_regs_init[] = {
+ 0xfe, 0xf0,
+ 0xfe, 0xf0,
+ 0xfe, 0xf0,
+ 0xfc, 0x06,
+ 0xf6, 0x00,
+ 0xf7, 0x1d,
+ 0xf8, 0x84,
+ 0xfa, 0x00,
+ 0xf9, 0xfe,
+ 0xf2, 0x0f,
+ ////////////////////////////////////////////////////
+ ////////////////// Analog & Cisctl ////////////////
+ ////////////////////////////////////////////////////
+ 0xfe, 0x00,
+ 0x03, 0x04,
+ 0x04, 0x00,
+ 0x05, 0x01,
+ 0x06, 0x68,
+ 0x09, 0x00,
+ 0x0a, 0x00,
+ 0x0b, 0x00,
+ 0x0c, 0x00,
+ 0x0d, 0x04,
+ 0x0e, 0xc0,
+ 0x0f, 0x06,
+ 0x10, 0x52,
+ 0x12, 0x2e,
+ 0x17, 0x14,
+ 0x18, 0x02,
+ 0x19, 0x0f,
+ 0x1a, 0x01,
+ 0x1b, 0x4b,
+ 0x1c, 0x07,
+ 0x1d, 0x10,
+ 0x1e, 0x98,
+ 0x1f, 0x78,
+ 0x20, 0x03,
+ 0x21, 0x40,
+ 0x22, 0xB0,
+ 0x24, 0x16,
+ 0x25, 0x01,
+ 0x26, 0x10,
+ 0x2d, 0x40,
+ 0x30, 0x01,
+ 0x33, 0x01,
+ 0x34, 0x01,
+ /////////////////////////////////////////////////
+ ////////////////// ISP reg //////////////////////
+ ////////////////////////////////////////////////////
+ 0x80, 0xff,
+ 0x81, 0x24,
+ 0x82, 0xfE,
+ 0x83, 0x00,
+ 0x84, 0x02,
+ 0x86, 0x02,
+ 0x88, 0x03,
+ 0x89, 0x03,
+ 0x85, 0x30,
+ 0x8a, 0x00,
+ 0x8b, 0x00,
+ 0xb0, 0x50,
+ 0xc3, 0x00,
+ 0xc4, 0x18,
+ 0xc5, 0x20,
+ 0xc6, 0x38,
+ 0xc7, 0x40,
+ 0xec, 0x06,
+ 0xed, 0x04,
+ 0xee, 0x60,
+ 0xef, 0x90,
+ 0xb6, 0x01,
+ 0x90, 0x01,
+ 0x91, 0x00,
+ 0x92, 0x00,
+ 0x93, 0x00,
+ 0x94, 0x00,
+ 0x95, 0x04,
+ 0x96, 0xb0,
+ 0x97, 0x06,
+ 0x98, 0x40,
+
+ ///////////////////////////////////////////////
+ /////////// BLK ////////////////////////
+ ///////////////////////////////////////////////
+ 0x18, 0x02,
+ 0x40, 0x42,
+ 0x41, 0x00,
+ 0x43, 0x54,
+ 0x5e, 0x00,
+ 0x5f, 0x00,
+ 0x60, 0x00,
+ 0x61, 0x00,
+ 0x62, 0x00,
+ 0x63, 0x00,
+ 0x64, 0x00,
+ 0x65, 0x00,
+ 0x66, 0x20,
+ 0x67, 0x20,
+ 0x68, 0x20,
+ 0x69, 0x20,
+ 0x6a, 0x00,
+ 0x6b, 0x00,
+ 0x6c, 0x00,
+ 0x6d, 0x00,
+ 0x6e, 0x00,
+ 0x6f, 0x00,
+ 0x70, 0x00,
+ 0x71, 0x00,
+ 0x72, 0xf0,
+ 0x7e, 0x3c,
+ 0x7f, 0x00,
+ 0xfe, 0x02,
+ 0x49, 0x04,
+ 0xfe, 0x00,
+ ///////////////////////////////////////////////
+ /////////// AEC ////////////////////////
+ ///////////////////////////////////////////////
+ 0xfe, 0x01,
+ 0x01, 0x04,
+ 0x02, 0xc0,
+ 0x03, 0x04,
+ 0x04, 0x90,
+ 0x05, 0x30,
+ 0x06, 0x90,
+ 0x07, 0x20,
+ 0x08, 0x70,
+ 0x09, 0x00,
+ 0x0a, 0xc2,
+ 0x0b, 0x11,
+ 0x0c, 0x00,
+ 0x13, 0x30,
+ 0x17, 0x00,
+ 0x1c, 0x11,
+ 0x1e, 0x61,
+ 0x1f, 0x30,
+ 0x20, 0x40,
+ 0x22, 0x80,
+ 0x23, 0x20,
+ 0x12, 0x35,
+ 0x15, 0x50,
+ 0x10, 0x31,
+ 0x3e, 0x28,
+ 0x3f, 0xe0,
+ 0x40, 0xe0,
+ 0x41, 0x0f,
+
+ /////////////////////////////
+ //////// INTPEE /////////////
+ /////////////////////////////
+ 0xfe, 0x02,
+ 0x90, 0x6c,
+ 0x91, 0x02,
+ 0x92, 0x44,
+ 0x97, 0x36,
+ 0xa2, 0x11,
+ 0xfe, 0x00,
+
+ /////////////////////////////
+ //////// DNDD///////////////
+ /////////////////////////////
+ 0xfe, 0x02,
+ 0x80, 0xe1,
+ 0x81, 0x08,
+ 0x82, 0x05,
+ 0x83, 0x1f,
+ 0x84, 0x0a,
+ 0x86, 0x50,
+ 0x87, 0x30,
+ 0x88, 0x15,
+ 0x89, 0x60,
+ 0x8a, 0x40,
+ 0x8b, 0x20,
+
+ ///////////////////////////////////////////////
+ /////////// ASDE ////////////////////////
+ ///////////////////////////////////////////////
+ 0xfe, 0x01,
+ 0x21, 0x14,
+ 0xfe, 0x02,
+ 0x4b, 0x00,
+ 0xa3, 0x40,
+ 0xa4, 0x20,
+ 0xa5, 0x10,
+ 0xa6, 0x20,
+ 0xab, 0x40,
+ 0xae, 0x0c,
+ 0xb3, 0x42,
+ 0xb4, 0x24,
+ 0xb6, 0x40,
+ 0xb7, 0x01,
+ 0xb9, 0x32,
+ 0xfe, 0x00,
+
+ ///////////////////gamma1////////////////////
+ ////Gamma
+ 0xfe, 0x02,
+ 0x10, 0x06,
+ 0x11, 0x0d,
+ 0x12, 0x15,
+ 0x13, 0x1b,
+ 0x14, 0x2a,
+ 0x15, 0x38,
+ 0x16, 0x48,
+ 0x17, 0x55,
+ 0x18, 0x6b,
+ 0x19, 0x7e,
+ 0x1a, 0x92,
+ 0x1b, 0xa3,
+ 0x1c, 0xaf,
+ 0x1d, 0xc5,
+ 0x1e, 0xd5,
+ 0x1f, 0xe0,
+ 0x20, 0xe7,
+ 0x21, 0xee,
+ 0x22, 0xf1,
+ 0x23, 0xf8,
+ 0x24, 0xfd,
+ 0x25, 0xff,
+
+ ///////////////////gamma2////////////////////
+ ////Gamma
+ 0xfe, 0x02,
+ 0x26, 0x06,
+ 0x27, 0x10,
+ 0x28, 0x18,
+ 0x29, 0x1d,
+ 0x2a, 0x26,
+ 0x2b, 0x2d,
+ 0x2c, 0x33,
+ 0x2d, 0x3a,
+ 0x2e, 0x45,
+ 0x2f, 0x50,
+ 0x30, 0x5a,
+ 0x31, 0x62,
+ 0x32, 0x6b,
+ 0x33, 0x7b,
+ 0x34, 0x8a,
+ 0x35, 0x99,
+ 0x36, 0xa7,
+ 0x37, 0xb4,
+ 0x38, 0xbf,
+ 0x39, 0xd7,
+ 0x3a, 0xec,
+ 0x3b, 0xff,
+
+ ///////////////////////////////////////////////
+ /////////// YCP ///////////////////////
+ ///////////////////////////////////////////////
+ 0xfe, 0x02,
+ 0xd1, 0x28,
+ 0xd2, 0x28,
+ 0xdd, 0x14,
+ 0xde, 0x84,
+
+ ////////////////////////////
+ //////// LSC ///////////////
+ ////////////////////////////
+ 0xfe, 0x01,
+ 0xc2, 0x13,
+ 0xc3, 0x05,
+ 0xc4, 0x01,
+ 0xc8, 0x10,
+ 0xc9, 0x0b,
+ 0xca, 0x06,
+ 0xbc, 0x34,
+ 0xbd, 0x21,
+ 0xbe, 0x16,
+ 0xb6, 0x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01,
+ 0x7f, 0x08,
+ 0x76, 0x70,
+ 0x77, 0x58,
+ 0x78, 0xd8,
+ 0xfe, 0x00,
+
+ //////////////////////////////////////////
+ /////////// CC ////////////////////////
+ //////////////////////////////////////////
+ 0xfe, 0x02,
+ 0xc0, 0x01,
+ 0xc1, 0x50,
+ 0xc2, 0x00,
+ 0xc3, 0x00,
+ 0xc4, 0xf0,
+ 0xc5, 0x45,
+ 0xc6, 0xf0,
+ 0xc7, 0x40,
+ 0xc8, 0x00,
+ 0xc9, 0x00,
+ 0xca, 0x00,
+ 0xcb, 0x40,
+ 0xcc, 0x00,
+ 0xcd, 0x40,
+ 0xce, 0x00,
+ 0xcf, 0x00,
+ 0xe3, 0x00,
+ 0xe4, 0x40,
+ 0xe5, 0x00,
+ 0xfe, 0x00,
+ 0xf2, 0x0f,
+
+ //////////////////////////////////////////
+ /////////// BUF ////////////////////////
+ //////////////////////////////////////////
+ 0xfe, 0x03,
+ 0x40, 0x00,
+ 0x41, 0x00,
+ 0x42, 0x40,
+ 0x43, 0x06,
+ 0x04, 0x20,
+ 0x06, 0x00,
+ 0x17, 0xe0,
+ 0xfe, 0x00,
+
+ //////////////frame rate 50Hz
+ 0xfe, 0x00,
+ 0x05, 0x02,
+ 0x06, 0x2d,
+ 0x07, 0x00,
+ 0x08, 0xa0,
+ 0xfe, 0x01,
+ 0x25, 0x00,
+ 0x26, 0xd4,
+ 0x27, 0x04,
+ 0x28, 0xf8,
+ 0x29, 0x08,
+ 0x2a, 0x48,
+ 0x2b, 0x0b,
+ 0x2c, 0x98,
+ 0x2d, 0x0f,
+ 0x2e, 0xbc,
+ 0xfe, 0x00,
+};
+
+uint8_t gc2155_default_regs_exit[]={
+
+};
+
+#endif