#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-mediabus.h>
#include <comip/comip-v4l2.h>
#include <comip/camera.h>
#include <comip/lc1160-pmic.h>
#include "../comip-video.h"
#include "ov8865_sunny.h"
#include "ov8865_oflim.h"
#define GRPMODE
#define OV8865_CHIP_ID_H (0x00)
#define OV8865_CHIP_ID_M (0x88)
#define OV8865_CHIP_ID_L (0x65)
#define MAX_WIDTH 3264
#define MAX_HEIGHT 2448
#ifndef BUILD_MASS_PRODUCTION
#define HD_WIDTH 1408
#define HD_HEIGHT 792
#define MAX_PREVIEW_WIDTH HD_WIDTH
#define MAX_PREVIEW_HEIGHT HD_HEIGHT
#else
#define MAX_PREVIEW_WIDTH MAX_WIDTH
#define MAX_PREVIEW_HEIGHT MAX_HEIGHT
#endif
#define OV8865_REG_END 0xffff
#define OV8865_REG_DELAY 0xfffe
#define OV8865_REG_VAL_PREVIEW 0xff
#define OV8865_REG_VAL_SNAPSHOT 0xfe
#define MODULE_ID_OFLIM 0x02
#define MODULE_ID_SUNNY 0x01
static char* factory_ofilm = "oflim";
static char* factory_sunny = "sunny";
static char* factory_unknown = "unknown";
struct ov8865_win_size *ov8865_win_sizes;
struct v4l2_isp_parm *ov8865_isp_parm;
static struct isp_effect_ops *sensor_effect_ops;
const struct v4l2_isp_regval *ov8865_isp_setting;
static int n_win_sizes;
static int sensor_get_aecgc_win_setting(int width, int height,int meter_mode, void **vals);
struct ov8865_format_struct;
struct ov8865_info {
struct v4l2_subdev sd;
struct ov8865_format_struct *fmt;
struct ov8865_win_size *win;
int module_id;
int isp_setting_size;
int n_win_sizes;
struct device *dev;
struct i2c_client *client;
struct comip_camera_client_gpio *gpio;
u8 power_flag;
};
struct ov8865_info *ov8865_dev = NULL;
struct regval_list {
unsigned short reg_num;
unsigned char value;
};
struct otp_struct {
int flag; // bit[7]: info, bit[6]:wb, bit[5]:vcm, bit[4]:lenc
int module_integrator_id;
int lens_id;
int production_year;
int production_month;
int production_day;
int rg_ratio;
int bg_ratio;
int light_rg;
int light_bg;
int lenc[62];
int VCM_start;
int VCM_end;
int VCM_dir;
};
struct ov8865_exp_ratio_entry {
unsigned int width_last;
unsigned int height_last;
unsigned int width_cur;
unsigned int height_cur;
unsigned int exp_ratio;
};
struct ov8865_exp_ratio_entry ov8865_exp_ratio_table[] = {
#ifndef BUILD_MASS_PRODUCTION
{HD_WIDTH, HD_HEIGHT, MAX_WIDTH, MAX_HEIGHT, 0x0173},
{MAX_WIDTH, MAX_HEIGHT, HD_WIDTH, HD_HEIGHT, 0x00b0},
#else
#endif
};
#define N_EXP_RATIO_TABLE_SIZE (ARRAY_SIZE(ov8865_exp_ratio_table))
static struct regval_list ov8865_init_regs[] = {
{0x0103, 0x01},
{0x0100, 0x00},
{0x0100, 0x00},
{0x0100, 0x00},
{0x0100, 0x00},
{OV8865_REG_DELAY,0x05},
{0x3638, 0xff},
{0x0302, 0x1d},//;26;1e
{0x0303, 0x00},
{0x0304, 0x03},
{0x030d, 0x1d},//;26;1e
{0x030e, 0x00},
{0x030f, 0x04},
{0x0312, 0x01},
{0x031e, 0x0c},
{0x3015, 0x01},
{0x3018, 0x72},
{0x3020, 0x93},
{0x3022, 0x01},
{0x3031, 0x0a},
{0x3106, 0x01},
{0x3305, 0xf1},
{0x3308, 0x00},
{0x3309, 0x28},
{0x330a, 0x00},
{0x330b, 0x20},
{0x330c, 0x00},
{0x330d, 0x00},
{0x330e, 0x00},
{0x330f, 0x40},
{0x3307, 0x04},
{0x3604, 0x04},
{0x3602, 0x30},
{0x3605, 0x00},
{0x3607, 0x20},
{0x3608, 0x11},
{0x3609, 0x68},
{0x360a, 0x40},
{0x360c, 0xdd},
{0x360e, 0x0c},
{0x3610, 0x07},
{0x3612, 0x86},
{0x3613, 0x58},
{0x3614, 0x28},
{0x3617, 0x40},
{0x3618, 0x5a},
{0x3619, 0x9b},
{0x361c, 0x00},
{0x361d, 0x60},
{0x3631, 0x60},
{0x3633, 0x10},
{0x3634, 0x10},
{0x3635, 0x10},
{0x3636, 0x10},
{0x3641, 0x55},
{0x3646, 0x86},
{0x3647, 0x27},
{0x364a, 0x1b},
{0x3500, 0x00},
{0x3501, 0x00},
{0x3502, 0x20},
{0x3503, 0x30},
{0x3507, 0x03},
{0x3508, 0x02},
{0x3509, 0x00},
{0x3700, 0x48},
{0x3701, 0x18},
{0x3702, 0x50},
{0x3703, 0x32},
{0x3704, 0x28},
{0x3705, 0x00},
{0x3706, 0x70},
{0x3707, 0x08},
{0x3708, 0x48},
{0x3709, 0x80},
{0x370a, 0x01},
{0x370b, 0x70},
{0x370c, 0x07},
{0x3718, 0x14},
{0x3719, 0x31},
{0x3712, 0x44},
{0x3714, 0x12},
{0x371e, 0x31},
{0x371f, 0x7f},
{0x3720, 0x0a},
{0x3721, 0x0a},
{0x3724, 0x04},
{0x3725, 0x04},
{0x3726, 0x0c},
{0x3728, 0x0a},
{0x3729, 0x03},
{0x372a, 0x06},
{0x372b, 0xa6},
{0x372c, 0xa6},
{0x372d, 0xa6},
{0x372e, 0x0c},
{0x372f, 0x20},
{0x3730, 0x02},
{0x3731, 0x0c},
{0x3732, 0x28},
{0x3733, 0x10},
{0x3734, 0x40},
{0x3736, 0x30},
{0x373a, 0x04},
{0x373b, 0x18},
{0x373c, 0x14},
{0x373e, 0x06},
{0x3755, 0x40},
{0x3758, 0x00},
{0x3759, 0x4c},
{0x375a, 0x0c},
{0x375b, 0x26},
{0x375c, 0x40},
{0x375d, 0x04},
{0x375e, 0x00},
{0x375f, 0x28},
{0x3767, 0x1e},
{0x3768, 0x04},
{0x3769, 0x20},
{0x376c, 0xc0},
{0x376d, 0xc0},
{0x376a, 0x08},
{0x3761, 0x00},
{0x3762, 0x00},
{0x3763, 0x00},
{0x3766, 0xff},
{0x376b, 0x42},
{0x3772, 0x46},
{0x3773, 0x04},
{0x3774, 0x2c},
{0x3775, 0x13},
{0x3776, 0x10},
{0x37a0, 0x88},
{0x37a1, 0x7a},
{0x37a2, 0x7a},
{0x37a3, 0x02},
{0x37a4, 0x00},
{0x37a5, 0x09},
{0x37a6, 0x00},
{0x37a7, 0x88},
{0x37a8, 0xb0},
{0x37a9, 0xb0},
{0x3760, 0x00},
{0x376f, 0x01},
{0x37aa, 0x88},
{0x37ab, 0x5c},
{0x37ac, 0x5c},
{0x37ad, 0x55},
{0x37ae, 0x19},
{0x37af, 0x19},
{0x37b0, 0x00},
{0x37b1, 0x00},
{0x37b2, 0x00},
{0x37b3, 0x84},
{0x37b4, 0x84},
{0x37b5, 0x66},
{0x37b6, 0x00},
{0x37b7, 0x00},
{0x37b8, 0x00},
{0x37b9, 0xff},
{0x3800, 0x00},
{0x3801, 0x0c},
{0x3802, 0x00},
{0x3803, 0x0c},
{0x3804, 0x0c},
{0x3805, 0xd3},
{0x3806, 0x09},
{0x3807, 0xa3},
{0x3808, 0x0c},
{0x3809, 0xc0},
{0x380a, 0x09},
{0x380b, 0x90},
{0x380c, 0x07},
{0x380d, 0x98},//
{0x380e, 0x09},
{0x380f, 0xe8},//;a6
{0x3810, 0x00},
{0x3811, 0x04},
{0x3813, 0x02},
{0x3814, 0x01},
{0x3815, 0x01},
{0x3820, 0x00},
{0x3821, 0x46},
{0x382a, 0x01},
{0x382b, 0x01},
{0x3830, 0x04},
{0x3836, 0x01},
{0x3837, 0x18},
{0x3841, 0xff},
{0x3846, 0x48},
{0x3d85, 0x06},
{0x3d8c, 0x75},
{0x3d8d, 0xef},
{0x3f08, 0x16},
{0x4000, 0xf1},
{0x4001, 0x04},
{0x4005, 0x10},
{0x400b, 0x0c},
{0x400d, 0x10},
{0x401b, 0x00},
{0x401d, 0x00},
{0x4020, 0x02},
{0x4021, 0x40},
{0x4022, 0x03},
{0x4023, 0x3f},
{0x4024, 0x07},
{0x4025, 0xc0},
{0x4026, 0x08},
{0x4027, 0xbf},
{0x4028, 0x00},
{0x4029, 0x02},
{0x402a, 0x04},
{0x402b, 0x04},
{0x402c, 0x02},
{0x402d, 0x02},
{0x402e, 0x08},
{0x402f, 0x02},
{0x401f, 0x00},
{0x4034, 0x3f},
{0x4300, 0xff},
{0x4301, 0x00},
{0x4302, 0x0f},
{0x4500, 0x68},
{0x4503, 0x10},
{0x4601, 0x10},
{0x481f, 0x32},
{0x4837, 0x16},
{0x4850, 0x10},
{0x4851, 0x32},
{0x4b00, 0x2a},
{0x4b0d, 0x00},
{0x4d00, 0x04},
{0x4d01, 0x18},
{0x4d02, 0xc3},
{0x4d03, 0xff},
{0x4d04, 0xff},
{0x4d05, 0xff},
{0x5000, 0x86},
{0x5001, 0x01},
{0x5002, 0x08},
{0x5901, 0x00},
{0x5e00, 0x00},
{0x5e01, 0x41},
{0x0100, 0x01},
{0x5b00, 0x02},
{0x5b01, 0xd0},
{0x5b02, 0x03},
{0x5b03, 0xff},
{0x5b05, 0x6c},
{0x5780, 0xfc},
{0x5781, 0xdf},
{0x5782, 0x3f},
{0x5783, 0x08},
{0x5784, 0x0c},
{0x5786, 0x20},
{0x5787, 0x40},
{0x5788, 0x08},
{0x5789, 0x08},
{0x578a, 0x02},
{0x578b, 0x01},
{0x578c, 0x01},
{0x578d, 0x0c},
{0x578e, 0x02},
{0x578f, 0x01},
{0x5790, 0x01},
{0x5800, 0x1d},
{0x5801, 0x0e},
{0x5802, 0x0c},
{0x5803, 0x0c},
{0x5804, 0x0f},
{0x5805, 0x22},
{0x5806, 0x0a},
{0x5807, 0x06},
{0x5808, 0x05},
{0x5809, 0x05},
{0x580a, 0x07},
{0x580b, 0x0a},
{0x580c, 0x06},
{0x580d, 0x02},
{0x580e, 0x00},
{0x580f, 0x00},
{0x5810, 0x03},
{0x5811, 0x07},
{0x5812, 0x06},
{0x5813, 0x02},
{0x5814, 0x00},
{0x5815, 0x00},
{0x5816, 0x03},
{0x5817, 0x07},
{0x5818, 0x09},
{0x5819, 0x06},
{0x581a, 0x04},
{0x581b, 0x04},
{0x581c, 0x06},
{0x581d, 0x0a},
{0x581e, 0x19},
{0x581f, 0x0d},
{0x5820, 0x0b},
{0x5821, 0x0b},
{0x5822, 0x0e},
{0x5823, 0x22},
{0x5824, 0x23},
{0x5825, 0x28},
{0x5826, 0x29},
{0x5827, 0x27},
{0x5828, 0x13},
{0x5829, 0x26},
{0x582a, 0x33},
{0x582b, 0x32},
{0x582c, 0x33},
{0x582d, 0x16},
{0x58
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ov8865.zip (3个子文件)
ov8865_oflim.h 71KB
ov8865.c 64KB
ov8865_sunny.h 78KB
共 3 条
- 1
资源评论
- TroianSpencer2019-08-23解压失败。。u0106075352019-10-10我下载下来后可以解压
u010607535
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功