From 871480933a1c28f8a9fed4c4d34d06c439a7a422 Mon Sep 17 00:00:00 2001 From: Srikant Patnaik Date: Sun, 11 Jan 2015 12:28:04 +0530 Subject: Moved, renamed, and deleted files The original directory structure was scattered and unorganized. Changes are basically to make it look like kernel structure. --- .../media/video/wmt_v4l2/sensors/ov2659/ov2659.c | 346 ++++++ .../media/video/wmt_v4l2/sensors/ov2659/ov2659.h | 1197 ++++++++++++++++++++ 2 files changed, 1543 insertions(+) create mode 100755 drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.c create mode 100755 drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.h (limited to 'drivers/media/video/wmt_v4l2/sensors/ov2659') diff --git a/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.c b/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.c new file mode 100755 index 00000000..b6e2d636 --- /dev/null +++ b/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.c @@ -0,0 +1,346 @@ +/* + * Driver for ov2659 CMOS Image Sensor from Omnivision + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include "../cmos-subdev.h" +#include "../../wmt-vid.h" +#include "ov2659.h" + +//#define sensor_write_array(sd, arr, sz) cmos_init_16bit_addr(arr, sz, (sd)->i2c_addr) + +#define sensor_read(sd, reg) \ + wmt_vid_i2c_read16addr(sd->i2c_addr, reg) + +#define sensor_write(sd, reg, val) \ + wmt_vid_i2c_write16addr(sd->i2c_addr, reg, val) + +static void sensor_write_array(struct cmos_subdev *sd, uint32_t *arr, size_t sz) +{ + uint32_t reg, data; + int i; + + for (i = 0; i < sz; i += 2) { + reg = arr[i]; + data = arr[i+1]; + + if (reg == 0xffff) + msleep(data); + else + wmt_vid_i2c_write16addr(sd->i2c_addr, reg ,data); + } +} + +struct cmos_win_size { + char *name; + int width; + int height; + uint32_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) } + +static const struct cmos_win_size cmos_supported_win_sizes[] = { + CMOS_WIN_SIZE("VGA", 640, 480, ov2659_640_480_regs), + CMOS_WIN_SIZE("SVGA", 800, 600, ov2659_800_600_regs), + CMOS_WIN_SIZE("720p", 1280, 720, ov2659_1280_720_regs), + CMOS_WIN_SIZE("UXGA", 1600, 1200, ov2659_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) +{ + uint32_t *regs; + size_t size; + + switch (value) { + case WHITE_BALANCE_AUTO: + regs = ov2659_wb_auto; + size = ARRAY_SIZE(ov2659_wb_auto); + break; + case WHITE_BALANCE_INCANDESCENCE: + regs = ov2659_wb_incandescent; + size = ARRAY_SIZE(ov2659_wb_incandescent); + break; + case WHITE_BALANCE_DAYLIGHT: + regs = ov2659_wb_daylight; + size = ARRAY_SIZE(ov2659_wb_daylight); + break; + case WHITE_BALANCE_CLOUDY: + regs = ov2659_wb_cloudy; + size = ARRAY_SIZE(ov2659_wb_cloudy); + break; + case WHITE_BALANCE_FLUORESCENT: + regs = ov2659_wb_fluorescent; + size = ARRAY_SIZE(ov2659_wb_fluorescent); + break; + default: + return -EINVAL; + } + + sensor_write_array(sd, regs, size); + msleep(100); + return 0; +} + +static int sensor_s_scenemode(struct cmos_subdev *sd, enum v4l2_scene_mode value) +{ + uint32_t *regs; + size_t size; + + switch (value) { + case SCENE_MODE_AUTO: + regs = ov2659_scene_mode_auto; + size = ARRAY_SIZE(ov2659_scene_mode_auto); + break; + case SCENE_MODE_NIGHTSHOT: + regs = ov2659_scene_mode_night; + size = ARRAY_SIZE(ov2659_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) +{ + uint32_t *regs; + size_t size; + + switch (value) { + case -2: + regs = ov2659_exposure_neg6; + size = ARRAY_SIZE(ov2659_exposure_neg6); + break; + case -1: + regs = ov2659_exposure_neg3; + size = ARRAY_SIZE(ov2659_exposure_neg3); + break; + case 0: + regs = ov2659_exposure_zero; + size = ARRAY_SIZE(ov2659_exposure_zero); + break; + case 1: + regs = ov2659_exposure_pos3; + size = ARRAY_SIZE(ov2659_exposure_pos3); + break; + case 2: + regs = ov2659_exposure_pos6; + size = ARRAY_SIZE(ov2659_exposure_pos6); + break; + default: + return -EINVAL; + } + + sensor_write_array(sd, regs, size); + return 0; +} + +static int sensor_s_hflip(struct cmos_subdev *sd, int value) +{ + uint32_t data = sensor_read(sd, 0x3821); + + switch (value) { + case 0: + data &= ~0x06; + break; + case 1: + data |= 0x06; + break; + default: + return -EINVAL; + } + + return sensor_write(sd, 0x3821, data); +} + +static int sensor_s_vflip(struct cmos_subdev *sd, int value) +{ + uint32_t data = sensor_read(sd, 0x3820); + + switch (value) { + case 0: + data &= ~0x06; + break; + case 1: + data |= 0x06; + break; + default: + return -EINVAL; + } + + return sensor_write(sd, 0x3820, data); +} + +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); + default: + case WMT_V4L2_CID_CAMERA_FLASH: + 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; + + 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); + 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, 0x300a) & 0xff) << 8; + data |= (sensor_read(sd, 0x300b) & 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, ov2659_default_regs_init, + ARRAY_SIZE(ov2659_default_regs_init)); + return 0; +} + +static int sensor_exit(struct cmos_subdev *sd) +{ + sensor_write_array(sd, ov2659_default_regs_exit, + ARRAY_SIZE(ov2659_default_regs_exit)); + return 0; +} + +static struct cmos_subdev_ops ov2659_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 ov2659 = { + .name = "ov2659", + .i2c_addr = 0x30, + .id = 0x2656, + .max_width = 1600, + .max_height = 1200, + .ops = &ov2659_ops, +}; + +#if 0 +static int __init ov2659_init(void) +{ + return cmos_register_sudbdev(&ov2659); +} + +static void __exit ov2659_exit(void) +{ + cmos_unregister_subdev(&ov2659); + return; +} + +module_init(ov2659_init); +module_exit(ov2659_exit); + +MODULE_LICENSE("GPL"); +#endif diff --git a/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.h b/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.h new file mode 100755 index 00000000..c5c8b8f3 --- /dev/null +++ b/drivers/media/video/wmt_v4l2/sensors/ov2659/ov2659.h @@ -0,0 +1,1197 @@ +#ifndef OV2659_H +#define OV2659_H + +#define STREAMING_DELAY_MS 300 + +// Scene Mode +uint32_t ov2659_scene_mode_auto[] = { +// 0x3208, 0x00, + + 0x3A00, 0x3c, + 0x3a02, 0x03, + 0x3a03, 0x9c, + 0x3a14, 0x03, + 0x3a15, 0x9c, + +// 0x3208, 0x10, +// 0x3208, 0xa0, + +}; + +uint32_t ov2659_scene_mode_night[] = { +// 0x3208, 0x00, + + 0x3A00, 0x3c, + 0x3a02, 0x0e, + 0x3a03, 0x70, + 0x3a14, 0x0e, + 0x3a15, 0x70, + +// 0x3208, 0x10, +// 0x3208, 0xa0, +}; + + +// White Balance +uint32_t ov2659_wb_auto [] = { + 0x3406, 0x00, +}; + +uint32_t ov2659_wb_incandescent [] = { + 0x3208, 0x00, + + 0x3406, 0x01, + + 0x3400, 0x04, + 0x3401, 0xe0, + 0x3402, 0x04, + 0x3403, 0x00, + 0x3404, 0x05, + 0x3405, 0xa0, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_wb_fluorescent [] = { + 0x3208, 0x00, + + 0x3406, 0x01, + + 0x3400, 0x04, + 0x3401, 0x00, + 0x3402, 0x04, + 0x3403, 0x00, + 0x3404, 0x06, + 0x3405, 0x50, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_wb_daylight [] = { + 0x3208, 0x00, + + 0x3406, 0x01, + + 0x3400, 0x06, + 0x3401, 0x10, + 0x3402, 0x04, + 0x3403, 0x00, + 0x3404, 0x04, + 0x3405, 0x48, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_wb_cloudy [] = { + 0x3208, 0x00, + + 0x3406, 0x01, + + 0x3400, 0x06, + 0x3401, 0x30, + 0x3402, 0x04, + 0x3403, 0x00, + 0x3404, 0x04, + 0x3405, 0x30, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_wb_tungsten [] = { + 0x3208, 0x00, + + 0x3406, 0x01, + + 0x3400, 0x05, + 0x3401, 0x48, + 0x3402, 0x04, + 0x3403, 0x00, + 0x3404, 0x05, + 0x3405, 0xe0, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + + +// Exposure +uint32_t ov2659_exposure_neg6[] = { + 0x3208, 0x00, + + 0x3a0f, 0x18, + 0x3a10, 0x10, + 0x3a11, 0x30, + 0x3a1b, 0x18, + 0x3a1e, 0x10, + 0x3a1f, 0x08, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_exposure_neg3[] = { + 0x3208, 0x00, + + 0x3a0f, 0x28, + 0x3a10, 0x20, + 0x3a11, 0x50, + 0x3a1b, 0x28, + 0x3a1e, 0x20, + 0x3a1f, 0x10, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_exposure_zero[] = { + 0x3208, 0x00, + + 0x3a0f, 0x30, + 0x3a10, 0x28, + 0x3a11, 0x61, + 0x3a1b, 0x30, + 0x3a1e, 0x28, + 0x3a1f, 0x14, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_exposure_pos3[] = { + 0x3208, 0x00, + + 0x3a0f, 0x38, + 0x3a10, 0x30, + 0x3a11, 0x80, + 0x3a1b, 0x38, + 0x3a1e, 0x30, + 0x3a1f, 0x18, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_exposure_pos6[] = { + 0x3208, 0x00, + + 0x3a0f, 0x58, + 0x3a10, 0x68, + 0x3a11, 0xb0, + 0x3a1b, 0xa8, + 0x3a1e, 0x60, + 0x3a1f, 0x40, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +/* + * The color effect settings + */ +uint32_t ov2659_colorfx_none[] = { + 0x3208, 0x00, + + 0x5001, 0x1f, + 0x507B, 0x06, + 0x507e, 0x3a, + 0x507f, 0x10, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_colorfx_bw[] = { + 0x3208, 0x00, + + 0x5001, 0x1f, + 0x507B, 0x26, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_colorfx_sepia[] = { + 0x3208, 0x00, + + 0x5001, 0x1f, + 0x507B, 0x1e, + 0x507e, 0x40, + 0x507f, 0xa0, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_colorfx_negative[] = { + 0x3208, 0x00, + + 0x5001, 0x1f, + 0x507B, 0x46, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_colorfx_emboss[] = { + +}; + +uint32_t ov2659_colorfx_sketch[] = { +}; + +uint32_t ov2659_colorfx_sky_blue[] = { +}; + +uint32_t ov2659_colorfx_grass_green[] = { +}; + +uint32_t ov2659_colorfx_skin_whiten[] = { +}; + +uint32_t ov2659_colorfx_vivid[] = { +}; + +// Brightness +uint32_t ov2659_brightness_neg4[] = { + 0x3208, 0x00, + + 0x5082, 0x40, + 0x5083, 0x09, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_neg3[] = { + 0x3208, 0x00, + + 0x5082, 0x30, + 0x5083, 0x09, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_neg2[] = { + 0x3208, 0x00, + + 0x5082, 0x20, + 0x5083, 0x09, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_neg1[] = { + 0x3208, 0x00, + + 0x5082, 0x10, + 0x5083, 0x09, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_zero[] = { + 0x3208, 0x00, + + 0x5082, 0x00, + 0x5083, 0x01, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_pos1[] = { + 0x3208, 0x00, + + 0x5082, 0x10, + 0x5083, 0x01, + + 0x3208, 0x10, + 0x3208, 0xa0, + +}; + +uint32_t ov2659_brightness_pos2[] = { + 0x3208, 0x00, + + 0x5082, 0x20, + 0x5083, 0x01, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_pos3[] = { + 0x3208, 0x00, + + 0x5082, 0x30, + 0x5083, 0x01, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_brightness_pos4[] = { + 0x3208, 0x00, + + 0x5082, 0x40, + 0x5083, 0x01, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +// Contrast +uint32_t ov2659_contrast_neg4[] = { + 0x3208, 0x00, + + 0x5080, 0x10, + 0x5081, 0x10, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_neg3[] = { + 0x3208, 0x00, + + 0x5080, 0x14, + 0x5081, 0x14, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_neg2[] = { + 0x3208, 0x00, + + 0x5080, 0x18, + 0x5081, 0x18, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_neg1[] = { + 0x3208, 0x00, + + 0x5080, 0x1c, + 0x5081, 0x1c, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_zero[] = { + 0x3208, 0x00, + + 0x5080, 0x20, + 0x5081, 0x20, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_pos1[] = { + 0x3208, 0x00, + + 0x5080, 0x24, + 0x5081, 0x24, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_pos2[] = { + 0x3208, 0x00, + + 0x5080, 0x28, + 0x5081, 0x28, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_pos3[] = { + 0x3208, 0x00, + + 0x5080, 0x2c, + 0x5081, 0x2c, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_contrast_pos4[] = { + 0x3208, 0x00, + + 0x5080, 0x30, + 0x5081, 0x30, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +// Saturation +uint32_t ov2659_saturation_neg4[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//0.6 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_neg3[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//0.7 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_neg2[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//0.8 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_neg1[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//0.9 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_zero[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//1.0 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_pos1[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//1.1 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_pos2[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//1.2 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_pos3[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//1.3 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + +uint32_t ov2659_saturation_pos4[] = { + 0x3208, 0x00, + + 0x5073, 0x1a,//1.4 + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + + 0x3208, 0x10, + 0x3208, 0xa0, +}; + + +// Resolution +uint32_t ov2659_640_480_regs[]={ + 0x0100, 0x00, + + 0x3a00, 0x3c, +// 0x3406, 0x00, + 0x3503, 0x00, + + 0x5066, 0x28, + 0x5067, 0x10, + 0x506a, 0x0c, + 0x506b, 0x1c, + + 0x3800, 0x00, + 0x3801, 0x00, + 0x3802, 0x00, + 0x3803, 0x00, + 0x3804, 0x06, + 0x3805, 0x5f, + 0x3806, 0x04, + 0x3807, 0xb7, + 0x3808, 0x02, + 0x3809, 0x80, + 0x380a, 0x01, + 0x380b, 0xe0, + 0x3811, 0x08, + 0x3813, 0x02, + 0x3814, 0x31, + 0x3815, 0x31, + + 0x3820, 0x81, + 0x3821, 0x01, + 0x5002, 0x10, + 0x4608, 0x00, + 0x4609, 0xa0, + + 0x3623, 0x00, + 0x3634, 0x76, + 0x3701, 0x44, + 0x3208, 0xa1, + 0x3705, 0x0c, + 0x370a, 0x52, + + 0x3003, 0x80, + 0x3004, 0x10, + 0x3005, 0x18, + 0x3006, 0x0d, + + 0x380c, 0x05, + 0x380d, 0x14, + 0x380e, 0x02, + 0x380f, 0x68, + + 0x3a08, 0x00, + 0x3a09, 0xb9, + 0x3a0e, 0x03, + 0x3a0a, 0x00, + 0x3a0b, 0x9a, + 0x3a0d, 0x04, + + 0x0100, 0x01, + + 0x301d, 0x08, + //delay 10ms + 0xffff, 10, + + 0x301d, 0x00, + + 0xffff, STREAMING_DELAY_MS, + + //必须重新调用白平衡菜单 +}; + +uint32_t ov2659_800_600_regs[]={ + 0x0100, 0x00, + + 0x3a00, 0x3c, + 0x3406, 0x00, + 0x3503, 0x00, + + 0x5066, 0x28, + 0x5067, 0x10, + 0x506a, 0x0c, + 0x506b, 0x1c, + + 0x3800, 0x00, + 0x3801, 0x00, + 0x3802, 0x00, + 0x3803, 0x00, + 0x3804, 0x06, + 0x3805, 0x5f, + 0x3806, 0x04, + 0x3807, 0xb7, + 0x3808, 0x03, + 0x3809, 0x20, + 0x380a, 0x02, + 0x380b, 0x58, + 0x3811, 0x08, + 0x3813, 0x02, + 0x3814, 0x31, + 0x3815, 0x31, + + 0x3820, 0x81, + 0x3821, 0x01, + 0x5002, 0x00, + 0x4608, 0x00, + 0x4609, 0x80, + + 0x3623, 0x00, + 0x3634, 0x76, + 0x3701, 0x44, + 0x3208, 0xa1, + 0x3705, 0x0c, + 0x370a, 0x52, + + 0x3003, 0x80, + 0x3004, 0x10, + 0x3005, 0x18, + 0x3006, 0x0d, + + 0x380c, 0x05, + 0x380d, 0x14, + 0x380e, 0x02, + 0x380f, 0x68, + + 0x3a08, 0x00, + 0x3a09, 0xb9, + 0x3a0e, 0x03, + 0x3a0a, 0x00, + 0x3a0b, 0x9a, + 0x3a0d, 0x04, + + 0x0100, 0x01, + + 0x301d, 0x08, + //delay 10ms + 0xffff, 10, + + 0x301d, 0x00, + + 0xffff, STREAMING_DELAY_MS, + //必须重新调用白平衡菜单 +}; + +uint32_t ov2659_1280_720_regs[]={ + 0x0103, 0x01, + //delay 5ms + 0xffff, 5, + + 0x3000, 0x0f, + 0x3001, 0xff, + 0x3002, 0xff, + 0x0100, 0x01, + 0x3633, 0x3d, + 0x3620, 0x02, + 0x3631, 0x11, + 0x3612, 0x04, + 0x3630, 0x20, + 0x4702, 0x02, + 0x370c, 0x34, + + 0x4003, 0x88, + + 0x3800, 0x00, + 0x3801, 0xa0, + 0x3802, 0x00, + 0x3803, 0xf0, + 0x3804, 0x05, + 0x3805, 0xbf, + 0x3806, 0x03, + 0x3807, 0xcb, + 0x3808, 0x05, + 0x3809, 0x00, + 0x380a, 0x02, + 0x380b, 0xd0, + 0x3811, 0x10, + 0x3813, 0x06, + 0x3814, 0x11, + 0x3815, 0x11, + + 0x3820, 0x80, + 0x3821, 0x00, + 0x5002, 0x00, + 0x4608, 0x00, + 0x4609, 0x80, + + 0x3623, 0x02, + 0x3634, 0x44, + 0x3701, 0x41, + 0x3208, 0xa1, + + 0x3208, 0x02, + 0x3702, 0x30, + 0x3703, 0x48, + 0x3704, 0x48, + 0x3208, 0x12, + 0x3208, 0xa2, + + 0x3705, 0x18, + 0x370a, 0x12, + + 0x3003, 0x80, + 0x3004, 0x10,//30fps + 0x3005, 0x24, + 0x3006, 0x0d, + + 0x380c, 0x06, + 0x380d, 0x4c, + 0x380e, 0x02, + 0x380f, 0xe8, + + 0x3a08, 0x00, + 0x3a09, 0xdf, + 0x3a0e, 0x03, + 0x3a0a, 0x00, + 0x3a0b, 0xba, + 0x3a0d, 0x04, + + 0x350c, 0x00, + 0x350d, 0x00, + 0x4300, 0x30, + 0x5086, 0x02, + 0x5000, 0xfb, + 0x5001, 0x1f, + 0x507e, 0x32, + 0x507f, 0x10, + 0x507c, 0x80, + 0x507d, 0x00, + 0x507b, 0x06, + + 0x5025, 0x06, + 0x5026, 0x0c, + 0x5027, 0x19, + 0x5028, 0x34, + 0x5029, 0x4e, + 0x502a, 0x5f, + 0x502b, 0x6d, + 0x502c, 0x78, + 0x502d, 0x84, + 0x502e, 0x95, + 0x502f, 0xa5, + 0x5030, 0xb4, + 0x5031, 0xcc, + 0x5032, 0xe2, + 0x5033, 0xf6, + 0x5034, 0x11, + + 0x5070, 0x28, + 0x5071, 0x48, + 0x5072, 0x10, + 0x5073, 0x1b, + 0x5074, 0xd0, + 0x5075, 0xeb, + 0x5076, 0xeb, + 0x5077, 0xe0, + 0x5078, 0x0b, + 0x5079, 0x98, + 0x507a, 0x01, + + 0x5035, 0x6a, + 0x5036, 0x11, + 0x5037, 0x92, + 0x5038, 0x21, + 0x5039, 0xe1, + 0x503a, 0x01, + 0x503c, 0x10, + 0x503d, 0x10, + 0x503e, 0x10, + 0x503f, 0x62, + 0x5040, 0x5c, + 0x5041, 0x0e, + 0x5042, 0x9c, + 0x5043, 0x20, + 0x5044, 0x36, + 0x5045, 0x22, + 0x5046, 0x5c, + 0x5047, 0xf8, + 0x5048, 0x08, + 0x5049, 0x70, + 0x504a, 0xf0, + 0x504b, 0xf0, + + 0x5000, 0xfb, + 0x500c, 0x03, + 0x500d, 0x22, + 0x500e, 0x02, + 0x500f, 0x64, + 0x5010, 0x5a, + 0x5011, 0x18, + 0x5012, 0x66, + 0x5013, 0x03, + 0x5014, 0x24, + 0x5015, 0x02, + 0x5016, 0x60, + 0x5017, 0x58, + 0x5018, 0x10, + 0x5019, 0x66, + 0x501a, 0x03, + 0x501b, 0x16, + 0x501c, 0x02, + 0x501d, 0x68, + 0x501e, 0x50, + 0x501f, 0x10, + 0x5020, 0x66, + + 0x506e, 0x44, + 0x5064, 0x08, + 0x5065, 0x10, + 0x5066, 0x16, + 0x5067, 0x10, + 0x506c, 0x08, + 0x506d, 0x10, + 0x506f, 0xa6, + 0x5068, 0x08, + 0x5069, 0x10, + 0x506a, 0x18, + 0x506b, 0x28, + 0x5084, 0x10, + 0x5085, 0x3c, + 0x5005, 0x80, + + 0x3a0f, 0x30, + 0x3a10, 0x28, + 0x3a11, 0x61, + 0x3a1b, 0x30, + 0x3a1e, 0x28, + 0x3a1f, 0x14, + + 0x5060, 0x69, + 0x5061, 0xbe, + 0x5062, 0xbe, + 0x5063, 0x69, + + 0x3a19, 0x38, + 0x4009, 0x02, + + 0x3503, 0x00, + + 0x3a00, 0x38, + 0x3a05, 0x30, + 0x3a14, 0x02, + 0x3a15, 0xe8, + 0x3a02, 0x02, + 0x3a03, 0xe8, + + 0x3011, 0x82, +}; + +uint32_t ov2659_1600_1200_regs[]={ + 0x0100, 0x00, + + 0x3a00, 0x38, + 0x3406, 0x01, + 0x3503, 0x07, + + 0x5066, 0x20, + 0x5067, 0x08, + 0x506a, 0x0c, + 0x506b, 0x1c, + + 0x3800, 0x00, + 0x3801, 0x00, + 0x3802, 0x00, + 0x3803, 0x00, + 0x3804, 0x06, + 0x3805, 0x5f, + 0x3806, 0x04, + 0x3807, 0xbb, + 0x3808, 0x06, + 0x3809, 0x40, + 0x380a, 0x04, + 0x380b, 0xb0, + 0x3811, 0x10, + 0x3813, 0x06, + 0x3814, 0x11, + 0x3815, 0x11, + + 0x3820, 0x80, + 0x3821, 0x00, + 0x5002, 0x00, + 0x4608, 0x00, + 0x4609, 0x80, + + 0x3623, 0x00, + 0x3634, 0x44, + 0x3701, 0x44, + 0x3208, 0xa2, + 0x3705, 0x18, + 0x370a, 0x12, + + 0x3003, 0x80, + 0x3004, 0x20, + 0x3005, 0x24, + 0x3006, 0x0d, + + 0x380c, 0x07, + 0x380d, 0x9f, + 0x380e, 0x04, + 0x380f, 0xd0, + + 0x3a08, 0x00, + 0x3a09, 0x5c, + 0x3a0e, 0x0d, + 0x3a0a, 0x00, + 0x3a0b, 0x4d, + 0x3a0d, 0x10, + + 0x4003, 0x88, + + 0x0100, 0x01, + 0xffff, STREAMING_DELAY_MS, +}; + +// init +uint32_t ov2659_default_regs_init[]={ + 0x0103, 0x01, + //delay 5ms + 0xffff, 5, + + 0x3000, 0x0f, + 0x3001, 0xff, + 0x3002, 0xff, + 0x0100, 0x01, + 0x3633, 0x3d, + 0x3620, 0x02, + 0x3631, 0x11, + 0x3612, 0x04, + 0x3630, 0x20, + 0x4702, 0x02, + 0x370c, 0x34, + + 0x4003, 0x88, + + 0x3800, 0x00, + 0x3801, 0x00, + 0x3802, 0x00, + 0x3803, 0x00, + 0x3804, 0x06, + 0x3805, 0x5f, + 0x3806, 0x04, + 0x3807, 0xb7, + 0x3808, 0x03, + 0x3809, 0x20, + 0x380a, 0x02, + 0x380b, 0x58, + 0x3811, 0x08, + 0x3813, 0x02, + 0x3814, 0x31, + 0x3815, 0x31, + + 0x3820, 0x81, + 0x3821, 0x01, + 0x5002, 0x00, + 0x4608, 0x00, + 0x4609, 0x80, + + 0x3623, 0x00, + 0x3634, 0x76, + 0x3701, 0x44, + + 0x3208, 0x01, + 0x3702, 0x18, + 0x3703, 0x24, + 0x3704, 0x24, + 0x3208, 0x11, + + 0x3208, 0x02, + 0x3702, 0x30, + 0x3703, 0x48, + 0x3704, 0x48, + 0x3208, 0x12, + + 0x3705, 0x0c, + 0x370a, 0x52, + + 0x3003, 0x80, + 0x3004, 0x10, + 0x3005, 0x18, + 0x3006, 0x0d, + + 0x380c, 0x05, + 0x380d, 0x14, + 0x380e, 0x02, + 0x380f, 0x68, + + 0x3a08, 0x00, + 0x3a09, 0xb9, + 0x3a0e, 0x03, + 0x3a0a, 0x00, + 0x3a0b, 0x9a, + 0x3a0d, 0x04, + + 0x3a00, 0x3c, + 0x3a02, 0x03, + 0x3a03, 0x9c, + 0x3a14, 0x03, + 0x3a15, 0x9c, + + 0x350c, 0x00, + 0x350d, 0x00, + 0x4300, 0x30, + 0x5086, 0x02, + 0x5000, 0xfb, + 0x5001, 0x1f, + 0x507e, 0x3a, + 0x507f, 0x10, + 0x507c, 0x80, + 0x507d, 0x00, + 0x507b, 0x06, + + 0x5025, 0x06, + 0x5026, 0x0c, + 0x5027, 0x1c, + 0x5028, 0x36, + 0x5029, 0x4e, + 0x502a, 0x5f, + 0x502b, 0x6d, + 0x502c, 0x78, + 0x502d, 0x84, + 0x502e, 0x95, + 0x502f, 0xa5, + 0x5030, 0xb4, + 0x5031, 0xc8, + 0x5032, 0xde, + 0x5033, 0xf0, + 0x5034, 0x15, + + 0x5070, 0x28, + 0x5071, 0x48, + 0x5072, 0x10, + 0x5073, 0x1a, + 0x5074, 0xc8, + 0x5075, 0xe2, + 0x5076, 0xe2, + 0x5077, 0xd8, + 0x5078, 0x0a, + 0x5079, 0x98, + 0x507a, 0x01, + + 0x5035, 0x6a, + 0x5036, 0x11, + 0x5037, 0x92, + 0x5038, 0x25, + 0x5039, 0xe1, + 0x503a, 0x01, + 0x503c, 0x11, + 0x503d, 0x10, + 0x503e, 0x10, + 0x503f, 0x5a, + 0x5040, 0x51, + 0x5041, 0x0e, + 0x5042, 0xa0, + 0x5043, 0x49, + 0x5044, 0x34, + 0x5045, 0x22, + 0x5046, 0x3f, + 0x5047, 0xf8, + 0x5048, 0x08, + 0x5049, 0x70, + 0x504a, 0xf0, + 0x504b, 0xf0, + + 0x5000, 0xfb, + 0x500c, 0x03, + 0x500d, 0x1d, + 0x500e, 0x02, + 0x500f, 0x63, + 0x5010, 0x60, + 0x5011, 0x00, + 0x5012, 0x66, + 0x5013, 0x03, + 0x5014, 0x24, + 0x5015, 0x02, + 0x5016, 0x66, + 0x5017, 0x62, + 0x5018, 0x00, + 0x5019, 0x66, + 0x501a, 0x03, + 0x501b, 0x16, + 0x501c, 0x02, + 0x501d, 0x76, + 0x501e, 0x5d, + 0x501f, 0x00, + 0x5020, 0x66, + + 0x506e, 0x44, + 0x5064, 0x08, + 0x5065, 0x10, + 0x5066, 0x16, + 0x5067, 0x10, + 0x506c, 0x08, + 0x506d, 0x10, + 0x506f, 0xa6, + 0x5068, 0x08, + 0x5069, 0x10, + 0x506a, 0x18, + 0x506b, 0x28, + 0x5084, 0x10, + 0x5085, 0x3c, + 0x5005, 0x80, + + 0x3a0f, 0x30, + 0x3a10, 0x28, + 0x3a11, 0x61, + 0x3a1b, 0x30, + 0x3a1e, 0x28, + 0x3a1f, 0x14, + + 0x5060, 0x69, + 0x5061, 0xbe, + 0x5062, 0xbe, + 0x5063, 0x69, + + 0x3a19, 0x38, + 0x4009, 0x02, + + 0x3503, 0x00, + + 0x3011, 0x82, +}; + +uint32_t ov2659_default_regs_exit[]={ + 0x0100, 0x00, + 0x3000, 0x0c, + 0x3001, 0x00, + 0x3002, 0x1f, +}; + +#endif -- cgit