20260129让天启AIO-3576Q38开发板跑原厂的Buildroot时适配xc7160【使用天启Firefly的DTS】
本文记录了在天启AIO-3576Q38开发板上适配xc7160摄像头的完整过程。通过修改内核驱动文件,包括添加xc7160.c驱动、更新Makefile和Kconfig配置,并在.config和defconfig中启用相关选项,最终实现了摄像头功能的正常调用。测试结果显示,系统能够成功进行4K和1080p视频录制,验证了适配工作的有效性。整个过程展示了如何在Rockchip平台Buildroot环
20260129让天启AIO-3576Q38开发板跑原厂的Buildroot时适配xc7160【使用天启Firefly的DTS】
2026/1/29 15:37
缘起:让天启AIO-3576Q38开发板跑原厂的Buildroot时适配xc7160【使用天启Firefly的DTS】
让天启AIO-3576Q38开发板在Rockchip瑞芯微原厂Buildroot下打开gmac0芯片YT8531H-CA。
我看原理图是YT8531H-CA/RTL8211F-CG硬件兼容设计的。
应该可以直接替换使用的!
当你把荣品RD-RK3588开发板重新适配一把,就相当于从头做了一个项目:【荣品RD-RK3588开发板】。
当然,开发板的功能都是好的,你免除了调试的过程,也就没有解决相关硬件出错的经验/机会了!
1、驱动文件,直接增加
Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\xc7160.c
Z:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\xc7160.c

2、
Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\Makefile
Z:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\Makefile
obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o
obj-$(CONFIG_VIDEO_TW2804) += tw2804.o
obj-$(CONFIG_VIDEO_TW9903) += tw9903.o
obj-$(CONFIG_VIDEO_TW9906) += tw9906.o
obj-$(CONFIG_VIDEO_TW9910) += tw9910.o
obj-$(CONFIG_VIDEO_UDA1342) += uda1342.o
obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
obj-$(CONFIG_VIDEO_VM149C) += vm149c.o
obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
obj-$(CONFIG_VIDEO_VS6624) += vs6624.o
obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
obj-$(CONFIG_VIDEO_XC7160) += xc7160.o

3、
Z:\Linux_SDK\Firefly_SDK\kernel\drivers\media\i2c\Kconfig
Z:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\Kconfig
config VIDEO_OS02K10
tristate "OmniVision OS02K10 sensor support"
depends on I2C && VIDEO_DEV
depends on MEDIA_CAMERA_SUPPORT
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
help
This is a Video4Linux2 sensor driver for the OmniVision
OS02K10 camera.
config VIDEO_XC7160
tristate "Firefly XC7160 support."
depends on I2C && VIDEO_DEV
depends on MEDIA_CAMERA_SUPPORT
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
help
Driver for sv-taysh camera.This camera consists of ISP xc7160 and sensor sc8238
config VIDEO_OS03B10
tristate "OmniVision OS03B10 sensor support"
depends on I2C && VIDEO_DEV
depends on MEDIA_CAMERA_SUPPORT
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
help
This is a Video4Linux2 sensor driver for the OmniVision
OS03B10 camera.

4、
Z:\git_RK3576_Linux6.1\kernel-6.1\.config
Y:\A7_RK3576_LINUX\kernel\.config
CONFIG_VIDEO_IMX586=y
# CONFIG_VIDEO_JX_F37 is not set
# CONFIG_VIDEO_JX_H62 is not set
# CONFIG_VIDEO_JX_H65 is not set
# CONFIG_VIDEO_JX_K17 is not set
# CONFIG_VIDEO_MIS2031 is not set
# CONFIG_VIDEO_MIS4001 is not set
# CONFIG_VIDEO_MT9M001 is not set
# CONFIG_VIDEO_MT9M032 is not set
# CONFIG_VIDEO_MT9M111 is not set
# CONFIG_VIDEO_MT9P031 is not set
# CONFIG_VIDEO_MT9T001 is not set
# CONFIG_VIDEO_MT9T112 is not set
# CONFIG_VIDEO_MT9V011 is not set
# CONFIG_VIDEO_MT9V032 is not set
# CONFIG_VIDEO_MT9V111 is not set
# CONFIG_VIDEO_NOON010PC30 is not set
# CONFIG_VIDEO_OG01A10 is not set
# CONFIG_VIDEO_OG01A1B is not set
# CONFIG_VIDEO_OG02B10 is not set
# CONFIG_VIDEO_OS02G10 is not set
# CONFIG_VIDEO_OS02K10 is not set
CONFIG_VIDEO_XC7160=y
# CONFIG_VIDEO_OS03B10 is not set
CONFIG_VIDEO_OS04A10=y
# CONFIG_VIDEO_OS04D10 is not set
# CONFIG_VIDEO_OS05A20 is not set
Z:\git_RK3576_Linux6.1\kernel-6.1\arch\arm64\configs\rockchip_linux_defconfig
Y:\A7_RK3576_LINUX\kernel\arch\arm64\configs\rockchip_linux_defconfig
CONFIG_VIDEO_IMX464=y
CONFIG_VIDEO_XC7160=y
CONFIG_VIDEO_OS04A10=y




5、效果图:
4K
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=100 ! video/x-raw,format=NV12, width=3840,height=2160 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=8ms1_h264_4k_100.mp4 t. ! queue ! waylandsink
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=10000 ! video/x-raw,format=NV12, width=3840,height=2160 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=8ms1_h264_4k_10000.mp4 t. ! queue ! waylandsink
1080p
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=10000 ! video/x-raw,format=NV12, width=1920,height=1080 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=8ms1_h264_1080p_100.mp4 t. ! queue ! waylandsink
25*60=1500【1分钟的4K录像】
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=1500 ! video/x-raw,format=NV12, width=3840,height=2160 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=8ms1_h264_4k_1500.mp4 t. ! queue ! waylandsink
buildroot用命令进行4k录像
gst-launch-1.0 -e v4l2src device=/dev/video11 io-mode=4 ! \
video/x-raw,format=NV12,width=3840,height=2160,framerate=30/1 ! \
mpph265enc ! h265parse ! video/x-h265,stream-format=hev1,alignment=au ! \
mp4mux -e ! filesink location=hw265.mp4
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=10000 ! video/x-raw,format=NV12, width=1920,height=1080 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=13855_h264_1080p_100.mp4 t. ! queue ! waylandsink
gst-launch-1.0 v4l2src device=/dev/video11 num-buffers=100 ! video/x-raw,format=NV12, width=1920,height=1080 ! tee name=t ! queue ! mpph264enc ! queue ! h264parse ! qtmux ! filesink location=13855_h264_1080p_100.mp4 t. ! queue ! waylandsink

Z:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\xc7160.c
// SPDX-License-Identifier: GPL-2.0
/*
* xc7160 driver
* V0.0X01.0X02
* 1. fix compile error in kernel5.10
* V0.0X01.0X03
* 1.add cmd to get channel info and ioctl
* 2.adjust bus format to UYVY for hal3 to get media device without isp
* V0.0X01.0X04
* 1.v4l2_fwnode_endpoint_parse get resource failed, so ignore it
* 2.adjust init reg to power on interface, fix up preview and recording failed.
*
*/
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/videodev2.h>
#include <linux/version.h>
#include <linux/rk-camera-module.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-subdev.h>
#include <linux/pinctrl/consumer.h>
#include <linux/of_gpio.h>
#include "xc7160_regs.h"
//#define FIREFLY_DEBUG 0
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x04)
#define XC7160_MEDIA_BUS_FMT MEDIA_BUS_FMT_UYVY8_2X8 //MEDIA_BUS_FMT_YUYV8_2X8
#define XC7160_REG_HIGH_SELECT 0xfffd
#define XC7160_REG_PAGE_SELECT 0xfffe
#define XC7160_CHIP_REG_ID1_ZYK 0xfffb
#define XC7160_CHIP_REG_ID2_ZYK 0xfffc
#define XC7160_CHIP_ID1_ZYK 0x71
#define XC7160_CHIP_ID2_ZYK 0x60
#define SC8238_CHIP_REG_ID1_ZYK 0x3107
#define SC8238_CHIP_REG_ID2_ZYK 0x3108
#define SC8238_CHIP_ID1_ZYK 0x82
#define SC8238_CHIP_ID2_ZYK 0x35
#define XC7160_REG_VALUE_08BIT 1
#define XC7160_REG_VALUE_16BIT 2
#define XC7160_REG_VALUE_24BIT 3
static DEFINE_MUTEX(xc7160_power_mutex);
#define OF_CAMERA_PINCTRL_STATE_DEFAULT "rockchip,camera_default"
#define OF_CAMERA_PINCTRL_STATE_SLEEP "rockchip,camera_sleep"
#define XC7160_NAME "xc7160"
#define XC7160_LANES 4
#define XC7160_LINK_FREQ_XXX_MHZ_L 504000000U
#define XC7160_LINK_FREQ_XXX_MHZ_H 576000000U
/* pixel rate = link frequency * 2 * lanes / BITS_PER_SAMPLE */
#define XC7160_PIXEL_RATE_LOW (XC7160_LINK_FREQ_XXX_MHZ_L *2 *4/12)
#define XC7160_PIXEL_RATE_HIGH (XC7160_LINK_FREQ_XXX_MHZ_H *2 *4/12)
#define XC7160_XVCLK_FREQ 24000000
#define SC8238_RETRY_STABLE_TIME 5
static const struct regval *xc7160_global_regs = isp_xc7160_4k_25fps_2022617_regs;
static const struct regval *sc8238_global_regs = sensor_xc7160_4k_25fps_2022617_regs;
static u32 clkout_enabled_index = 1;
static const char * const xc7160_supply_names[] = {
"avdd", /* Analog power */
"dovdd", /* Digital I/O power */
"dvdd", /* Digital core power */
};
#define XC7160_NUM_SUPPLIES ARRAY_SIZE(xc7160_supply_names)
struct xc7160_mode {
u32 bus_fmt;
u32 width;
u32 height;
struct v4l2_fract max_fps;
const struct regval *isp_reg_list;
const struct regval *sensor_reg_list;
u32 vc[PAD_MAX];
};
struct xc7160 {
struct i2c_client *client;
struct clk *xvclk;
struct gpio_desc *mipi_pwr_gpio;
struct gpio_desc *reset_gpio;
struct gpio_desc *pwdn_gpio;
struct regulator_bulk_data supplies[XC7160_NUM_SUPPLIES];
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_sleep;
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *anal_gain;
struct v4l2_ctrl *digi_gain;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *test_pattern;
struct mutex mutex;
bool streaming;
bool power_on;
bool isp_out_colorbar; //Mark whether the color bar should be output
bool initial_status; //Whether the isp has been initialized
const struct xc7160_mode *cur_mode;
u32 module_index;
const char *module_facing;
const char *module_name;
const char *len_name;
u32 lane_data_num;
};
#define to_xc7160(sd) container_of(sd, struct xc7160, subdev)
static const struct xc7160_mode supported_modes[] = {
{
.width = 3840,
.height = 2160,
.max_fps = {
.numerator = 10000,
.denominator = 250000,
},
.bus_fmt = XC7160_MEDIA_BUS_FMT,
.isp_reg_list = isp_xc7160_4k_25fps_2022617_regs,
.sensor_reg_list= sensor_xc7160_4k_25fps_2022617_regs,
.vc[PAD0] = 0,//V4L2_MBUS_CSI2_CHANNEL_0,
},
{
.width = 1920,
.height = 1080,
.max_fps = {
.numerator = 10000,
.denominator = 300000,
},
.bus_fmt = XC7160_MEDIA_BUS_FMT,
.isp_reg_list = isp_xc7160_1080p_30fps_2022617_regs,
.sensor_reg_list = sensor_xc7160_1080p_30fps_2022617_regs,
.vc[PAD0] = 0, //V4L2_MBUS_CSI2_CHANNEL_0,
},
//driver setting
};
static const s64 link_freq_menu_items[] = {
XC7160_LINK_FREQ_XXX_MHZ_H,
XC7160_LINK_FREQ_XXX_MHZ_L,
};
static const char * const xc7160_test_pattern_menu[] = {
"Disabled",
"Vertical Color Bar Type 1",
"Vertical Color Bar Type 2",
"Vertical Color Bar Type 3",
"Vertical Color Bar Type 4"
};
/* Write registers up to 4 at a time */
static int xc7160_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 buf_i, val_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg & 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i++] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
}
static int xc7160_write_array(struct i2c_client * client,
const struct regval *regs)
{
u32 i = 0;
int ret = 0;
u8 value = 0;
struct xc7160* xc7160 = NULL;
xc7160 = to_xc7160(dev_get_drvdata(&client->dev));
while(true) {
if (regs[i].addr == REG_NULL) {
if (regs[i].val == REG_DL)
msleep(5);
else
break;
}
value = regs[i].val;
if(regs[i].addr == 0x2023 && xc7160 != NULL){
if(xc7160->lane_data_num == 2 )
value = 0x03; //isp mipi data uses 2 lanes
else
value = 0x0f; //isp mipi data uses 4 lanes
}
ret = xc7160_write_reg(client, regs[i].addr, XC7160_REG_VALUE_08BIT, value);
if(ret){
dev_err(&client->dev,"%s: write xc7160 array reg 0x%02x failed\n",__func__,regs[i].addr);
return ret;
}
i++;
}
return ret;
}
/* Read registers up to 4 at a time */
static int xc7160_read_reg(struct i2c_client *client, u16 reg,
unsigned int len, u32 *val)
{
struct i2c_msg msgs[2];
u8 *data_be_p;
__be32 data_be = 0;
__be16 reg_addr_be = cpu_to_be16(reg);
int ret;
if (len > 4 || !len)
return -EINVAL;
data_be_p = (u8 *)&data_be;
/* Write register address */
msgs[0].addr = client->addr;
msgs[0].flags = 0;
msgs[0].len = 2;
msgs[0].buf = (u8 *)®_addr_be;
/* Read data from register */
msgs[1].addr = client->addr;
msgs[1].flags = I2C_M_RD;
msgs[1].len = len;
msgs[1].buf = &data_be_p[4 - len];
ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret != ARRAY_SIZE(msgs))
return -EIO;
*val = be32_to_cpu(data_be);
return 0;
}
static int sc8238_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
struct i2c_msg msg;
u8 sc8238_buf[4];
int ret;
u32 buf_i, val_i;
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
sc8238_buf[0]= reg >> 8;
sc8238_buf[1]= reg & 0xff;
while (val_i < 4)
sc8238_buf[buf_i++] = val_p[val_i++];
/* Write register address */
msg.addr = 0x30;
msg.flags = 0;
msg.len =3;
msg.buf = sc8238_buf;
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret != 1){
dev_err(&client->dev,"%s: xc7160_8238 i2c transfer failed\n",__func__);
return -EIO;
}
return 0;
}
static int sc8238_read_reg(struct i2c_client *client, u16 reg,
unsigned int len, u32 *val)
{
struct i2c_msg msgs[2];
u8 *data_be_p;
__be32 data_be = 0;
__be16 reg_addr_be = cpu_to_be16(reg);
int ret;
if (len > 4 || !len)
return -EINVAL;
data_be_p = (u8 *)&data_be;
/* Write register address */
msgs[0].addr = 0x30;
msgs[0].flags = 0;
msgs[0].len = 2;
msgs[0].buf = (u8 *)®_addr_be;
/* Read data from register */
msgs[1].addr = 0x30;
msgs[1].flags = I2C_M_RD;
msgs[1].len = len;
msgs[1].buf = &data_be_p[4 - len];
ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret != ARRAY_SIZE(msgs))
return -EIO;
*val = be32_to_cpu(data_be);
return 0;
}
static int sc8238_write_array(struct i2c_client *client,
const struct regval *regs)
{
u32 i,j;
u32 value;
struct device* dev = &client->dev;
int ret = 0;
value =0;
for (i = 0; ret == 0 && regs[i].addr != REG_NULL; i++){
for(j = 0 ; j < SC8238_RETRY_STABLE_TIME ; j++){
ret = sc8238_write_reg(client, regs[i].addr,
XC7160_REG_VALUE_08BIT,
regs[i].val);
if(ret && j == SC8238_RETRY_STABLE_TIME){
dev_err(dev,"xc7160_8238 write sc8238 regs array get failed, 0x%02x\n",regs[i].addr);
return ret;
}else if(ret){
dev_err(dev,"xc7160_8238 write sc8238 regs array retry 0x%02x, %d\n",regs[i].addr,j+1);
msleep(1);
continue;
}else
break;
}
#ifdef FIREFLY_DEBUG
sc8238_read_reg(client,regs[i].addr,XC7160_REG_VALUE_08BIT, &value);
if(regs[i].val != value){
dev_info(dev,"firefly->debug: xc7160_8238 reg0x%02x write and read are different\n",regs[i].addr);
}
#endif
}
return ret;
}
static int sc8238_check_sensor_id(struct xc7160 *xc7160,
struct i2c_client *client)
{
struct device *dev = &xc7160->client->dev;
u32 id_H = 0,id_L=0;
int ret,i=0;
ret = xc7160_write_array(xc7160->client, xc7160_i2c_bypass_on_regs);
if (ret) {
dev_err(dev, "%s: could not set bypass on registers\n",__func__);
return ret;
}
do{
i++;
ret = sc8238_read_reg(client, SC8238_CHIP_REG_ID1_ZYK ,
XC7160_REG_VALUE_08BIT, &id_H);
if (id_H == SC8238_CHIP_ID1_ZYK && !ret ) {
//dev_info(dev, "sensor chip is SC8238, id_H is 0x%02x\n",id);
ret = sc8238_read_reg(client, SC8238_CHIP_REG_ID2_ZYK ,
XC7160_REG_VALUE_08BIT, &id_L);
if (id_L != SC8238_CHIP_ID2_ZYK || ret) {
dev_err(dev, "Unexpected SC8238_CHIP_ID_REG2, id(%06x), ret(%d), but SC8238_CHIP_ID_REG1 success\n", id_L, ret);
}else{
xc7160->isp_out_colorbar = false;
dev_info(dev, "sensor chip is SC8238\n");
break;
}
}else
dev_err(dev, "Unexpected sensor of SC8238_CHIP_ID_REG1, id(%06x), ret(%d)\n", id_H, ret);
if(i == SC8238_RETRY_STABLE_TIME){
dev_err(dev, "cannot check sc8238 sensor id\n");
xc7160->isp_out_colorbar = true;
break;
}
dev_info(dev, "check sensor of SC8238_CHIP_ID retry %d\n",i );
msleep(1);
}while((id_H != SC8238_CHIP_ID1_ZYK)||(id_L != SC8238_CHIP_ID2_ZYK));
ret = xc7160_write_array(client, xc7160_i2c_bypass_off_regs);
if (ret)
dev_err(dev, "%s: could not set bypass off registers\n", __func__);
return ret;
}
static int camera_isp_sensor_initial(struct xc7160 *xc7160)
{
struct device *dev = &xc7160->client->dev;
int ret,i=0;
dev_info(dev,"xc7160 res wxh: %dx%d@%dfps\n",
xc7160->cur_mode->width,xc7160->cur_mode->height,(xc7160->cur_mode->max_fps.denominator/xc7160->cur_mode->max_fps.numerator));
ret = xc7160_write_array(xc7160->client, xc7160_global_regs);
if(ret){
dev_err(dev, "could not set init registers\n");
return ret;
}
xc7160->initial_status = true;
ret=sc8238_check_sensor_id(xc7160,xc7160->client);
if(ret)
return ret;
if( xc7160->isp_out_colorbar != true ){
xc7160_write_array(xc7160->client, xc7160_stream_off_regs);
ret = xc7160_write_array(xc7160->client, xc7160_i2c_bypass_on_regs);
if (ret) {
dev_err(dev, "could not set bypass on registers\n");
return ret;
}
msleep(1);
i = sc8238_write_array(xc7160->client, sc8238_global_regs);
if (i){
dev_err(dev, "could not set sensor_initial_regs\n");
xc7160->isp_out_colorbar = true;
}
ret = xc7160_write_array(xc7160->client, xc7160_i2c_bypass_off_regs);
if (ret) {
dev_err(dev, "could not set bypass off registers\n");
i = ret;
}
}
return i;
}
static int xc7160_get_reso_dist(const struct xc7160_mode *mode,
struct v4l2_mbus_framefmt *framefmt)
{
return abs(mode->width - framefmt->width) +
abs(mode->height - framefmt->height);
}
static const struct xc7160_mode *
xc7160_find_best_fit(struct v4l2_subdev_format *fmt)
{
struct v4l2_mbus_framefmt *framefmt = &fmt->format;
int dist;
int cur_best_fit = 0;
int cur_best_fit_dist = -1;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(supported_modes); i++) {
dist = xc7160_get_reso_dist(&supported_modes[i], framefmt);
if (cur_best_fit_dist == -1 || dist < cur_best_fit_dist) {
cur_best_fit_dist = dist;
cur_best_fit = i;
}
}
return &supported_modes[cur_best_fit];
}
static int xc7160_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct xc7160 *xc7160 = to_xc7160(sd);
const struct xc7160_mode *mode;
mutex_lock(&xc7160->mutex);
mode = xc7160_find_best_fit(fmt);
fmt->format.code = XC7160_MEDIA_BUS_FMT;
fmt->format.width = mode->width;
fmt->format.height = mode->height;
fmt->format.field = V4L2_FIELD_NONE;
if((fmt->format.width == 3840)&&(fmt->format.height == 2160)){
__v4l2_ctrl_s_ctrl(xc7160->link_freq, 1);
__v4l2_ctrl_s_ctrl_int64(xc7160->pixel_rate, XC7160_PIXEL_RATE_LOW);
}else{
__v4l2_ctrl_s_ctrl(xc7160->link_freq, 0);
__v4l2_ctrl_s_ctrl_int64(xc7160->pixel_rate, XC7160_PIXEL_RATE_HIGH);
}
xc7160_global_regs = mode->isp_reg_list;
sc8238_global_regs = mode->sensor_reg_list;
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
*v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format;
#else
mutex_unlock(&xc7160->mutex);
return -ENOTTY;
#endif
} else {
xc7160->cur_mode = mode;
if (xc7160->streaming){
mutex_unlock(&xc7160->mutex);
return -EBUSY;
}
}
//camera_isp_sensor_initial(xc7160);
mutex_unlock(&xc7160->mutex);
return 0;
}
static int xc7160_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct xc7160 *xc7160 = to_xc7160(sd);
const struct xc7160_mode *mode = xc7160->cur_mode;
mutex_lock(&xc7160->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad);
#else
mutex_unlock(&xc7160->mutex);
return -ENOTTY;
#endif
} else {
fmt->format.width = mode->width;
fmt->format.height = mode->height;
fmt->format.code = XC7160_MEDIA_BUS_FMT;
fmt->format.field = V4L2_FIELD_NONE;
}
mutex_unlock(&xc7160->mutex);
return 0;
}
static int xc7160_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{
if (code->index != 0)
return -EINVAL;
code->code = XC7160_MEDIA_BUS_FMT;
return 0;
}
static int xc7160_enum_frame_sizes(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{
if (fse->index >= ARRAY_SIZE(supported_modes))
return -EINVAL;
if (fse->code != XC7160_MEDIA_BUS_FMT/*MEDIA_BUS_FMT_YUYV8_2X8*/)
return -EINVAL;
fse->min_width = supported_modes[fse->index].width;
fse->max_width = supported_modes[fse->index].width;
fse->max_height = supported_modes[fse->index].height;
fse->min_height = supported_modes[fse->index].height;
return 0;
}
//static int xc7160_enable_test_pattern(struct xc7160 *xc7160, u32 pattern)
//{
// return 0;
//}
static int xc7160_g_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
struct xc7160 *xc7160 = to_xc7160(sd);
const struct xc7160_mode *mode = xc7160->cur_mode;
mutex_lock(&xc7160->mutex);
fi->interval = mode->max_fps;
mutex_unlock(&xc7160->mutex);
return 0;
}
static void xc7160_get_module_inf(struct xc7160 *xc7160,
struct rkmodule_inf *inf)
{
memset(inf, 0, sizeof(*inf));
strlcpy(inf->base.sensor, XC7160_NAME, sizeof(inf->base.sensor));
strlcpy(inf->base.module, xc7160->module_name,
sizeof(inf->base.module));
strlcpy(inf->base.lens, xc7160->len_name, sizeof(inf->base.lens));
}
static int xc7160_get_channel_info(struct xc7160 *xc7160, struct rkmodule_channel_info *ch_info)
{
if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX)
return -EINVAL;
ch_info->vc = xc7160->cur_mode->vc[ch_info->index];
ch_info->width = xc7160->cur_mode->width;
ch_info->height = xc7160->cur_mode->height;
ch_info->bus_fmt = xc7160->cur_mode->bus_fmt;
return 0;
}
static long xc7160_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct xc7160 *xc7160 = to_xc7160(sd);
struct rkmodule_channel_info *ch_info;
long ret = 0;
switch (cmd) {
case RKMODULE_GET_MODULE_INFO:
xc7160_get_module_inf(xc7160, (struct rkmodule_inf *)arg);
break;
case RKMODULE_GET_CHANNEL_INFO:
ch_info = (struct rkmodule_channel_info *)arg;
ret = xc7160_get_channel_info(xc7160, ch_info);
break;
default:
ret = -ENOIOCTLCMD;
break;
}
return ret;
}
#ifdef CONFIG_COMPAT
static long xc7160_compat_ioctl32(struct v4l2_subdev *sd,
unsigned int cmd, unsigned long arg)
{
void __user *up = compat_ptr(arg);
struct rkmodule_inf *inf;
struct rkmodule_channel_info *ch_info;
long ret;
switch (cmd) {
case RKMODULE_GET_MODULE_INFO:
inf = kzalloc(sizeof(*inf), GFP_KERNEL);
if (!inf) {
ret = -ENOMEM;
return ret;
}
ret = xc7160_ioctl(sd, cmd, inf);
if (!ret)
ret = copy_to_user(up, inf, sizeof(*inf));
if (ret)
ret = -EFAULT;
kfree(inf);
break;
case RKMODULE_GET_CHANNEL_INFO:
ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL);
if (!ch_info) {
ret = -ENOMEM;
return ret;
}
ret = xc7160_ioctl(sd, cmd, ch_info);
if (!ret) {
ret = copy_to_user(up, ch_info, sizeof(*ch_info));
if (ret)
ret = -EFAULT;
}
kfree(ch_info);
break;
default:
ret = -ENOIOCTLCMD;
break;
}
return ret;
}
#endif
#ifdef FIREFLY_DEBUG
static int xc7160_check_isp_reg(struct xc7160 *xc7160)
{
u32 val;
int ret;
struct device *dev = &xc7160->client->dev;
ret = xc7160_write_reg(xc7160->client, 0xfffd, XC7160_REG_VALUE_08BIT, 0x80);
if (ret){
dev_err(dev, "write reg0xfffd failed\n");
return ret;
}
ret = xc7160_write_reg(xc7160->client, 0xfffe, XC7160_REG_VALUE_08BIT, 0x26);
if (ret){
dev_err(dev, "write reg0xfffe failed\n");
return ret;
}
ret = xc7160_read_reg(xc7160->client, 0x8012, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x8012=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x8013, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x8013=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x8014, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x8014=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x8015, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x8015=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x8010, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x8010=0x%02x\n", val);
ret = xc7160_write_reg(xc7160->client, 0xfffe, XC7160_REG_VALUE_08BIT, 0x50);
if (ret){
dev_err(dev, "write reg0xfffe failed\n");
return ret;
}
ret = xc7160_read_reg(xc7160->client, 0x0090, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x0090=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x0033, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x0033=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x0058, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x0058=0x%02x\n", val);
ret = xc7160_write_reg(xc7160->client, 0xfffe, XC7160_REG_VALUE_08BIT, 0x30);
if (ret){
dev_err(dev, "write reg0xfffe failed\n");
return ret;
}
ret = xc7160_read_reg(xc7160->client, 0x2f06, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x2f06=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x2f07, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x2f07=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x2f08, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x2f08=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x2f09, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x2f09=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x0028, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x0028=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x0029, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x0029=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x002a, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x002a=0x%02x\n", val);
ret = xc7160_read_reg(xc7160->client, 0x002b, XC7160_REG_VALUE_08BIT, &val);
dev_info(dev, "reg0x002b=0x%02x\n", val);
return ret;
}
#endif // DEBUG
static int __xc7160_start_stream(struct xc7160 *xc7160)
{
int ret;
struct device *dev = &xc7160->client->dev;
//xc7160->isp_out_colorbar = true;
if(xc7160->isp_out_colorbar == true){
dev_info(dev, "colorbar on !!!\n");
ret = xc7160_write_array(xc7160->client, xc7160_colorbar_on_regs);
}else
ret = xc7160_write_array(xc7160->client, xc7160_stream_on_regs);
#ifdef FIREFLY_DEBUG
xc7160_check_isp_reg(xc7160);
#endif // DEBUG
if(ret)
dev_err(dev, "xc7160 write stream or colorbar regs failed\n");
/* In case these controls are set before streaming */
mutex_unlock(&xc7160->mutex);
ret = v4l2_ctrl_handler_setup(&xc7160->ctrl_handler);
mutex_lock(&xc7160->mutex);
if (ret)
return ret;
return 0;
}
static int __xc7160_stop_stream(struct xc7160 *xc7160)
{
int ret;
ret = xc7160_write_array(xc7160->client, xc7160_stream_off_regs);
if(ret)
printk("%s: write stream off failed\n",__func__);
return ret;
}
static int xc7160_check_isp_id(struct xc7160 *xc7160,
struct i2c_client *client)
{
struct device *dev = &xc7160->client->dev;
u32 id = 0;
int ret;
ret = xc7160_write_reg(client, XC7160_REG_HIGH_SELECT,XC7160_REG_VALUE_08BIT, 0x80);
if (ret){
dev_err(dev, "write XC7160_REG_HIGH_SELECT failed\n");
return ret;
}
ret = xc7160_read_reg(client, XC7160_CHIP_REG_ID1_ZYK ,
XC7160_REG_VALUE_08BIT, &id);
if (id == XC7160_CHIP_ID1_ZYK ) {
dev_info(dev, "isp chip is xc7160\n");
ret = xc7160_read_reg(client, XC7160_CHIP_REG_ID2_ZYK ,
XC7160_REG_VALUE_08BIT, &id);
if (id != XC7160_CHIP_ID2_ZYK ) {
dev_err(dev, "Unexpected sensor of XC7160_CHIP_ID_REG2, id(%06x), ret(%d)\n", id, ret);
return ret;
}
}
return 0;
}
static int __xc7160_power_on(struct xc7160 *xc7160);
static void __xc7160_power_off(struct xc7160 *xc7160);
static int xc7160_s_power(struct v4l2_subdev *sd, int on)
{
struct xc7160 *xc7160 = to_xc7160(sd);
struct i2c_client *client = xc7160->client;
struct device *dev = &xc7160->client->dev;
int ret = 0;
//dump_stack();
mutex_lock(&xc7160->mutex);
/* If the power state is not modified - no work to do. */
if (xc7160->power_on == !!on)
goto unlock_and_return;
if (on) {
ret = pm_runtime_get_sync(&client->dev);
if (ret < 0) {
pm_runtime_put_noidle(&client->dev);
goto unlock_and_return;
}
ret = __xc7160_power_on(xc7160);
if(ret){
dev_err(dev, "xc7160 power on failed\n");
}
xc7160->power_on = true;
//if(xc7160->initial_status != true){
// ret = camera_isp_sensor_initial(xc7160);
//}
ret = xc7160_check_isp_id(xc7160,xc7160->client);
if (ret){
dev_err(dev, "write XC7160_REG_HIGH_SELECT failed\n");
goto unlock_and_return;
}
// if(xc7160->initial_status != true){
// xc7160_global_regs = xc7160->cur_mode->isp_reg_list;
// sc8238_global_regs = xc7160->cur_mode->sensor_reg_list;
// camera_isp_sensor_initial(xc7160);
// }
// /* export gpio */
// if (!IS_ERR(xc7160->reset_gpio))
// gpiod_export(xc7160->reset_gpio, false);
// if (!IS_ERR(xc7160->pwdn_gpio))
// gpiod_export(xc7160->pwdn_gpio, false);
} else {
pm_runtime_put(&client->dev);
__xc7160_power_off(xc7160);
xc7160->power_on = false;
/* unexport gpio */
if (!IS_ERR(xc7160->reset_gpio))
gpiod_unexport(xc7160->reset_gpio);
if (!IS_ERR(xc7160->pwdn_gpio))
gpiod_unexport(xc7160->pwdn_gpio);
}
unlock_and_return:
ret = xc7160_write_array(xc7160->client, xc7160_i2c_bypass_off_regs);
mutex_unlock(&xc7160->mutex);
return ret;
}
static int xc7160_s_stream(struct v4l2_subdev *sd, int on)
{
struct xc7160 *xc7160 = to_xc7160(sd);
struct i2c_client *client = xc7160->client;
int ret = 0;
if(xc7160->initial_status != true){
xc7160_global_regs = xc7160->cur_mode->isp_reg_list;
sc8238_global_regs = xc7160->cur_mode->sensor_reg_list;
camera_isp_sensor_initial(xc7160);
}
/* export gpio */
if (!IS_ERR(xc7160->reset_gpio))
gpiod_export(xc7160->reset_gpio, false);
if (!IS_ERR(xc7160->pwdn_gpio))
gpiod_export(xc7160->pwdn_gpio, false);
mutex_lock(&xc7160->mutex);
on = !!on;
if (on == xc7160->streaming){
goto unlock_and_return;
}
if (on) {
ret = pm_runtime_get_sync(&client->dev);
if (ret < 0) {
pm_runtime_put_noidle(&client->dev);
goto unlock_and_return;
}
ret = __xc7160_start_stream(xc7160);
if (ret) {
v4l2_err(sd, "start stream failed while write regs\n");
pm_runtime_put(&client->dev);
goto unlock_and_return;
}
} else {
__xc7160_stop_stream(xc7160);
pm_runtime_put(&client->dev);
}
xc7160->streaming = on;
unlock_and_return:
mutex_unlock(&xc7160->mutex);
return ret;
}
/* Calculate the delay in us by clock rate and clock cycles */
static inline u32 xc7160_cal_delay(u32 cycles)
{
return DIV_ROUND_UP(cycles, XC7160_XVCLK_FREQ / 1000 / 1000);
}
static int __xc7160_power_on(struct xc7160 *xc7160)
{
int ret;
u32 delay_us;
struct device *dev = &xc7160->client->dev;
if (!IS_ERR_OR_NULL(xc7160->pins_default)) {
ret = pinctrl_select_state(xc7160->pinctrl,
xc7160->pins_default);
if (ret < 0)
dev_err(dev, "could not set pins\n");
}
if (!IS_ERR(xc7160->reset_gpio))
gpiod_set_value_cansleep(xc7160->reset_gpio, 0);
if (!IS_ERR(xc7160->pwdn_gpio))
gpiod_set_value_cansleep(xc7160->pwdn_gpio, 0);
msleep(4);
if (clkout_enabled_index){
ret = clk_prepare_enable(xc7160->xvclk);
if (ret < 0) {
dev_err(dev, "Failed to enable xvclk\n");
return ret;
}
}
ret = regulator_bulk_enable(XC7160_NUM_SUPPLIES, xc7160->supplies);
if (ret < 0) {
dev_err(dev, "Failed to enable regulators\n");
goto disable_clk;
}
if (!IS_ERR(xc7160->mipi_pwr_gpio))
gpiod_set_value_cansleep(xc7160->mipi_pwr_gpio, 1);
usleep_range(500, 1000);
if (!IS_ERR(xc7160->reset_gpio))
gpiod_set_value_cansleep(xc7160->reset_gpio, 1);
usleep_range(500, 1000);
if (!IS_ERR(xc7160->pwdn_gpio))
gpiod_set_value_cansleep(xc7160->pwdn_gpio, 1);
// msleep(25);
// /* 8192 cycles prior to first SCCB transaction */
delay_us = xc7160_cal_delay(8192);
usleep_range(delay_us, delay_us * 2);
// xc7160->power_on = true;
return 0;
disable_clk:
if (clkout_enabled_index)
clk_disable_unprepare(xc7160->xvclk);
return ret;
}
static void __xc7160_power_off(struct xc7160 *xc7160)
{
int ret;
struct device *dev = &xc7160->client->dev;
xc7160->initial_status = false;
if (!IS_ERR(xc7160->reset_gpio))
gpiod_set_value_cansleep(xc7160->reset_gpio, 1);
if (!IS_ERR(xc7160->pwdn_gpio))
gpiod_set_value_cansleep(xc7160->pwdn_gpio,1);
if (!IS_ERR(xc7160->mipi_pwr_gpio))
gpiod_set_value_cansleep(xc7160->mipi_pwr_gpio,1);
if (clkout_enabled_index)
clk_disable_unprepare(xc7160->xvclk);
if (!IS_ERR_OR_NULL(xc7160->pins_sleep)) {
ret = pinctrl_select_state(xc7160->pinctrl,
xc7160->pins_sleep);
if (ret < 0)
dev_dbg(dev, "could not set pins\n");
}
regulator_bulk_disable(XC7160_NUM_SUPPLIES, xc7160->supplies);
}
static int xc7160_runtime_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct xc7160 *xc7160 = to_xc7160(sd);
if(xc7160->power_on == false)
return __xc7160_power_on(xc7160);
else
printk("xc7160 is power on, nothing to do\n");
return 0;
}
static int xc7160_runtime_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct xc7160 *xc7160 = to_xc7160(sd);
if(xc7160->power_on == true){
__xc7160_power_off(xc7160);
xc7160->power_on = false;
}
return 0;
}
static int xc7160_enum_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval_enum *fie)
{
if (fie->index >= ARRAY_SIZE(supported_modes))
return -EINVAL;
fie->width = supported_modes[fie->index].width;
fie->height = supported_modes[fie->index].height;
fie->interval = supported_modes[fie->index].max_fps;
return 0;
}
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
static int xc7160_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct xc7160 *xc7160 = to_xc7160(sd);
struct v4l2_mbus_framefmt *try_fmt =
v4l2_subdev_get_try_format(sd, fh->state, 0);
const struct xc7160_mode *def_mode = &supported_modes[0];
mutex_lock(&xc7160->mutex);
/* Initialize try_fmt */
try_fmt->width = def_mode->width;
try_fmt->height = def_mode->height;
try_fmt->code = XC7160_MEDIA_BUS_FMT;
try_fmt->field = V4L2_FIELD_NONE;
mutex_unlock(&xc7160->mutex);
/* No crop or compose */
return 0;
}
#endif
static int xc7160_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
struct v4l2_mbus_config *config)
{
config->type = V4L2_MBUS_CSI2_DPHY;
config->bus.mipi_csi2.num_data_lanes = XC7160_LANES;
return 0;
}
static const struct dev_pm_ops xc7160_pm_ops = {
SET_RUNTIME_PM_OPS(xc7160_runtime_suspend,
xc7160_runtime_resume, NULL)
};
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
static const struct v4l2_subdev_internal_ops xc7160_internal_ops = {
.open = xc7160_open,
};
#endif
static const struct v4l2_subdev_core_ops xc7160_core_ops = {
.log_status = v4l2_ctrl_subdev_log_status,
.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
.unsubscribe_event = v4l2_event_subdev_unsubscribe,
.s_power = xc7160_s_power,
.ioctl = xc7160_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl32 = xc7160_compat_ioctl32,
#endif
};
static const struct v4l2_subdev_video_ops xc7160_video_ops = {
.s_stream = xc7160_s_stream,
.g_frame_interval = xc7160_g_frame_interval,
};
static const struct v4l2_subdev_pad_ops xc7160_pad_ops = {
.enum_mbus_code = xc7160_enum_mbus_code,
.enum_frame_size = xc7160_enum_frame_sizes,
.enum_frame_interval = xc7160_enum_frame_interval,
.get_fmt = xc7160_get_fmt,
.set_fmt = xc7160_set_fmt,
.get_mbus_config = xc7160_g_mbus_config,
};
static const struct v4l2_subdev_ops xc7160_subdev_ops = {
.core = &xc7160_core_ops,
.video = &xc7160_video_ops,
.pad = &xc7160_pad_ops,
};
static int xc7160_initialize_controls(struct xc7160 *xc7160)
{
const struct xc7160_mode *mode;
struct v4l2_ctrl_handler *handler;
int ret;
handler = &xc7160->ctrl_handler;
mode = xc7160->cur_mode;
ret = v4l2_ctrl_handler_init(handler, 8);
if (ret)
return ret;
handler->lock = &xc7160->mutex;
xc7160->link_freq = v4l2_ctrl_new_int_menu(handler, NULL, V4L2_CID_LINK_FREQ,
ARRAY_SIZE(link_freq_menu_items) - 1, 0, link_freq_menu_items);
if (xc7160->link_freq)
xc7160->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
xc7160->pixel_rate = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE,
0, XC7160_PIXEL_RATE_HIGH, 1, XC7160_PIXEL_RATE_HIGH);
if (handler->error) {
ret = handler->error;
dev_err(&xc7160->client->dev,
"Failed to init controls(%d)\n", ret);
goto err_free_handler;
}
xc7160->subdev.ctrl_handler = handler;
return 0;
err_free_handler:
v4l2_ctrl_handler_free(handler);
return ret;
}
static int xc7160_configure_regulators(struct xc7160 *xc7160)
{
unsigned int i;
for (i = 0; i < XC7160_NUM_SUPPLIES; i++)
xc7160->supplies[i].supply = xc7160_supply_names[i];
return devm_regulator_bulk_get(&xc7160->client->dev,
XC7160_NUM_SUPPLIES,
xc7160->supplies);
}
static void free_gpio(struct xc7160 *xc7160)
{
if (!IS_ERR(xc7160->pwdn_gpio))
gpio_free(desc_to_gpio(xc7160->pwdn_gpio));
if (!IS_ERR(xc7160->reset_gpio))
gpio_free(desc_to_gpio(xc7160->reset_gpio));
if (!IS_ERR(xc7160->mipi_pwr_gpio))
gpio_free(desc_to_gpio(xc7160->mipi_pwr_gpio));
}
static int xc7160_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct device_node *node = dev->of_node;
struct device_node *endpoint_node = NULL;
struct v4l2_fwnode_endpoint vep = {0};
struct xc7160 *xc7160;
struct v4l2_subdev *sd;
char facing[2];
int ret;
dev_info(dev, "T-chip firefly camera driver version: %02x.%02x.%02x",
DRIVER_VERSION >> 16,
(DRIVER_VERSION & 0xff00) >> 8,
DRIVER_VERSION & 0x00ff);
xc7160 = devm_kzalloc(dev, sizeof(*xc7160), GFP_KERNEL);
if (!xc7160)
return -ENOMEM;
/* Model info */
ret = of_property_read_u32(node, RKMODULE_CAMERA_MODULE_INDEX,
&xc7160->module_index);
ret |= of_property_read_string(node, RKMODULE_CAMERA_MODULE_FACING,
&xc7160->module_facing);
ret |= of_property_read_string(node, RKMODULE_CAMERA_MODULE_NAME,
&xc7160->module_name);
ret |= of_property_read_string(node, RKMODULE_CAMERA_LENS_NAME,
&xc7160->len_name);
if (ret) {
dev_err(dev, "could not get module information!\n");
return -EINVAL;
}
/* Parse dts Clk、Pwr、PDN、Rest */
xc7160->client = client;
xc7160->cur_mode = &supported_modes[0];
if (clkout_enabled_index){
xc7160->xvclk = devm_clk_get(dev, "xvclk");
if (IS_ERR(xc7160->xvclk)) {
dev_err(dev, "Failed to get xvclk\n");
return -EINVAL;
}
ret = clk_set_rate(xc7160->xvclk, XC7160_XVCLK_FREQ);
if (ret < 0) {
dev_err(dev, "Failed to set xvclk rate (24MHz)\n");
return ret;
}
if (clk_get_rate(xc7160->xvclk) != XC7160_XVCLK_FREQ)
dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
}
xc7160->mipi_pwr_gpio = devm_gpiod_get(dev, "power", GPIOD_OUT_LOW);
if (IS_ERR(xc7160->mipi_pwr_gpio))
dev_warn(dev, "Failed to get power-gpios, maybe no use\n");
xc7160->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(xc7160->reset_gpio)) {
dev_info(dev, "Failed to get reset-gpios, maybe no use\n");
}
xc7160->pwdn_gpio = devm_gpiod_get(dev, "pwdn", GPIOD_OUT_LOW);
if (IS_ERR(xc7160->pwdn_gpio)) {
dev_info(dev, "Failed to get pwdn-gpios, maybe no use\n");
}
ret = xc7160_configure_regulators(xc7160);
if (ret) {
dev_err(dev, "Failed to get power regulators\n");
return ret;
}
xc7160->pinctrl = devm_pinctrl_get(dev);
if (!IS_ERR(xc7160->pinctrl)) {
xc7160->pins_default =
pinctrl_lookup_state(xc7160->pinctrl,
OF_CAMERA_PINCTRL_STATE_DEFAULT);
if (IS_ERR(xc7160->pins_default))
dev_err(dev, "could not get default pinstate\n");
xc7160->pins_sleep =
pinctrl_lookup_state(xc7160->pinctrl,
OF_CAMERA_PINCTRL_STATE_SLEEP);
if (IS_ERR(xc7160->pins_sleep))
dev_err(dev, "could not get sleep pinstate\n");
}
/* Parse lane number */
endpoint_node = of_find_node_by_name(node,"endpoint");
if(endpoint_node != NULL){
//printk("xc7160 get endpoint node success\n");
ret=v4l2_fwnode_endpoint_parse(&endpoint_node->fwnode, &vep);
if(ret){
dev_info(dev, "Failed to get xc7160 endpoint data lanes, set a default value\n");
xc7160->lane_data_num = 4;
}else{
dev_info(dev, "Success to get xc7160 endpoint data lanes, dts uses %d lanes\n", vep.bus.mipi_csi2.num_data_lanes);
xc7160->lane_data_num = vep.bus.mipi_csi2.num_data_lanes;
}
}else{
dev_info(dev,"xc7160 get endpoint node failed\n");
return -ENOENT;
}
mutex_init(&xc7160->mutex);
/* Init v4l2 subdev */
sd = &xc7160->subdev;
v4l2_i2c_subdev_init(sd, client, &xc7160_subdev_ops);
ret = xc7160_initialize_controls(xc7160);
if (ret)
goto err_destroy_mutex;
/* Check chip id */
ret = __xc7160_power_on(xc7160);
if (ret) {
dev_err(dev, "--xc--__xc7160_power_on failed\n");
goto err_power_off;
}
ret = xc7160_check_isp_id(xc7160, client);
if (ret)
goto err_power_off;
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
sd->internal_ops = &xc7160_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
#endif
#if defined(CONFIG_MEDIA_CONTROLLER)
xc7160->pad.flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_pads_init(&sd->entity, 1, &xc7160->pad);
if (ret < 0)
goto err_power_off;
#endif
memset(facing, 0, sizeof(facing));
if (strcmp(xc7160->module_facing, "back") == 0)
facing[0] = 'b';
else
facing[0] = 'f';
snprintf(sd->name, sizeof(sd->name), "m%02d_%s_%s %s",
xc7160->module_index, facing,
XC7160_NAME, dev_name(sd->dev));
ret = v4l2_async_register_subdev_sensor(sd);
if (ret) {
dev_err(dev, "Failed to register v4l2 async subdev\n");
goto err_clean_entity;
}
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
pm_runtime_idle(dev);
return 0;
err_clean_entity:
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
#endif
err_power_off:
__xc7160_power_off(xc7160);
free_gpio(xc7160);
//err_free_handler:
v4l2_ctrl_handler_free(&xc7160->ctrl_handler);
err_destroy_mutex:
mutex_destroy(&xc7160->mutex);
return ret;
}
static void xc7160_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct xc7160 *xc7160 = to_xc7160(sd);
v4l2_async_unregister_subdev(sd);
#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
#endif
v4l2_ctrl_handler_free(&xc7160->ctrl_handler);
mutex_destroy(&xc7160->mutex);
pm_runtime_disable(&client->dev);
if (!pm_runtime_status_suspended(&client->dev))
__xc7160_power_off(xc7160);
pm_runtime_set_suspended(&client->dev);
}
#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id xc7160_of_match[] = {
{ .compatible = "firefly,xc7160" },
{},
};
MODULE_DEVICE_TABLE(of, xc7160_of_match);
#endif
static const struct i2c_device_id xc7160_match_id[] = {
{ "firefly,xc7160", 0 },
{ },
};
static struct i2c_driver xc7160_i2c_driver = {
.driver = {
.name = "xc7160",
.pm = &xc7160_pm_ops,
.of_match_table = of_match_ptr(xc7160_of_match),
},
.probe = &xc7160_probe,
.remove = &xc7160_remove,
.id_table = xc7160_match_id,
};
static int __init sensor_mod_init(void)
{
return i2c_add_driver(&xc7160_i2c_driver);
}
static void __exit sensor_mod_exit(void)
{
i2c_del_driver(&xc7160_i2c_driver);
}
device_initcall_sync(sensor_mod_init);
module_exit(sensor_mod_exit);
MODULE_DESCRIPTION("OmniVision xc7160 sensor driver");
MODULE_LICENSE("GPL v2");
Z:\git_RK3576_Linux6.1\kernel-6.1\drivers\media\i2c\xc7160_regs.h
#ifndef XC7160_REGS_H
#define XC7160_REGS_H
#define REG_NULL 0xFFFF
#define REG_DL 0xFF
struct regval {
u16 addr;
u8 val;
};
static const struct regval xc7160_stream_on_regs[] = {
{0xfffd, 0x80},
{0xfffe, 0x26},
{0x8010, 0x0d},
{0xfffe,0x30},
{0x0004,0x10},
{0x2300,0xfc},
{REG_NULL, 0x00},
};
static const struct regval xc7160_stream_off_regs[] = {
{0xfffd, 0x80},
{0xfffe, 0x26},
{0x8010, 0x09},
{REG_NULL, 0x00},
};
static const struct regval xc7160_colorbar_on_regs[] = {
{0xfffd, 0x80},
{0xfffe,0x26},
{0x8010,0x04},
{0xfffe,0x50},
{0x0090,0x3a},
{REG_NULL, 0x00},
};
static const struct regval xc7160_i2c_bypass_on_regs[] = {
{0xfffd, 0x80},
{0xfffe, 0x50},
{0x004d, 0x01},
{REG_NULL, 0x00},
};
static const struct regval xc7160_i2c_bypass_off_regs[] = {
{0xfffd, 0x80},
{0xfffe, 0x50},
{0x004d, 0x00},
{REG_NULL, 0x00},
};
/**************************************************************
1080P 30FPS
***************************************************************/
static const struct regval isp_xc7160_1080p_30fps_2022617_regs[] = {
//Initial_start
{0xfffd,0x80},
{0xfffe,0x50},
{0x001c,0xff},
{0x001d,0xff},
{0x001e,0xff},
{0x001f,0xff}, //clk_en
{0x0018,0x00},
{0x0019,0x00},
{0x001a,0x00},
{0x001b,0x00}, //reset
{0x0030,0x44},
{0x0031,0xd8},
{0x0032,0x35},
{0x0033,0x70},
{0x0020,0x02},
{0x0021,0x0d},
{0x0022,0x01},
{0x0023,0x85},
{0x0024,0x06},
{0x0025,0x05},
{0x0026,0x01},
{0x0027,0x06},
{0x0028,0x01},
{0x0029,0x00},
{0x002a,0x02},
{0x002b,0x05},
{0x002e,0x01}, //PLL
{0xfffe,0x50},
{0x0050,0x0f},
{0x0054,0x0f},
{0x0058,0x03}, //GPIO_Ctr
{0xfffe,0x50},
{0x00bc,0x19},
{0x0090,0x38},
{0x0200,0x0f}, //mipi_rx1_pad
{0x0201,0x00},
{0x0202,0x80},
{0x0203,0x00},
{0xfffe,0x26},
{0x8000,0x1d}, //colorbar
{0x8001,0x80},
{0x8002,0x07},
{0x8003,0x38},
{0x8004,0x04},
{0x8005,0x03},
{0x8006,0x05},
{0x8007,0x99},
{0x8008,0x14},
{0x8009,0x04},
{0xfffe,0x26},
{0x8010,0x04}, //before_isp_crop
{0x8012,0x80},
{0x8013,0x07},
{0x8014,0x38},
{0x8015,0x04},
{0x8016,0x00},
{0x8017,0x00},
{0x8018,0x00},
{0x8019,0x00},
{0xfffe,0x30},
{0x0000,0x01}, //isp_set
{0x0001,0x00},
{0x0002,0x10},
{0x0003,0x20},
{0x0004,0x10},
{0x0019,0x08},
{0x0050,0x20}, //dummy_line
{0x005e,0x7f},
{0x005f,0x07},
{0x0060,0x37},
{0x0061,0x04},
{0x0064,0x80},
{0x0065,0x07},
{0x0066,0x38},
{0x0067,0x04},
{0x0006,0x07},
{0x0007,0x80},
{0x0008,0x04},
{0x0009,0x38},
{0x000a,0x07},
{0x000b,0x80},
{0x000c,0x04},
{0x000d,0x38},
{0x001e,0x07}, //isp_scale
{0x001f,0x80},
{0x0020,0x04},
{0x0021,0x38},
{0x007e,0x07},
{0x007f,0x80},
{0x0080,0x04},
{0x0081,0x38},
{0x0082,0x00},
{0xfffe,0x30},
{0x1a00,0x00}, //isp_crop
{0x1a01,0x00},
{0x1a02,0x00},
{0x1a03,0x00},
{0x1a04,0x07},
{0x1a05,0x80},
{0x1a06,0x04},
{0x1a07,0x38},
{0x1a08,0x00},
{0xfffe,0x26},
{0x0000,0x20}, //mipi_rx_lane
{0x0009,0xc4}, //mipi_rx_set
{0xfffe,0x26},
{0x2019,0x07}, //mipi_tx
{0x201a,0x80},
{0x201b,0x04},
{0x201c,0x38},
{0x201d,0x00},
{0x201e,0x00},
{0x201f,0x00},
{0x2020,0x00},
{0x2015,0x81},
{0x2017,0x1e},
{0x2018,0x00},
{0x2023,0x03}, //mipi_tx_set
{0xfffe,0x2c},
{0x0000,0x00}, //stitch
{0x0008,0x10},
{0x0044,0x08}, //fifo
{0x0045,0x04},
{0x0048,0x0e},
{0x0049,0xf0},
{0xfffe,0x2e},
{0x0000,0x00}, //retiming
{0x0001,0xee},
{0x0003,0x00},
{0x0004,0xf0}, //影响帧率
{0xfffe,0x30},
{0x006c,0xa0}, //pixel_order
{0x1800,0x10},
{0xfffe,0x50},
{0x0226,0x02}, //rx2_off
{0xfffe,0x25},
{0x0002,0xf0}, //i2c_master_speed
{REG_NULL, REG_DL},
//patch_start
//以下patch setting需根据实际需求或先前参数添加进来
{0xfffd, 0x80},
{0xfffe, 0x50},
{0x000e, 0x54},
{0xfffe, 0x14},
{0x0006, 0x9},
{0x0007, 0x44},
{0x0014, 0x00},
{0x0015, 0x14},
{0x0016, 0x22},
{0x0017, 0xd4},
{0x2114, 0x9c},
{0x2115, 0x21},
{0x2116, 0xff},
{0x2117, 0xec},
{0x2118, 0xd4},
{0x2119, 0x1},
{0x211a, 0x48},
{0x211b, 0x0},
{0x211c, 0xd4},
{0x211d, 0x1},
{0x211e, 0x50},
{0x211f, 0x4},
{0x2120, 0xd4},
{0x2121, 0x1},
{0x2122, 0x60},
{0x2123, 0x8},
{0x2124, 0xd4},
{0x2125, 0x1},
{0x2126, 0x70},
{0x2127, 0xc},
{0x2128, 0xd4},
{0x2129, 0x1},
{0x212a, 0x80},
{0x212b, 0x10},
{0x212c, 0x7},
{0x212d, 0xfb},
{0x212e, 0x7},
{0x212f, 0xa3},
{0x2130, 0x15},
{0x2131, 0x0},
{0x2132, 0x0},
{0x2133, 0x0},
{0x2134, 0x84},
{0x2135, 0x6b},
{0x2136, 0x0},
{0x2137, 0x8},
{0x2138, 0x84},
{0x2139, 0xa3},
{0x213a, 0x1},
{0x213b, 0xc},
{0x213c, 0xbc},
{0x213d, 0x45},
{0x213e, 0x0},
{0x213f, 0x3f},
{0x2140, 0x10},
{0x2141, 0x0},
{0x2142, 0x0},
{0x2143, 0xf},
{0x2144, 0xbc},
{0x2145, 0x45},
{0x2146, 0x0},
{0x2147, 0x7f},
{0x2148, 0x9c},
{0x2149, 0x60},
{0x214a, 0x27},
{0x214b, 0x10},
{0x214c, 0x9c},
{0x214d, 0x80},
{0x214e, 0x13},
{0x214f, 0x60},
{0x2150, 0xe0},
{0x2151, 0x65},
{0x2152, 0x1b},
{0x2153, 0x6},
{0x2154, 0x9d},
{0x2155, 0x80},
{0x2156, 0x0},
{0x2157, 0x3},
{0x2158, 0x9e},
{0x2159, 0x0},
{0x215a, 0x0},
{0x215b, 0x0},
{0x215c, 0x9d},
{0x215d, 0xc0},
{0x215e, 0x0},
{0x215f, 0x80},
{0x2160, 0x18},
{0x2161, 0xa0},
{0x2162, 0xff},
{0x2163, 0xfb},
{0x2164, 0xa8},
{0x2165, 0xa5},
{0x2166, 0x1e},
{0x2167, 0x0},
{0x2168, 0x7},
{0x2169, 0xfb},
{0x216a, 0x78},
{0x216b, 0x39},
{0x216c, 0xe0},
{0x216d, 0x63},
{0x216e, 0x28},
{0x216f, 0x0},
{0x2170, 0x9c},
{0x2171, 0x8b},
{0x2172, 0x0},
{0x2173, 0x40},
{0x2174, 0x0},
{0x2175, 0x0},
{0x2176, 0x0},
{0x2177, 0x37},
{0x2178, 0xa5},
{0x2179, 0x44},
{0x217a, 0xff},
{0x217b, 0xff},
{0x217c, 0x10},
{0x217d, 0x0},
{0x217e, 0x0},
{0x217f, 0xb},
{0x2180, 0xbc},
{0x2181, 0x45},
{0x2182, 0x0},
{0x2183, 0xff},
{0x2184, 0x9c},
{0x2185, 0x60},
{0x2186, 0x27},
{0x2187, 0x10},
{0x2188, 0x9c},
{0x2189, 0x80},
{0x218a, 0x27},
{0x218b, 0x60},
{0x218c, 0xe0},
{0x218d, 0x65},
{0x218e, 0x1b},
{0x218f, 0x6},
{0x2190, 0x9d},
{0x2191, 0x80},
{0x2192, 0x0},
{0x2193, 0x7},
{0x2194, 0x9e},
{0x2195, 0x0},
{0x2196, 0x0},
{0x2197, 0x0},
{0x2198, 0x9d},
{0x2199, 0xc0},
{0x219a, 0x0},
{0x219b, 0x80},
{0x219c, 0x18},
{0x219d, 0xa0},
{0x219e, 0xff},
{0x219f, 0xf6},
{0x21a0, 0x3},
{0x21a1, 0xff},
{0x21a2, 0xff},
{0x21a3, 0xf2},
{0x21a4, 0xa8},
{0x21a5, 0xa5},
{0x21a6, 0x3c},
{0x21a7, 0x0},
{0x21a8, 0xc},
{0x21a9, 0x0},
{0x21aa, 0x0},
{0x21ab, 0xe},
{0x21ac, 0x9c},
{0x21ad, 0x60},
{0x21ae, 0x3},
{0x21af, 0xe8},
{0x21b0, 0xbc},
{0x21b1, 0x45},
{0x21b2, 0x1},
{0x21b3, 0xfc},
{0x21b4, 0x10},
{0x21b5, 0x0},
{0x21b6, 0x0},
{0x21b7, 0x13},
{0x21b8, 0xbc},
{0x21b9, 0x45},
{0x21ba, 0x7},
{0x21bb, 0xef},
{0x21bc, 0x9c},
{0x21bd, 0x60},
{0x21be, 0x3},
{0x21bf, 0xe8},
{0x21c0, 0x9c},
{0x21c1, 0x80},
{0x21c2, 0xf},
{0x21c3, 0xa0},
{0x21c4, 0xe0},
{0x21c5, 0x65},
{0x21c6, 0x1b},
{0x21c7, 0x6},
{0x21c8, 0x9d},
{0x21c9, 0x80},
{0x21ca, 0x0},
{0x21cb, 0x1f},
{0x21cc, 0x9e},
{0x21cd, 0x0},
{0x21ce, 0x0},
{0x21cf, 0x0},
{0x21d0, 0x9d},
{0x21d1, 0xc0},
{0x21d2, 0x0},
{0x21d3, 0x80},
{0x21d4, 0x18},
{0x21d5, 0xa0},
{0x21d6, 0xff},
{0x21d7, 0xfc},
{0x21d8, 0x3},
{0x21d9, 0xff},
{0x21da, 0xff},
{0x21db, 0xe4},
{0x21dc, 0xa8},
{0x21dd, 0xa5},
{0x21de, 0x18},
{0x21df, 0x0},
{0x21e0, 0x9c},
{0x21e1, 0x80},
{0x21e2, 0x7},
{0x21e3, 0xe0},
{0x21e4, 0xe0},
{0x21e5, 0x65},
{0x21e6, 0x1b},
{0x21e7, 0x6},
{0x21e8, 0x9d},
{0x21e9, 0x80},
{0x21ea, 0x0},
{0x21eb, 0xf},
{0x21ec, 0x9e},
{0x21ed, 0x0},
{0x21ee, 0x0},
{0x21ef, 0x0},
{0x21f0, 0x9d},
{0x21f1, 0xc0},
{0x21f2, 0x0},
{0x21f3, 0x80},
{0x21f4, 0x18},
{0x21f5, 0xa0},
{0x21f6, 0xff},
{0x21f7, 0xfe},
{0x21f8, 0x3},
{0x21f9, 0xff},
{0x21fa, 0xff},
{0x21fb, 0xdc},
{0x21fc, 0xa8},
{0x21fd, 0xa5},
{0x21fe, 0xc},
{0x21ff, 0x0},
{0x2200, 0xc},
{0x2201, 0x0},
{0x2202, 0x0},
{0x2203, 0xf},
{0x2204, 0x9c},
{0x2205, 0x60},
{0x2206, 0x0},
{0x2207, 0x64},
{0x2208, 0xbc},
{0x2209, 0x45},
{0x220a, 0xf},
{0x220b, 0xdf},
{0x220c, 0x10},
{0x220d, 0x0},
{0x220e, 0x0},
{0x220f, 0x12},
{0x2210, 0xa8},
{0x2211, 0x8c},
{0x2212, 0x0},
{0x2213, 0x0},
{0x2214, 0x9c},
{0x2215, 0x60},
{0x2216, 0x0},
{0x2217, 0x32},
{0x2218, 0x9c},
{0x2219, 0x80},
{0x221a, 0x5},
{0x221b, 0xff},
{0x221c, 0xe0},
{0x221d, 0x65},
{0x221e, 0x1b},
{0x221f, 0x6},
{0x2220, 0x9e},
{0x2221, 0x0},
{0x2222, 0x0},
{0x2223, 0x1},
{0x2224, 0x9d},
{0x2225, 0x80},
{0x2226, 0x0},
{0x2227, 0x3f},
{0x2228, 0x7},
{0x2229, 0xfb},
{0x222a, 0x78},
{0x222b, 0x9},
{0x222c, 0x9d},
{0x222d, 0x40},
{0x222e, 0x0},
{0x222f, 0x7f},
{0x2230, 0xb8},
{0x2231, 0x8b},
{0x2232, 0x0},
{0x2233, 0x2},
{0x2234, 0x0},
{0x2235, 0x0},
{0x2236, 0x0},
{0x2237, 0x7},
{0x2238, 0xa5},
{0x2239, 0xc4},
{0x223a, 0xff},
{0x223b, 0xfc},
{0x223c, 0x9c},
{0x223d, 0x80},
{0x223e, 0x5},
{0x223f, 0xff},
{0x2240, 0xe0},
{0x2241, 0x65},
{0x2242, 0x1b},
{0x2243, 0x6},
{0x2244, 0x9e},
{0x2245, 0x0},
{0x2246, 0x0},
{0x2247, 0x0},
{0x2248, 0x3},
{0x2249, 0xff},
{0x224a, 0xff},
{0x224b, 0xf8},
{0x224c, 0x9d},
{0x224d, 0x80},
{0x224e, 0x0},
{0x224f, 0x1f},
{0x2250, 0xa8},
{0x2251, 0x8c},
{0x2252, 0x0},
{0x2253, 0x0},
{0x2254, 0x9c},
{0x2255, 0x60},
{0x2256, 0x3e},
{0x2257, 0x8},
{0x2258, 0x7},
{0x2259, 0xfb},
{0x225a, 0x17},
{0x225b, 0x2c},
{0x225c, 0x9c},
{0x225d, 0xa0},
{0x225e, 0x0},
{0x225f, 0x1},
{0x2260, 0xa8},
{0x2261, 0x8a},
{0x2262, 0x0},
{0x2263, 0x0},
{0x2264, 0x9c},
{0x2265, 0x60},
{0x2266, 0x3e},
{0x2267, 0x9},
{0x2268, 0x7},
{0x2269, 0xfb},
{0x226a, 0x17},
{0x226b, 0x28},
{0x226c, 0x9c},
{0x226d, 0xa0},
{0x226e, 0x0},
{0x226f, 0x1},
{0x2270, 0xa8},
{0x2271, 0x90},
{0x2272, 0x0},
{0x2273, 0x0},
{0x2274, 0x9c},
{0x2275, 0x60},
{0x2276, 0x3e},
{0x2277, 0x6},
{0x2278, 0x7},
{0x2279, 0xfb},
{0x227a, 0x17},
{0x227b, 0x24},
{0x227c, 0x9c},
{0x227d, 0xa0},
{0x227e, 0x0},
{0x227f, 0x1},
{0x2280, 0xa8},
{0x2281, 0x8e},
{0x2282, 0x0},
{0x2283, 0x0},
{0x2284, 0x9c},
{0x2285, 0x60},
{0x2286, 0x3e},
{0x2287, 0x7},
{0x2288, 0x7},
{0x2289, 0xfb},
{0x228a, 0x17},
{0x228b, 0x20},
{0x228c, 0x9c},
{0x228d, 0xa0},
{0x228e, 0x0},
{0x228f, 0x1},
{0x2290, 0x85},
{0x2291, 0x21},
{0x2292, 0x0},
{0x2293, 0x0},
{0x2294, 0x85},
{0x2295, 0x41},
{0x2296, 0x0},
{0x2297, 0x4},
{0x2298, 0x85},
{0x2299, 0x81},
{0x229a, 0x0},
{0x229b, 0x8},
{0x229c, 0x85},
{0x229d, 0xc1},
{0x229e, 0x0},
{0x229f, 0xc},
{0x22a0, 0x86},
{0x22a1, 0x1},
{0x22a2, 0x0},
{0x22a3, 0x10},
{0x22a4, 0x44},
{0x22a5, 0x0},
{0x22a6, 0x48},
{0x22a7, 0x0},
{0x22a8, 0x9c},
{0x22a9, 0x21},
{0x22aa, 0x0},
{0x22ab, 0x14},
{0x22ac, 0x9c},
{0x22ad, 0x21},
{0x22ae, 0xff},
{0x22af, 0xfc},
{0x22b0, 0xd4},
{0x22b1, 0x1},
{0x22b2, 0x48},
{0x22b3, 0x0},
{0x22b4, 0xbc},
{0x22b5, 0x23},
{0x22b6, 0x4},
{0x22b7, 0xc},
{0x22b8, 0x10},
{0x22b9, 0x0},
{0x22ba, 0x0},
{0x22bb, 0x4},
{0x22bc, 0x15},
{0x22bd, 0x0},
{0x22be, 0x0},
{0x22bf, 0x0},
{0x22c0, 0x7},
{0x22c1, 0xff},
{0x22c2, 0xff},
{0x22c3, 0x95},
{0x22c4, 0x15},
{0x22c5, 0x0},
{0x22c6, 0x0},
{0x22c7, 0x0},
{0x22c8, 0x85},
{0x22c9, 0x21},
{0x22ca, 0x0},
{0x22cb, 0x0},
{0x22cc, 0x44},
{0x22cd, 0x0},
{0x22ce, 0x48},
{0x22cf, 0x0},
{0x22d0, 0x9c},
{0x22d1, 0x21},
{0x22d2, 0x0},
{0x22d3, 0x4},
{0x22d4, 0x9c},
{0x22d5, 0x21},
{0x22d6, 0xff},
{0x22d7, 0xfc},
{0x22d8, 0xd4},
{0x22d9, 0x1},
{0x22da, 0x48},
{0x22db, 0x0},
{0x22dc, 0x7},
{0x22dd, 0xff},
{0x22de, 0xff},
{0x22df, 0xf4},
{0x22e0, 0x15},
{0x22e1, 0x0},
{0x22e2, 0x0},
{0x22e3, 0x0},
{0x22e4, 0x9d},
{0x22e5, 0x60},
{0x22e6, 0x0},
{0x22e7, 0x0},
{0x22e8, 0x85},
{0x22e9, 0x21},
{0x22ea, 0x0},
{0x22eb, 0x0},
{0x22ec, 0x44},
{0x22ed, 0x0},
{0x22ee, 0x48},
{0x22ef, 0x0},
{0x22f0, 0x9c},
{0x22f1, 0x21},
{0x22f2, 0x0},
{0x22f3, 0x4},
{0xfffe,0x50},
{0x0137,0x99},
{REG_NULL, REG_DL},
//patch_end
//IQ_start
//AE
{0xfffe,0x30},
{0x1f00,0x00},
{0x1f01,0x00}, //win_Xstart
{0x1f02,0x00},
{0x1f03,0x00}, //win_Ystart
{0x1f04,0x07},
{0x1f05,0x80}, //win_width
{0x1f06,0x04},
{0x1f07,0x38}, //win_height
{0x1f08,0x03},
{0x0051,0x01},
{0xfffe,0x14},
{0x000e,0x00}, //isp0_used_i2c
{0x010e,0x60}, //sensor_i2c_id
{0x010f,0x01}, //sensor_i2c_bits
{0x0110,0x05}, //type_gain
{0x0111,0x00}, //type_exp
{0x0114,0x3e}, //exp_addr
{0x0115,0x00},
{0x0116,0x3e},
{0x0117,0x01},
{0x0118,0x3e},
{0x0119,0x02},
{0x011a,0x00},
{0x011b,0x00},
{0x011c,0x00}, //exp_mask
{0x011d,0xff},
{0x011e,0x00},
{0x011f,0xff},
{0x0120,0x00},
{0x0121,0xf0},
{0x0122,0x00},
{0x0123,0x00},
{0x0134,0x3e}, //gain_addr
{0x0135,0x08},
{0x0136,0x3e},
{0x0137,0x09},
{0x0138,0x3e},
{0x0139,0x06},
{0x013a,0x3e},
{0x013b,0x07},
{0x013c,0x00}, //gain_mask
{0x013d,0xff},
{0x013e,0x00},
{0x013f,0xff},
{0x0140,0x00},
{0x0141,0xff},
{0x0142,0x00},
{0x0143,0xff},
//Area Weight
{0xfffe,0x14},
{0x0055,0x02},
{0x0056,0x04},
{0x0057,0x04},
{0x0058,0x04},
{0x0059,0x02},
{0x005a,0x02},
{0x005b,0x04},
{0x005c,0x04},
{0x005d,0x04},
{0x005e,0x02},
{0x005f,0x02},
{0x0060,0x04},
{0x0061,0x04},
{0x0062,0x04},
{0x0063,0x02},
{0x0064,0x02},
{0x0065,0x04},
{0x0066,0x04},
{0x0067,0x04},
{0x0068,0x02},
{0x0069,0x02},
{0x006a,0x04},
{0x006b,0x04},
{0x006c,0x04},
{0x006d,0x02},
//Attention
{0x0088,0x00},
{0x0089,0xe7},
{0x008a,0x39},
{0x008b,0xce},
{0x0050,0x01}, //refresh
//AE base
{0xfffe,0x14},
{0x004c,0x00}, //AEC_mode
{0x004d,0x01}, //AE_force_write
{0x00a0,0x01},
{0x00a1,0x88}, //day_target
{0x00de,0x00},
{0x00df,0x20}, //min_exp
{0x00e0,0x00},
{0x00e1,0x00},
{0x00e2,0x80},
{0x00e3,0x00}, //max_exp
{0x00fa,0x01},
{0x00fb,0x00}, //max_gain
{0x00fc,0x00},
{0x00fd,0x20}, //min_gain
{0x0104,0x00}, //flicker
{0x0105,0x01}, //min_flickerlines_en
{0x0106,0x11},
{0x0107,0x30}, //60Hz
{0x0108,0x14},
{0x0109,0xa0}, //50Hz
//AE speed
{0x00c6,0x01}, //delay_frame
{0x0144,0x00}, //exp_delay
{0x0145,0x00}, //gain_delay
{0x0031,0x03}, //exp_mode
{0x0032,0x03}, //gain_mode
{0x00c7,0x08}, //finally_thr
{0x00ca,0x00},
{0x00cb,0x40}, //thr_low
{0x00cc,0x00},
{0x00cd,0x60}, //thr_high
{0x00ce,0x00},
{0x00cf,0x40}, //jump_thr
{0x00d4,0x00},
{0x00d5,0x80}, //jump_mutiple
{0x00d6,0x00},
{0x00d7,0x80}, //max_jump_ratio
{0x00d9,0x00}, //max_jump_cnt
{0x00da,0x00},
{0x00db,0x00}, //luma_diff_thr_low
{0x00dc,0x03},
{0x00dd,0x40}, //luma_diff_thr_high
{0x01bc,0x00},
{0x01bd,0x20}, //thr_l_all
{0x01be,0x00},
{0x01bf,0x28}, //thr_l_avg
{0x00c8,0x01}, //total_speed
{0x0208,0x00}, //limit_speed
//AE smart
{0x0092,0x00}, //smart_mode
{0x0093,0x00}, //analysis_mode
{0x0094,0x00}, //smart_speed_limit
{0x0095,0x01}, //PDFH_move_avg
{0x00ad,0x03}, //ATT_block_cnt
{0x01c0,0x0a}, //PDFH_used_cnt
//table reftarget
{0x0022,0x1e}, //use_cur_fps
{0x01e4,0x00},
{0x01e5,0x00},
{0x01e6,0x0b},
{0x01e7,0x00}, //table0
{0x01e8,0x00},
{0x01e9,0x00},
{0x01ea,0x2c},
{0x01eb,0x00}, //table1
{0x01ec,0x00},
{0x01ed,0x00},
{0x01ee,0xb0},
{0x01ef,0x00}, //table2
{0x01f0,0x00},
{0x01f1,0x02},
{0x01f2,0xc0},
{0x01f3,0x00}, //table3
{0x01f4,0x00},
{0x01f5,0x0b},
{0x01f6,0x00},
{0x01f7,0x00}, //table4
{0x01f8,0x00},
{0x01f9,0x2c},
{0x01fa,0x00},
{0x01fb,0x00}, //table5
//reftarget
{0x00b2,0x00},
{0x00b3,0xf0}, //ref_target_table0
{0x00b4,0x00},
{0x00b5,0xf0}, //ref_target_table1
{0x00b6,0x00},
{0x00b7,0xd0}, //ref_target_table2
{0x00b8,0x00},
{0x00b9,0xb0}, //ref_target_table3
{0x00ba,0x00},
{0x00bb,0xb0}, //ref_target_table4
{0x00bc,0x00},
{0x00bd,0xb0}, //ref_target_table5
{0x01cb,0x00}, //avg_thr_low
{0x01cc,0x60}, //avg_thr_high
{0x01cd,0x23}, //avg_affect_val
//over exposure offset
{0x01d6,0x10},
{0x01d7,0x0e},
{0x01d8,0x1e},
{0x01d9,0x2c},
{0x01da,0x30},
{0x01db,0x28},
//main body ratio table
{0x01dc,0x40},
{0x01dd,0x30},
{0x01de,0x20},
{0x01df,0x10},
{0x01e0,0x00},
{0x01e1,0x00},
{0x01b0,0x40}, //PDFL_brighten_max
{0x01b1,0x25}, //variance_affect_val
{0x01b2,0x01},
{0x01b3,0x00}, //variance_thr_low
{0x01b4,0x08},
{0x01b5,0x00}, //variance_thr_high
{0x01c6,0x30}, //PDFL_target
{0x01c7,0x1f}, //PDFH_max
{0x01c9,0x01}, //PDFH_target
{0x01ca,0x80}, //over_exp_affect_val_1
{0x01d0,0x01}, //over_exp_ref
{0x01d1,0x60}, //over_exp_affect_val_0
{0x01d2,0x08}, //under_exp_affect_val
{0x021d,0x04}, //PDFH_brighten_thr
{0x01b7,0x00}, //bright_ratio_thr_low
{0x01b8,0x20}, //bright_ratio_thr_middle
{0x01b9,0x60}, //bright_ratio_thr_high
{0x01ba,0x10}, //bright_ratio_affect
{0x00a6,0x32}, //CDF_high
{0x00a7,0x20}, //CDF_low
{0x0168,0x00},
{0x0169,0x00}, //min_avg_thr
{0x016a,0x03},
{0x016b,0x00}, //max_avg_thr
{0x016c,0x00},
{0x016d,0xa0}, //min_ATT_thr
{0x016e,0x02},
{0x016f,0x80}, //max_ATT_thr
{0x01d3,0x00}, //ATT_limit_affect_val_low
{0x01d4,0x10}, //ATT_limit_affect_val_high
{0x01d5,0x10}, //global_limit_ratio
{0x1a74,0x01}, //AE_mutiple_frame
{0x1a75,0x00}, //AE_active_frame
//LENC
{0xfffe,0x30},
{0x03ca,0x0c}, //lenc_scale
{0x03cb,0xcc},
{0x03cc,0x16},
{0x03cd,0xc1},
{0x03ce,0x0c},
{0x03cf,0xcc},
{0x03d0,0x0b},
{0x03d1,0x60},
{0x000e,0x00},
{0x000f,0x00},
{0x0010,0x00},
{0x0011,0x00},
{0x0012,0x80}, //lenc_skip
{0xfffe,0x14},
{0x0928,0x00},
{0x0929,0x60}, //Alight_CT_thr
{0x092a,0x00},
{0x092b,0xaf}, //Clight_CT_thr
{0x092c,0x00},
{0x092d,0xde}, //Dlight_CT_thr
{0x06e5,0x3b}, //A_light
{0x06e6,0x28},
{0x06e7,0x20},
{0x06e8,0x1d},
{0x06e9,0x1d},
{0x06ea,0x20},
{0x06eb,0x2a},
{0x06ec,0x3d},
{0x06ed,0x13},
{0x06ee,0x10},
{0x06ef,0x0d},
{0x06f0,0x0c},
{0x06f1,0x0c},
{0x06f2,0x0d},
{0x06f3,0x11},
{0x06f4,0x14},
{0x06f5,0x0b},
{0x06f6,0x08},
{0x06f7,0x05},
{0x06f8,0x04},
{0x06f9,0x04},
{0x06fa,0x05},
{0x06fb,0x08},
{0x06fc,0x0c},
{0x06fd,0x07},
{0x06fe,0x04},
{0x06ff,0x01},
{0x0700,0x00},
{0x0701,0x00},
{0x0702,0x01},
{0x0703,0x04},
{0x0704,0x07},
{0x0705,0x07},
{0x0706,0x04},
{0x0707,0x01},
{0x0708,0x00},
{0x0709,0x00},
{0x070a,0x02},
{0x070b,0x04},
{0x070c,0x07},
{0x070d,0x0c},
{0x070e,0x08},
{0x070f,0x05},
{0x0710,0x04},
{0x0711,0x04},
{0x0712,0x06},
{0x0713,0x09},
{0x0714,0x0c},
{0x0715,0x15},
{0x0716,0x11},
{0x0717,0x0e},
{0x0718,0x0d},
{0x0719,0x0d},
{0x071a,0x0e},
{0x071b,0x12},
{0x071c,0x15},
{0x071d,0x3f},
{0x071e,0x2c},
{0x071f,0x22},
{0x0720,0x1f},
{0x0721,0x1f},
{0x0722,0x22},
{0x0723,0x2e},
{0x0724,0x3f},
{0x0725,0x1d},
{0x0726,0x1d},
{0x0727,0x1b},
{0x0728,0x1b},
{0x0729,0x1b},
{0x072a,0x1b},
{0x072b,0x1a},
{0x072c,0x1d},
{0x072d,0x1e},
{0x072e,0x1d},
{0x072f,0x1c},
{0x0730,0x1b},
{0x0731,0x1b},
{0x0732,0x1a},
{0x0733,0x1b},
{0x0734,0x18},
{0x0735,0x1d},
{0x0736,0x1e},
{0x0737,0x1e},
{0x0738,0x1e},
{0x0739,0x1e},
{0x073a,0x1c},
{0x073b,0x1b},
{0x073c,0x18},
{0x073d,0x1f},
{0x073e,0x20},
{0x073f,0x21},
{0x0740,0x21},
{0x0741,0x20},
{0x0742,0x1f},
{0x0743,0x1d},
{0x0744,0x19},
{0x0745,0x1e},
{0x0746,0x20},
{0x0747,0x20},
{0x0748,0x20},
{0x0749,0x20},
{0x074a,0x1e},
{0x074b,0x1c},
{0x074c,0x19},
{0x074d,0x1d},
{0x074e,0x1d},
{0x074f,0x1d},
{0x0750,0x1d},
{0x0751,0x1d},
{0x0752,0x1b},
{0x0753,0x1a},
{0x0754,0x18},
{0x0755,0x1c},
{0x0756,0x1c},
{0x0757,0x1b},
{0x0758,0x1a},
{0x0759,0x1a},
{0x075a,0x1a},
{0x075b,0x1a},
{0x075c,0x18},
{0x075d,0x1e},
{0x075e,0x1c},
{0x075f,0x1a},
{0x0760,0x1a},
{0x0761,0x1a},
{0x0762,0x1a},
{0x0763,0x1a},
{0x0764,0x1a},
{0x0765,0x21},
{0x0766,0x23},
{0x0767,0x23},
{0x0768,0x23},
{0x0769,0x23},
{0x076a,0x24},
{0x076b,0x24},
{0x076c,0x23},
{0x076d,0x22},
{0x076e,0x22},
{0x076f,0x22},
{0x0770,0x22},
{0x0771,0x23},
{0x0772,0x23},
{0x0773,0x23},
{0x0774,0x24},
{0x0775,0x20},
{0x0776,0x21},
{0x0777,0x21},
{0x0778,0x21},
{0x0779,0x21},
{0x077a,0x21},
{0x077b,0x22},
{0x077c,0x22},
{0x077d,0x20},
{0x077e,0x20},
{0x077f,0x20},
{0x0780,0x20},
{0x0781,0x20},
{0x0782,0x21},
{0x0783,0x21},
{0x0784,0x22},
{0x0785,0x1f},
{0x0786,0x1f},
{0x0787,0x1f},
{0x0788,0x20},
{0x0789,0x20},
{0x078a,0x20},
{0x078b,0x20},
{0x078c,0x21},
{0x078d,0x1f},
{0x078e,0x1f},
{0x078f,0x1f},
{0x0790,0x20},
{0x0791,0x20},
{0x0792,0x20},
{0x0793,0x21},
{0x0794,0x21},
{0x0795,0x1f},
{0x0796,0x20},
{0x0797,0x20},
{0x0798,0x20},
{0x0799,0x21},
{0x079a,0x21},
{0x079b,0x22},
{0x079c,0x22},
{0x079d,0x20},
{0x079e,0x20},
{0x079f,0x20},
{0x07a0,0x20},
{0x07a1,0x20},
{0x07a2,0x21},
{0x07a3,0x21},
{0x07a4,0x20},
{0x07a5,0x3b}, //C_light
{0x07a6,0x26},
{0x07a7,0x1e},
{0x07a8,0x1b},
{0x07a9,0x1c},
{0x07aa,0x1f},
{0x07ab,0x28},
{0x07ac,0x3e},
{0x07ad,0x14},
{0x07ae,0x0f},
{0x07af,0x0c},
{0x07b0,0x0b},
{0x07b1,0x0b},
{0x07b2,0x0d},
{0x07b3,0x10},
{0x07b4,0x15},
{0x07b5,0x0b},
{0x07b6,0x07},
{0x07b7,0x05},
{0x07b8,0x04},
{0x07b9,0x04},
{0x07ba,0x05},
{0x07bb,0x08},
{0x07bc,0x0c},
{0x07bd,0x07},
{0x07be,0x03},
{0x07bf,0x01},
{0x07c0,0x00},
{0x07c1,0x00},
{0x07c2,0x01},
{0x07c3,0x04},
{0x07c4,0x08},
{0x07c5,0x07},
{0x07c6,0x04},
{0x07c7,0x01},
{0x07c8,0x00},
{0x07c9,0x00},
{0x07ca,0x02},
{0x07cb,0x04},
{0x07cc,0x08},
{0x07cd,0x0c},
{0x07ce,0x08},
{0x07cf,0x05},
{0x07d0,0x04},
{0x07d1,0x04},
{0x07d2,0x06},
{0x07d3,0x08},
{0x07d4,0x0d},
{0x07d5,0x15},
{0x07d6,0x10},
{0x07d7,0x0d},
{0x07d8,0x0c},
{0x07d9,0x0c},
{0x07da,0x0e},
{0x07db,0x11},
{0x07dc,0x16},
{0x07dd,0x3f},
{0x07de,0x2a},
{0x07df,0x21},
{0x07e0,0x1e},
{0x07e1,0x1e},
{0x07e2,0x22},
{0x07e3,0x2c},
{0x07e4,0x3f},
{0x07e5,0x1c},
{0x07e6,0x1c},
{0x07e7,0x1a},
{0x07e8,0x1b},
{0x07e9,0x1a},
{0x07ea,0x1b},
{0x07eb,0x19},
{0x07ec,0x1a},
{0x07ed,0x1c},
{0x07ee,0x1c},
{0x07ef,0x1b},
{0x07f0,0x1b},
{0x07f1,0x1a},
{0x07f2,0x1a},
{0x07f3,0x1a},
{0x07f4,0x19},
{0x07f5,0x1d},
{0x07f6,0x1d},
{0x07f7,0x1e},
{0x07f8,0x1e},
{0x07f9,0x1d},
{0x07fa,0x1c},
{0x07fb,0x1a},
{0x07fc,0x18},
{0x07fd,0x1e},
{0x07fe,0x20},
{0x07ff,0x21},
{0x0800,0x21},
{0x0801,0x20},
{0x0802,0x1f},
{0x0803,0x1c},
{0x0804,0x19},
{0x0805,0x1d},
{0x0806,0x1f},
{0x0807,0x20},
{0x0808,0x20},
{0x0809,0x20},
{0x080a,0x1e},
{0x080b,0x1c},
{0x080c,0x19},
{0x080d,0x1c},
{0x080e,0x1c},
{0x080f,0x1d},
{0x0810,0x1d},
{0x0811,0x1c},
{0x0812,0x1b},
{0x0813,0x1a},
{0x0814,0x18},
{0x0815,0x1b},
{0x0816,0x1b},
{0x0817,0x1a},
{0x0818,0x1a},
{0x0819,0x1a},
{0x081a,0x19},
{0x081b,0x19},
{0x081c,0x18},
{0x081d,0x1c},
{0x081e,0x1b},
{0x081f,0x1a},
{0x0820,0x19},
{0x0821,0x19},
{0x0822,0x19},
{0x0823,0x19},
{0x0824,0x19},
{0x0825,0x1e},
{0x0826,0x1e},
{0x0827,0x1e},
{0x0828,0x1e},
{0x0829,0x1d},
{0x082a,0x20},
{0x082b,0x1f},
{0x082c,0x20},
{0x082d,0x1d},
{0x082e,0x1d},
{0x082f,0x1d},
{0x0830,0x1d},
{0x0831,0x1e},
{0x0832,0x1d},
{0x0833,0x1e},
{0x0834,0x1e},
{0x0835,0x1b},
{0x0836,0x1d},
{0x0837,0x1f},
{0x0838,0x1f},
{0x0839,0x1f},
{0x083a,0x1e},
{0x083b,0x1d},
{0x083c,0x1c},
{0x083d,0x1c},
{0x083e,0x1f},
{0x083f,0x20},
{0x0840,0x21},
{0x0841,0x21},
{0x0842,0x20},
{0x0843,0x1e},
{0x0844,0x1c},
{0x0845,0x1b},
{0x0846,0x1e},
{0x0847,0x1f},
{0x0848,0x20},
{0x0849,0x20},
{0x084a,0x1f},
{0x084b,0x1e},
{0x084c,0x1b},
{0x084d,0x1a},
{0x084e,0x1b},
{0x084f,0x1c},
{0x0850,0x1d},
{0x0851,0x1d},
{0x0852,0x1c},
{0x0853,0x1b},
{0x0854,0x1b},
{0x0855,0x1a},
{0x0856,0x1b},
{0x0857,0x1a},
{0x0858,0x1a},
{0x0859,0x1a},
{0x085a,0x1b},
{0x085b,0x1b},
{0x085c,0x1b},
{0x085d,0x1a},
{0x085e,0x1b},
{0x085f,0x1a},
{0x0860,0x1a},
{0x0861,0x1a},
{0x0862,0x1a},
{0x0863,0x1b},
{0x0864,0x1b},
{0x0865,0x3c}, //D_light
{0x0866,0x27},
{0x0867,0x1f},
{0x0868,0x1c},
{0x0869,0x1c},
{0x086a,0x1f},
{0x086b,0x28},
{0x086c,0x3f},
{0x086d,0x14},
{0x086e,0x0f},
{0x086f,0x0d},
{0x0870,0x0b},
{0x0871,0x0b},
{0x0872,0x0d},
{0x0873,0x10},
{0x0874,0x15},
{0x0875,0x0b},
{0x0876,0x07},
{0x0877,0x05},
{0x0878,0x04},
{0x0879,0x04},
{0x087a,0x05},
{0x087b,0x08},
{0x087c,0x0c},
{0x087d,0x07},
{0x087e,0x03},
{0x087f,0x01},
{0x0880,0x00},
{0x0881,0x00},
{0x0882,0x01},
{0x0883,0x04},
{0x0884,0x08},
{0x0885,0x07},
{0x0886,0x04},
{0x0887,0x01},
{0x0888,0x00},
{0x0889,0x00},
{0x088a,0x02},
{0x088b,0x04},
{0x088c,0x08},
{0x088d,0x0c},
{0x088e,0x08},
{0x088f,0x05},
{0x0890,0x04},
{0x0891,0x04},
{0x0892,0x06},
{0x0893,0x08},
{0x0894,0x0d},
{0x0895,0x15},
{0x0896,0x10},
{0x0897,0x0d},
{0x0898,0x0c},
{0x0899,0x0c},
{0x089a,0x0e},
{0x089b,0x11},
{0x089c,0x16},
{0x089d,0x3f},
{0x089e,0x2a},
{0x089f,0x21},
{0x08a0,0x1e},
{0x08a1,0x1e},
{0x08a2,0x22},
{0x08a3,0x2c},
{0x08a4,0x3f},
{0x08a5,0x1b},
{0x08a6,0x1b},
{0x08a7,0x1b},
{0x08a8,0x1b},
{0x08a9,0x1a},
{0x08aa,0x1b},
{0x08ab,0x1a},
{0x08ac,0x1a},
{0x08ad,0x1e},
{0x08ae,0x1d},
{0x08af,0x1d},
{0x08b0,0x1c},
{0x08b1,0x1c},
{0x08b2,0x1b},
{0x08b3,0x1b},
{0x08b4,0x1b},
{0x08b5,0x1e},
{0x08b6,0x1e},
{0x08b7,0x1e},
{0x08b8,0x1e},
{0x08b9,0x1e},
{0x08ba,0x1d},
{0x08bb,0x1c},
{0x08bc,0x1a},
{0x08bd,0x1e},
{0x08be,0x20},
{0x08bf,0x20},
{0x08c0,0x20},
{0x08c1,0x20},
{0x08c2,0x1f},
{0x08c3,0x1d},
{0x08c4,0x1b},
{0x08c5,0x1f},
{0x08c6,0x1f},
{0x08c7,0x20},
{0x08c8,0x20},
{0x08c9,0x20},
{0x08ca,0x1f},
{0x08cb,0x1d},
{0x08cc,0x1b},
{0x08cd,0x1d},
{0x08ce,0x1d},
{0x08cf,0x1e},
{0x08d0,0x1e},
{0x08d1,0x1e},
{0x08d2,0x1d},
{0x08d3,0x1c},
{0x08d4,0x1a},
{0x08d5,0x1d},
{0x08d6,0x1c},
{0x08d7,0x1c},
{0x08d8,0x1c},
{0x08d9,0x1b},
{0x08da,0x1b},
{0x08db,0x1b},
{0x08dc,0x1a},
{0x08dd,0x1e},
{0x08de,0x1b},
{0x08df,0x1b},
{0x08e0,0x1a},
{0x08e1,0x1b},
{0x08e2,0x1a},
{0x08e3,0x1a},
{0x08e4,0x19},
{0x08e5,0x1f},
{0x08e6,0x1f},
{0x08e7,0x1f},
{0x08e8,0x1f},
{0x08e9,0x1f},
{0x08ea,0x21},
{0x08eb,0x20},
{0x08ec,0x20},
{0x08ed,0x1e},
{0x08ee,0x1e},
{0x08ef,0x1e},
{0x08f0,0x1e},
{0x08f1,0x1e},
{0x08f2,0x1e},
{0x08f3,0x1f},
{0x08f4,0x1f},
{0x08f5,0x1c},
{0x08f6,0x1e},
{0x08f7,0x1f},
{0x08f8,0x1f},
{0x08f9,0x1f},
{0x08fa,0x1f},
{0x08fb,0x1e},
{0x08fc,0x1c},
{0x08fd,0x1c},
{0x08fe,0x1f},
{0x08ff,0x20},
{0x0900,0x20},
{0x0901,0x20},
{0x0902,0x20},
{0x0903,0x1f},
{0x0904,0x1d},
{0x0905,0x1c},
{0x0906,0x1e},
{0x0907,0x1f},
{0x0908,0x20},
{0x0909,0x20},
{0x090a,0x1f},
{0x090b,0x1e},
{0x090c,0x1c},
{0x090d,0x1b},
{0x090e,0x1c},
{0x090f,0x1d},
{0x0910,0x1d},
{0x0911,0x1d},
{0x0912,0x1d},
{0x0913,0x1c},
{0x0914,0x1b},
{0x0915,0x1b},
{0x0916,0x1c},
{0x0917,0x1b},
{0x0918,0x1b},
{0x0919,0x1b},
{0x091a,0x1c},
{0x091b,0x1c},
{0x091c,0x1c},
{0x091d,0x1b},
{0x091e,0x1c},
{0x091f,0x1c},
{0x0920,0x1b},
{0x0921,0x1b},
{0x0922,0x1b},
{0x0923,0x1d},
{0x0924,0x1c},
{0xfffe,0x30},
{0x03c2,0x18}, //min_q
{0x03c3,0x40}, //max_q
{0x03c4,0x07}, //lenc_ctrl
{0x03c6,0x00},
{0x03c7,0x80}, //autoG_max_gain
{0x03c8,0x00},
{0x03c9,0x40}, //autoG_min_gain
//BLC
{0xfffe,0x30},
{0x0013,0x0d},
{0x0014,0x00},
{0x071b,0x44},
//AWB
{0xfffe,0x14},
{0x0248,0x01}, //AWB_mode
{0x0249,0x01}, //AWB_fleximap_en
{0x027a,0x00},
{0x027b,0x40}, //min_num
{0x027c,0x0f},
{0x027d,0xff}, //max_awb_gain
{0x027e,0x04}, //awb_step
{0x027f,0x80}, //max_step_value
{0x02b6,0x06},
{0x02b7,0x00}, //B_temp
{0x02ba,0x04},
{0x02bb,0x00}, //G_temp
{0x02be,0x04},
{0x02bf,0x00}, //R_temp
{0x024a,0x00}, //awb_move_en
{0x024e,0x01},
{0x024f,0x00}, //D65:B_offset
{0x0252,0x01},
{0x0253,0x00}, //D65:R_offset
{0x0256,0x01},
{0x0257,0x00}, //CWF:B_offset
{0x025a,0x01},
{0x025b,0x00}, //CWF:R_offset
{0x025e,0x01},
{0x025f,0x00}, //A:B_offset
{0x0262,0x01},
{0x0263,0x00}, //A:R_offset
{0x0264,0x00},
{0x0265,0x38}, //awb_color0
{0x0266,0x00},
{0x0267,0x61}, //awb_color1
{0x0268,0x00},
{0x0269,0xa7}, //awb_color2
{0x026a,0x80}, //awb_shift_R
{0x026b,0x80}, //awb_shift_B
{0xfffe,0x30},
{0x0708,0x02},
{0x0709,0xa0}, //pixel_max_value
{0x070a,0x00},
{0x070b,0x10}, //pixel_min_value
{0xfffe,0x30},
{0x0730,0x4b},
{0x0731,0x6d},
{0x0732,0x47},
{0x0733,0x68},
{0x0734,0x60},
{0x0735,0x80},
{0x0736,0x46},
{0x0737,0x67},
{0x0738,0x69},
{0x0739,0x86},
{0x073a,0x2d},
{0x073b,0x50},
{0x073c,0x55},
{0x073d,0x77},
{0x073e,0x5a},
{0x073f,0x77},
{0x0740,0x70},
{0x0741,0x90},
{0x0742,0x50},
{0x0743,0x70},
{0x0744,0x7d},
{0x0745,0x9b},
{0x0746,0x2d},
{0x0747,0x4b},
{0x0748,0x30},
{0x0749,0x60},
{0x074a,0x80},
{0x074b,0x90},
{0x074c,0x20},
{0x074d,0x50},
{0x074e,0x90},
{0x074f,0xa0},
{0x0750,0x00},
{0x0751,0x00},
{0x0752,0x00},
{0x0753,0x00},
{0x0754,0x00},
{0x0755,0x00},
{0x0756,0x00},
{0x0757,0x00},
{0x0758,0x00},
{0x0759,0x00},
{0x075a,0x00},
{0x075b,0x00},
{0x075c,0x00},
{0x075d,0x00},
{0x075e,0x00},
{0x075f,0x00},
{0x0760,0x00},
{0x0761,0x00},
{0x0762,0x00},
{0x0763,0x00},
{0x0764,0x00},
{0x0765,0x00},
{0x0766,0x00},
{0x0767,0x00},
{0x0768,0x00},
{0x0769,0x00},
{0x076a,0x00},
{0x076b,0x00},
{0x076c,0x00},
{0x076d,0x00},
{0x076e,0x00},
{0x076f,0x00},
{0x0770,0x11},
{0x0771,0x11},
{0x0772,0x11},
{0x0773,0x00},
{0x0774,0x00},
{0x0775,0x00},
{0x0776,0x00},
{0x0777,0x00},
//RAW Gamma
{0xfffe,0x30},
{0x0901,0x05},
{0x0902,0x0c},
{0x0903,0x17},
{0x0904,0x2d},
{0x0905,0x39},
{0x0906,0x44},
{0x0907,0x4f},
{0x0908,0x59},
{0x0909,0x62},
{0x090a,0x6b},
{0x090b,0x7b},
{0x090c,0x89},
{0x090d,0xa3},
{0x090e,0xbd},
{0x090f,0xd7},
{0x0910,0xff},
//RGB Gamma
{0xfffe,0x30},
{0x1400,0x00},
{0x1401,0x03},
{0x1402,0x06},
{0x1403,0x09},
{0x1404,0x0c},
{0x1405,0x0f},
{0x1406,0x12},
{0x1407,0x16},
{0x1408,0x19},
{0x1409,0x1c},
{0x140a,0x1f},
{0x140b,0x22},
{0x140c,0x25},
{0x140d,0x28},
{0x140e,0x2b},
{0x140f,0x2e},
{0x1410,0x31},
{0x1411,0x34},
{0x1412,0x37},
{0x1413,0x3a},
{0x1414,0x3d},
{0x1415,0x3f},
{0x1416,0x42},
{0x1417,0x45},
{0x1418,0x48},
{0x1419,0x4a},
{0x141a,0x4d},
{0x141b,0x50},
{0x141c,0x52},
{0x141d,0x55},
{0x141e,0x57},
{0x141f,0x5a},
{0x1420,0x5c},
{0x1421,0x61},
{0x1422,0x66},
{0x1423,0x6b},
{0x1424,0x6f},
{0x1425,0x73},
{0x1426,0x78},
{0x1427,0x7c},
{0x1428,0x80},
{0x1429,0x83},
{0x142a,0x87},
{0x142b,0x8b},
{0x142c,0x8e},
{0x142d,0x92},
{0x142e,0x95},
{0x142f,0x98},
{0x1430,0x9c},
{0x1431,0xa2},
{0x1432,0xa8},
{0x1433,0xaf},
{0x1434,0xb5},
{0x1435,0xbb},
{0x1436,0xc2},
{0x1437,0xc8},
{0x1438,0xce},
{0x1439,0xd4},
{0x143a,0xda},
{0x143b,0xe1},
{0x143c,0xe7},
{0x143d,0xed},
{0x143e,0xf3},
{0x143f,0xf9},
{0x1440,0xff},
{0x1450,0x90},
{0x1451,0x03},
{0x1452,0x90},
{0x1453,0x90},
//CMX
{0xfffe,0x30},
{0x1200,0x02},
{0x1201,0x71},
{0x1202,0x01},
{0x1203,0x10},
{0x1204,0x02},
{0x1205,0x16},
{0x1206,0x01},
{0x1207,0x89},
{0x1208,0x00},
{0x1209,0xc9},
{0x120a,0x00},
{0x120b,0xbf},
{0x120c,0x03},
{0x120d,0x53},
{0x120e,0x01},
{0x120f,0x00},
{0x1210,0x02},
{0x1211,0x24},
{0x1212,0x02},
{0x1213,0x47},
{0x1214,0x00},
{0x1215,0x46},
{0x1216,0x04},
{0x1217,0x0e},
{0x1218,0x04},
{0x1219,0x37},
{0x121a,0x02},
{0x121b,0xa3},
{0x121c,0x01},
{0x121d,0x7f},
{0x121e,0x05},
{0x121f,0x84},
{0x1220,0x04},
{0x1221,0x19},
{0x1222,0x04},
{0x1223,0x05},
{0x122e,0x00},
{0x122f,0x00},
{0x1230,0x00},
{0x1228,0x00},
{0x1229,0x84},
{0x122a,0x00},
{0x122b,0xeb},
{0x122c,0x01},
{0x122d,0x28},
{0x1231,0x03}, //cmx_ctrl
{0x1232,0x60},
{0x1233,0x23},
{0x1234,0x0a},
{0x1235,0x0f},
//advance_raw_dns
{0xfffe,0x30},
{0x2000,0x07}, //s0_sigma_0
{0x2001,0x08},
{0x2002,0x0f},
{0x2003,0x18},
{0x2004,0x24},
{0x2005,0x30},
{0x2006,0x0a}, //s0_Gsl_0
{0x2007,0x0a},
{0x2008,0x0a},
{0x2009,0x0a},
{0x200a,0x0a},
{0x200b,0x0a},
{0x200c,0x0a}, //s0_RBsl_0
{0x200d,0x0a},
{0x200e,0x0a},
{0x200f,0x0a},
{0x2010,0x0a},
{0x2011,0x0a},
{0x2012,0x30}, //s0_ps00
{0x2013,0x30},
{0x2014,0x30},
{0x2015,0x30},
{0x2016,0x30},
{0x2017,0x30},
{0x2018,0x30}, //s0_ps10
{0x2019,0x30},
{0x201a,0x30},
{0x201b,0x30},
{0x201c,0x30},
{0x201d,0x30},
{0x201e,0x40}, //s0_ps20
{0x201f,0x40},
{0x2020,0x40},
{0x2021,0x40},
{0x2022,0x40},
{0x2023,0x40},
{0x2024,0x50}, //s0_ps30
{0x2025,0x50},
{0x2026,0x50},
{0x2027,0x50},
{0x2028,0x50},
{0x2029,0x50},
{0x202a,0x08}, //s0_pl00
{0x202b,0x08},
{0x202c,0x08},
{0x202d,0x08},
{0x202e,0x08},
{0x202f,0x08},
{0x2030,0x08}, //s0_pl10
{0x2031,0x08},
{0x2032,0x08},
{0x2033,0x08},
{0x2034,0x08},
{0x2035,0x08},
{0x2036,0x08}, //s0_pl20
{0x2037,0x08},
{0x2038,0x08},
{0x2039,0x08},
{0x203a,0x08},
{0x203b,0x08},
{0x203c,0x04}, //s0_pl30
{0x203d,0x04},
{0x203e,0x04},
{0x203f,0x04},
{0x2040,0x04},
{0x2041,0x04},
{0x2044,0x10}, //thre_y
//UV_dns
{0xfffe,0x30},
{0x2100,0x0a}, //l_noise_list0
{0x2101,0x0c},
{0x2102,0x13},
{0x2103,0x1f},
{0x2104,0x24},
{0x2105,0x28},
{0x2106,0x5f}, //uv_dns_ctrl
{0x2107,0x08}, //noise_man_value
//CIP
{0xfffe,0x30},
{0x0f00,0x2a}, //bit[7:4] noise_y_slp bit[3:0] Lsharp
{0x0f02,0x00}, //noise_list0
{0x0f03,0x00},
{0x0f04,0x00},
{0x0f05,0x00},
{0x0f06,0x00},
{0x0f07,0x00},
{0x0f08,0x00},
{0x0f09,0x00},
{0x0f0a,0x18}, //min_shp
{0x0f0b,0x1a}, //max_shp
{0x0f0c,0x03}, //min_detail
{0x0f0d,0x0a}, //max_detail
{0x0f0e,0x05}, //min_shp_gain
{0x0f0f,0x20}, //max_shp_gain
{0x0f10,0x60},
//WDR
{0xfffe,0x30},
{0x2b04,0x07}, //sat_factor
{0x2b16,0x04}, //wdr_ctrl
{0xfffe,0x14},
{0x09ab,0x02}, //Gmax
{0x09ac,0x0c},
{0x09ad,0xe0}, //map_rang
{0x09ae,0x41}, //PDF64_num_thd
{0x09af,0xff}, //gray_high
{0x09b2,0x0f},
{0x09b3,0x48}, //gain_thd
{0x09b4,0x10}, //ext_ratio
{0x09b5,0x14}, //ext_ratio_max
{0x09b6,0x00}, //weak_adj_on
{0xfffe,0x30},
{0x2b9a,0x00},
{0x2b9b,0x00}, //gain_list0
{0x2b9c,0x10},
{0x2b9d,0x00},
{0x2b9e,0x20},
{0x2b9f,0x00},
{0x2ba0,0x40},
{0x2ba1,0x00},
{0x2ba2,0x70},
{0x2ba3,0x00},
{0x2ba4,0xa0},
{0x2ba5,0x00},
{0x2ba6,0xd0},
{0x2ba7,0x00},
{0x2ba8,0x01},
{0x2ba9,0x00},
{0x2bac,0x0b}, //thd0
{0x2bad,0x0b},
{0x2bae,0x0b},
{0x2baf,0x0b},
{0x2bb0,0x0b},
{0x2bb1,0x0b},
{0x2bb2,0x0b},
{0x2bb3,0x0b},
{0x2bb4,0x20}, //thd0_max
{0x2bb5,0x20},
{0x2bb6,0x20},
{0x2bb7,0x20},
{0x2bb8,0x20},
{0x2bb9,0x20},
{0x2bba,0x20},
{0x2bbb,0x20},
{0x2bbc,0x10}, //enhance_ratio0
{0x2bbd,0x10},
{0x2bbe,0x0b},
{0x2bbf,0x08},
{0x2bc0,0x04},
{0x2bc1,0x04},
{0x2bc2,0x04},
{0x2bc3,0x04},
{REG_NULL, REG_DL},
//Auto_Sat
{0xfffe,0x14},
{0x026c,0x01}, //auto_sat_enable
{0x026d,0x20},
{0x026e,0x40}, //sat_U0
{0x026f,0x38},
{0x0270,0x30},
{0x0271,0x20},
{0x0272,0x20},
{0x0273,0x20},
{0x0274,0x40}, //sat_V0
{0x0275,0x38},
{0x0276,0x30},
{0x0277,0x20},
{0x0278,0x20},
{0x0279,0x20},
{REG_NULL, REG_DL},
//TOP
{0xfffe,0x14},
{0x002b,0x01}, //AE_enable
{0x002c,0x01}, //awb_enable
{0x002f,0x01}, //wdr_enable
{0x0030,0x01}, //lenc_enable
{0x0620,0x01},
{0x0621,0x01},
{0xfffe,0x30},
{0x0000,0xe7},
{0x0001,0x9b},
{0x0002,0x96},
{0x0003,0x31},
{0x0004,0x10},
{0x2300,0xfc},
{0x0019,0x8b},
{0x071c,0x0a},
{0x1700,0x09},
{0x1701,0x40},
{0x1702,0x40},
{0x1704,0x22}, //contrast_ygain
{0x1707,0x00}, //ybright
{REG_NULL, 0x00},
};
static const struct regval sensor_xc7160_1080p_30fps_2022617_regs[] = {
{0x0103,0x01},
{0x0100,0x00},
{0x36e9,0x80},
{0x36f9,0x80},
{0x3018,0x32},
{0x3019,0x0c},
{0x301f,0x33},
{0x3031,0x0a},
{0x3037,0x20},
{0x3038,0x44},
{0x303f,0x01},
{0x3200,0x00},
{0x3201,0x10},
{0x3202,0x00},
{0x3203,0x0c},
{0x3204,0x0f},
{0x3205,0x1f},
{0x3206,0x08},
{0x3207,0x83},
{0x3208,0x07},
{0x3209,0x80},
{0x320a,0x04},
{0x320b,0x38},
{0x320c,0x08},
{0x320d,0x98},
{0x320e,0x04},
{0x320f,0x65},
{0x3210,0x00},
{0x3211,0x04},
{0x3212,0x00},
{0x3213,0x02},
{0x3215,0x31},
{0x3220,0x14},
{0x3241,0x00},
{0x3243,0x03},
{0x3248,0x04},
{0x3271,0x1c},
{0x3273,0x1f},
{0x3301,0x30},
{0x3306,0xa8},
{0x3309,0x40},
{0x330b,0x68},
{0x330e,0x60},
{0x3314,0x94},
{0x331f,0x31},
{0x334c,0x10},
{0x335d,0x60},
{0x3366,0x92},
{0x3367,0x08},
{0x3368,0x07},
{0x3369,0x00},
{0x336a,0x00},
{0x336b,0x00},
{0x336c,0xc2},
{0x337f,0x33},
{0x33af,0x24},
{0x33e0,0xa0},
{0x33e1,0x08},
{0x33e2,0x18},
{0x33e3,0x10},
{0x33e4,0x0c},
{0x33e5,0x10},
{0x33e6,0x06},
{0x33e7,0x02},
{0x33e8,0x18},
{0x33e9,0x10},
{0x33ea,0x0c},
{0x33eb,0x10},
{0x33ec,0x04},
{0x33ed,0x02},
{0x33ee,0xa0},
{0x33ef,0x08},
{0x33f4,0x18},
{0x33f5,0x10},
{0x33f6,0x0c},
{0x33f7,0x10},
{0x33f8,0x06},
{0x33f9,0x02},
{0x33fa,0x18},
{0x33fb,0x10},
{0x33fc,0x0c},
{0x33fd,0x10},
{0x33fe,0x04},
{0x33ff,0x02},
{0x360f,0x01},
{0x3622,0xf7},
{0x3624,0x45},
{0x3628,0x83},
{0x3630,0x80},
{0x3631,0x80},
{0x3632,0xa8},
{0x3633,0x22},
{0x3635,0x02},
{0x3637,0x52},
{0x3638,0x08},
{0x363a,0x88},
{0x363b,0x06},
{0x363d,0x01},
{0x363e,0x00},
{0x3641,0x00},
{0x3670,0x4a},
{0x3671,0xf7},
{0x3672,0x17},
{0x3673,0x17},
{0x3674,0x80},
{0x3675,0x85},
{0x3676,0xa5},
{0x367a,0x48},
{0x367b,0x78},
{0x367c,0x48},
{0x367d,0x78},
{0x3690,0x42},
{0x3691,0x33},
{0x3692,0x44},
{0x3699,0x88},
{0x369a,0x9f},
{0x369b,0x9f},
{0x369c,0x48},
{0x369d,0x78},
{0x36a2,0x48},
{0x36a3,0x78},
{0x36bb,0x48},
{0x36bc,0x78},
{0x36c9,0x05},
{0x36ca,0x05},
{0x36cb,0x05},
{0x36cc,0x00},
{0x36cd,0x10},
{0x36ce,0x1a},
{0x36d0,0x30},
{0x36d1,0x48},
{0x36d2,0x78},
{0x36ea,0x5f},
{0x36eb,0x0a},
{0x36ec,0x15},
{0x36ed,0x04},
{0x36fa,0x5f},
{0x36fb,0x15},
{0x36fc,0x10},
{0x36fd,0x04},
{0x3901,0x00},
{0x3902,0xc5},
{0x3904,0x18},
{0x3907,0x00},
{0x3908,0x11},
{0x394c,0x0f},
{0x394d,0x20},
{0x394e,0x08},
{0x394f,0x90},
{0x3980,0x71},
{0x3981,0x70},
{0x3982,0x00},
{0x3983,0x00},
{0x3984,0x20},
{0x3987,0x0b},
{0x3990,0x03},
{0x3991,0xfd},
{0x3992,0x03},
{0x3993,0xf8},
{0x3994,0x03},
{0x3995,0xfd},
{0x3996,0x03},
{0x3997,0xff},
{0x3998,0x00},
{0x3999,0x02},
{0x399a,0x00},
{0x399b,0x09},
{0x399c,0x00},
{0x399d,0x0c},
{0x399e,0x00},
{0x399f,0x0c},
{0x39a0,0x00},
{0x39a1,0x08},
{0x39a2,0x03},
{0x39a3,0xe3},
{0x39a4,0x03},
{0x39a5,0xee},
{0x39a6,0x03},
{0x39a7,0xf4},
{0x39a8,0x03},
{0x39a9,0xf8},
{0x39aa,0x03},
{0x39ab,0xfd},
{0x39ac,0x00},
{0x39ad,0x04},
{0x39ae,0x00},
{0x39af,0x09},
{0x39b0,0x00},
{0x39b1,0x0e},
{0x39b2,0x00},
{0x39b3,0x20},
{0x39b4,0x0c},
{0x39b5,0x1c},
{0x39b6,0x38},
{0x39b7,0x5b},
{0x39b8,0x50},
{0x39b9,0x38},
{0x39ba,0x20},
{0x39bb,0x10},
{0x39bc,0x0c},
{0x39bd,0x16},
{0x39be,0x21},
{0x39bf,0x36},
{0x39c0,0x3b},
{0x39c1,0x2a},
{0x39c2,0x16},
{0x39c3,0x0c},
{0x39c5,0x30},
{0x39c6,0x00},
{0x39c7,0x40},
{0x39c9,0x07},
{0x39ca,0xf8},
{0x39cc,0x07},
{0x39cd,0xd0},
{0x39ce,0x00},
{0x39cf,0x00},
{0x39d0,0x34},
{0x39d1,0x00},
{0x39e2,0x15},
{0x39e3,0x4d},
{0x39e4,0x15},
{0x39e5,0xbb},
{0x39e6,0x00},
{0x39e7,0x2f},
{0x39e8,0x00},
{0x39e9,0x1b},
{0x39ea,0x01},
{0x39eb,0x7a},
{0x39ec,0x08},
{0x39ed,0x00},
{0x3e00,0x00},
{0x3e01,0x8c},
{0x3e02,0x00},
{0x3e08,0x03},
{0x3e09,0x40},
{0x3e0e,0x09},
{0x3e14,0x31},
{0x3e16,0x00},
{0x3e17,0xac},
{0x3e18,0x00},
{0x3e19,0xac},
{0x3e1b,0x3a},
{0x3e1e,0x76},
{0x3e25,0x23},
{0x3e26,0x40},
{0x4501,0xa4},
{0x4509,0x10},
{0x450d,0x0a},
{0x4800,0x64},
{0x4837,0x35},
{0x5000,0x46},
{0x5799,0x06},
{0x57aa,0x2f},
{0x57ab,0xff},
{0x5900,0x01},
{0x5901,0x04},
{0x5988,0x86},
{0x598e,0x08},
{0x598f,0x68},
{0x36e9,0x2a},
{0x36f9,0x2b},
{0x0100,0x01},
{REG_NULL, 0x00},
};
/**************************************************************
4K 25FPS
***************************************************************/
static const struct regval isp_xc7160_4k_25fps_2022617_regs[] = {
{0xfffd,0x80},
{0xfffe,0x50},
{0x001c,0xff},
{0x001d,0xff},
{0x001e,0xff},
{0x001f,0xff}, //clk_en
{0x0018,0x00},
{0x0019,0x00},
{0x001a,0x00},
{0x001b,0x00}, //reset
{0x0030,0x44},
{0x0031,0x28},
{0x0032,0x34},
{0x0033,0x70},
{0x0020,0x02},
{0x0021,0x0d},
{0x0022,0x01},
{0x0023,0x85},
{0x0024,0x01},
{0x0025,0x04},
{0x0026,0x01},
{0x0027,0x06},
{0x0028,0x01},
{0x0029,0x00},
{0x002a,0x02},
{0x002b,0x05},
{0x002e,0x01}, //PLL
{0xfffe,0x50},
{0x0050,0x0f},
{0x0054,0x0f},
{0x0058,0x03}, //GPIO_Ctr
{0xfffe,0x50},
{0x00bc,0x19},
{0x0090,0x38},
{0x0200,0x0f}, //mipi_rx1_pad
{0x0201,0x00},
{0x0202,0x80},
{0x0203,0x00},
{0xfffe,0x26},
{0x8000,0x1d}, //colorbar
{0x8001,0x08},
{0x8002,0x0f},
{0x8003,0x78},
{0x8004,0x08},
{0x8005,0x03},
{0x8006,0x05},
{0x8007,0x99},
{0x8008,0x14},
{0x8009,0x04},
{0xfffe,0x26},
{0x8010,0x05}, //before_isp_crop
{0x8012,0x00},
{0x8013,0x0f},
{0x8014,0x70},
{0x8015,0x08},
{0x8016,0x04},
{0x8017,0x00},
{0x8018,0x04},
{0x8019,0x00},
{0xfffe,0x30},
{0x0000,0x01}, //isp0_set
{0x0001,0x00},
{0x0002,0x10},
{0x0003,0x20},
{0x0004,0x10},
{0x0019,0x09},
{0x0050,0x20}, //dummy_line
{0x005e,0xff},
{0x005f,0x0e},
{0x0060,0x6f},
{0x0061,0x08},
{0x0064,0x00},
{0x0065,0x0f},
{0x0066,0x70},
{0x0067,0x08},
{0x0006,0x0f},
{0x0007,0x00},
{0x0008,0x08},
{0x0009,0x70},
{0x000a,0x0f},
{0x000b,0x00},
{0x000c,0x08},
{0x000d,0x70},
{0x001e,0x0f}, //isp_scale
{0x001f,0x00},
{0x0020,0x08},
{0x0021,0x70},
{0x007e,0x0f},
{0x007f,0x00},
{0x0080,0x08},
{0x0081,0x70},
{0x0082,0x00},
{0x1a00,0x00}, //isp_crop
{0x1a01,0x00},
{0x1a02,0x00},
{0x1a03,0x00},
{0x1a04,0x0f},
{0x1a05,0x00},
{0x1a06,0x08},
{0x1a07,0x70},
{0x1a08,0x00},
{0xfffe,0x26},
{0x0000,0x60}, //mipi_rx_lane
{0x0009,0xc4}, //mipi_rx_set
{0xfffe,0x26},
{0x2019,0x0f}, //mipi_tx
{0x201a,0x00},
{0x201b,0x08},
{0x201c,0x70},
{0x201d,0x00},
{0x201e,0x00},
{0x201f,0x00},
{0x2020,0x00},
{0x2015,0x81},
{0x2017,0x1e},
{0x2018,0x00},
{0x2023,0x0f}, //mipi_tx_set
{0xfffe,0x2c},
{0x0000,0x00}, //stitch
{0x0008,0x10},
{0x0044,0x08}, //fifo
{0x0045,0x04},
{0x0048,0x1d},
{0x0049,0xf0},
{0xfffe,0x2e},
{0x0000,0x00}, //retiming
{0x0001,0xcc},
{0x0002,0x00},
{0x0003,0x00},
{0x0004,0x01},
{0xfffe,0x30},
{0x006c,0xa0}, //pixel_order
{0x1800,0x10},
{0xfffe,0x50},
{0x0226,0x02}, //rx2_off
{0xfffe,0x25},
{0x0002,0xf0}, //i2c_master_speed
{0xfffe,0x2d},
{0x0000,0x00}, //hispi_set
{0x0001,0x08},
{0x0002,0x0c},
{0x0003,0x38},
{0x0004,0x04},
{0x0005,0x80},
{0x0006,0x07},
{0x0007,0x00},
{0x0008,0x0f},
{0x0009,0x80},
{0x000a,0x07},
{0x0013,0xc0},
{0x0014,0x80},
{0x0015,0xe0},
{0x0016,0xa0},
{0x1000,0x00},
{0x1001,0x08},
{0x1002,0x0c},
{0x1003,0x38},
{0x1004,0x04},
{0x1005,0x80},
{0x1006,0x07},
{0x1007,0x00},
{0x1008,0x0f},
{0x1009,0x80},
{0x100a,0x07},
{0x1013,0xc0},
{0x1014,0x80},
{0x1015,0xe0},
{0x1016,0xa0},
{0x000b,0x80},
{0x100b,0x80},
{0x000b,0x00},
{0x100b,0x00},
{REG_NULL, REG_DL},
//Initial_end
//patch_start
//以下patch setting需根据实际需求或先前参数添加进来
{0xfffd, 0x80},
{0xfffe, 0x50},
{0x000e, 0x54},
{0xfffe, 0x14},
{0x0006, 0x9},
{0x0007, 0x44},
{0x0014, 0x00},
{0x0015, 0x14},
{0x0016, 0x22},
{0x0017, 0xd4},
{0x2114, 0x9c},
{0x2115, 0x21},
{0x2116, 0xff},
{0x2117, 0xec},
{0x2118, 0xd4},
{0x2119, 0x1},
{0x211a, 0x48},
{0x211b, 0x0},
{0x211c, 0xd4},
{0x211d, 0x1},
{0x211e, 0x50},
{0x211f, 0x4},
{0x2120, 0xd4},
{0x2121, 0x1},
{0x2122, 0x60},
{0x2123, 0x8},
{0x2124, 0xd4},
{0x2125, 0x1},
{0x2126, 0x70},
{0x2127, 0xc},
{0x2128, 0xd4},
{0x2129, 0x1},
{0x212a, 0x80},
{0x212b, 0x10},
{0x212c, 0x7},
{0x212d, 0xfb},
{0x212e, 0x7},
{0x212f, 0xa3},
{0x2130, 0x15},
{0x2131, 0x0},
{0x2132, 0x0},
{0x2133, 0x0},
{0x2134, 0x84},
{0x2135, 0x6b},
{0x2136, 0x0},
{0x2137, 0x8},
{0x2138, 0x84},
{0x2139, 0xa3},
{0x213a, 0x1},
{0x213b, 0xc},
{0x213c, 0xbc},
{0x213d, 0x45},
{0x213e, 0x0},
{0x213f, 0x3f},
{0x2140, 0x10},
{0x2141, 0x0},
{0x2142, 0x0},
{0x2143, 0xf},
{0x2144, 0xbc},
{0x2145, 0x45},
{0x2146, 0x0},
{0x2147, 0x7f},
{0x2148, 0x9c},
{0x2149, 0x60},
{0x214a, 0x27},
{0x214b, 0x10},
{0x214c, 0x9c},
{0x214d, 0x80},
{0x214e, 0x13},
{0x214f, 0x60},
{0x2150, 0xe0},
{0x2151, 0x65},
{0x2152, 0x1b},
{0x2153, 0x6},
{0x2154, 0x9d},
{0x2155, 0x80},
{0x2156, 0x0},
{0x2157, 0x3},
{0x2158, 0x9e},
{0x2159, 0x0},
{0x215a, 0x0},
{0x215b, 0x0},
{0x215c, 0x9d},
{0x215d, 0xc0},
{0x215e, 0x0},
{0x215f, 0x80},
{0x2160, 0x18},
{0x2161, 0xa0},
{0x2162, 0xff},
{0x2163, 0xfb},
{0x2164, 0xa8},
{0x2165, 0xa5},
{0x2166, 0x1e},
{0x2167, 0x0},
{0x2168, 0x7},
{0x2169, 0xfb},
{0x216a, 0x78},
{0x216b, 0x39},
{0x216c, 0xe0},
{0x216d, 0x63},
{0x216e, 0x28},
{0x216f, 0x0},
{0x2170, 0x9c},
{0x2171, 0x8b},
{0x2172, 0x0},
{0x2173, 0x40},
{0x2174, 0x0},
{0x2175, 0x0},
{0x2176, 0x0},
{0x2177, 0x37},
{0x2178, 0xa5},
{0x2179, 0x44},
{0x217a, 0xff},
{0x217b, 0xff},
{0x217c, 0x10},
{0x217d, 0x0},
{0x217e, 0x0},
{0x217f, 0xb},
{0x2180, 0xbc},
{0x2181, 0x45},
{0x2182, 0x0},
{0x2183, 0xff},
{0x2184, 0x9c},
{0x2185, 0x60},
{0x2186, 0x27},
{0x2187, 0x10},
{0x2188, 0x9c},
{0x2189, 0x80},
{0x218a, 0x27},
{0x218b, 0x60},
{0x218c, 0xe0},
{0x218d, 0x65},
{0x218e, 0x1b},
{0x218f, 0x6},
{0x2190, 0x9d},
{0x2191, 0x80},
{0x2192, 0x0},
{0x2193, 0x7},
{0x2194, 0x9e},
{0x2195, 0x0},
{0x2196, 0x0},
{0x2197, 0x0},
{0x2198, 0x9d},
{0x2199, 0xc0},
{0x219a, 0x0},
{0x219b, 0x80},
{0x219c, 0x18},
{0x219d, 0xa0},
{0x219e, 0xff},
{0x219f, 0xf6},
{0x21a0, 0x3},
{0x21a1, 0xff},
{0x21a2, 0xff},
{0x21a3, 0xf2},
{0x21a4, 0xa8},
{0x21a5, 0xa5},
{0x21a6, 0x3c},
{0x21a7, 0x0},
{0x21a8, 0xc},
{0x21a9, 0x0},
{0x21aa, 0x0},
{0x21ab, 0xe},
{0x21ac, 0x9c},
{0x21ad, 0x60},
{0x21ae, 0x3},
{0x21af, 0xe8},
{0x21b0, 0xbc},
{0x21b1, 0x45},
{0x21b2, 0x1},
{0x21b3, 0xfc},
{0x21b4, 0x10},
{0x21b5, 0x0},
{0x21b6, 0x0},
{0x21b7, 0x13},
{0x21b8, 0xbc},
{0x21b9, 0x45},
{0x21ba, 0x7},
{0x21bb, 0xef},
{0x21bc, 0x9c},
{0x21bd, 0x60},
{0x21be, 0x3},
{0x21bf, 0xe8},
{0x21c0, 0x9c},
{0x21c1, 0x80},
{0x21c2, 0xf},
{0x21c3, 0xa0},
{0x21c4, 0xe0},
{0x21c5, 0x65},
{0x21c6, 0x1b},
{0x21c7, 0x6},
{0x21c8, 0x9d},
{0x21c9, 0x80},
{0x21ca, 0x0},
{0x21cb, 0x1f},
{0x21cc, 0x9e},
{0x21cd, 0x0},
{0x21ce, 0x0},
{0x21cf, 0x0},
{0x21d0, 0x9d},
{0x21d1, 0xc0},
{0x21d2, 0x0},
{0x21d3, 0x80},
{0x21d4, 0x18},
{0x21d5, 0xa0},
{0x21d6, 0xff},
{0x21d7, 0xfc},
{0x21d8, 0x3},
{0x21d9, 0xff},
{0x21da, 0xff},
{0x21db, 0xe4},
{0x21dc, 0xa8},
{0x21dd, 0xa5},
{0x21de, 0x18},
{0x21df, 0x0},
{0x21e0, 0x9c},
{0x21e1, 0x80},
{0x21e2, 0x7},
{0x21e3, 0xe0},
{0x21e4, 0xe0},
{0x21e5, 0x65},
{0x21e6, 0x1b},
{0x21e7, 0x6},
{0x21e8, 0x9d},
{0x21e9, 0x80},
{0x21ea, 0x0},
{0x21eb, 0xf},
{0x21ec, 0x9e},
{0x21ed, 0x0},
{0x21ee, 0x0},
{0x21ef, 0x0},
{0x21f0, 0x9d},
{0x21f1, 0xc0},
{0x21f2, 0x0},
{0x21f3, 0x80},
{0x21f4, 0x18},
{0x21f5, 0xa0},
{0x21f6, 0xff},
{0x21f7, 0xfe},
{0x21f8, 0x3},
{0x21f9, 0xff},
{0x21fa, 0xff},
{0x21fb, 0xdc},
{0x21fc, 0xa8},
{0x21fd, 0xa5},
{0x21fe, 0xc},
{0x21ff, 0x0},
{0x2200, 0xc},
{0x2201, 0x0},
{0x2202, 0x0},
{0x2203, 0xf},
{0x2204, 0x9c},
{0x2205, 0x60},
{0x2206, 0x0},
{0x2207, 0x64},
{0x2208, 0xbc},
{0x2209, 0x45},
{0x220a, 0xf},
{0x220b, 0xdf},
{0x220c, 0x10},
{0x220d, 0x0},
{0x220e, 0x0},
{0x220f, 0x12},
{0x2210, 0xa8},
{0x2211, 0x8c},
{0x2212, 0x0},
{0x2213, 0x0},
{0x2214, 0x9c},
{0x2215, 0x60},
{0x2216, 0x0},
{0x2217, 0x32},
{0x2218, 0x9c},
{0x2219, 0x80},
{0x221a, 0x5},
{0x221b, 0xff},
{0x221c, 0xe0},
{0x221d, 0x65},
{0x221e, 0x1b},
{0x221f, 0x6},
{0x2220, 0x9e},
{0x2221, 0x0},
{0x2222, 0x0},
{0x2223, 0x1},
{0x2224, 0x9d},
{0x2225, 0x80},
{0x2226, 0x0},
{0x2227, 0x3f},
{0x2228, 0x7},
{0x2229, 0xfb},
{0x222a, 0x78},
{0x222b, 0x9},
{0x222c, 0x9d},
{0x222d, 0x40},
{0x222e, 0x0},
{0x222f, 0x7f},
{0x2230, 0xb8},
{0x2231, 0x8b},
{0x2232, 0x0},
{0x2233, 0x2},
{0x2234, 0x0},
{0x2235, 0x0},
{0x2236, 0x0},
{0x2237, 0x7},
{0x2238, 0xa5},
{0x2239, 0xc4},
{0x223a, 0xff},
{0x223b, 0xfc},
{0x223c, 0x9c},
{0x223d, 0x80},
{0x223e, 0x5},
{0x223f, 0xff},
{0x2240, 0xe0},
{0x2241, 0x65},
{0x2242, 0x1b},
{0x2243, 0x6},
{0x2244, 0x9e},
{0x2245, 0x0},
{0x2246, 0x0},
{0x2247, 0x0},
{0x2248, 0x3},
{0x2249, 0xff},
{0x224a, 0xff},
{0x224b, 0xf8},
{0x224c, 0x9d},
{0x224d, 0x80},
{0x224e, 0x0},
{0x224f, 0x1f},
{0x2250, 0xa8},
{0x2251, 0x8c},
{0x2252, 0x0},
{0x2253, 0x0},
{0x2254, 0x9c},
{0x2255, 0x60},
{0x2256, 0x3e},
{0x2257, 0x8},
{0x2258, 0x7},
{0x2259, 0xfb},
{0x225a, 0x17},
{0x225b, 0x2c},
{0x225c, 0x9c},
{0x225d, 0xa0},
{0x225e, 0x0},
{0x225f, 0x1},
{0x2260, 0xa8},
{0x2261, 0x8a},
{0x2262, 0x0},
{0x2263, 0x0},
{0x2264, 0x9c},
{0x2265, 0x60},
{0x2266, 0x3e},
{0x2267, 0x9},
{0x2268, 0x7},
{0x2269, 0xfb},
{0x226a, 0x17},
{0x226b, 0x28},
{0x226c, 0x9c},
{0x226d, 0xa0},
{0x226e, 0x0},
{0x226f, 0x1},
{0x2270, 0xa8},
{0x2271, 0x90},
{0x2272, 0x0},
{0x2273, 0x0},
{0x2274, 0x9c},
{0x2275, 0x60},
{0x2276, 0x3e},
{0x2277, 0x6},
{0x2278, 0x7},
{0x2279, 0xfb},
{0x227a, 0x17},
{0x227b, 0x24},
{0x227c, 0x9c},
{0x227d, 0xa0},
{0x227e, 0x0},
{0x227f, 0x1},
{0x2280, 0xa8},
{0x2281, 0x8e},
{0x2282, 0x0},
{0x2283, 0x0},
{0x2284, 0x9c},
{0x2285, 0x60},
{0x2286, 0x3e},
{0x2287, 0x7},
{0x2288, 0x7},
{0x2289, 0xfb},
{0x228a, 0x17},
{0x228b, 0x20},
{0x228c, 0x9c},
{0x228d, 0xa0},
{0x228e, 0x0},
{0x228f, 0x1},
{0x2290, 0x85},
{0x2291, 0x21},
{0x2292, 0x0},
{0x2293, 0x0},
{0x2294, 0x85},
{0x2295, 0x41},
{0x2296, 0x0},
{0x2297, 0x4},
{0x2298, 0x85},
{0x2299, 0x81},
{0x229a, 0x0},
{0x229b, 0x8},
{0x229c, 0x85},
{0x229d, 0xc1},
{0x229e, 0x0},
{0x229f, 0xc},
{0x22a0, 0x86},
{0x22a1, 0x1},
{0x22a2, 0x0},
{0x22a3, 0x10},
{0x22a4, 0x44},
{0x22a5, 0x0},
{0x22a6, 0x48},
{0x22a7, 0x0},
{0x22a8, 0x9c},
{0x22a9, 0x21},
{0x22aa, 0x0},
{0x22ab, 0x14},
{0x22ac, 0x9c},
{0x22ad, 0x21},
{0x22ae, 0xff},
{0x22af, 0xfc},
{0x22b0, 0xd4},
{0x22b1, 0x1},
{0x22b2, 0x48},
{0x22b3, 0x0},
{0x22b4, 0xbc},
{0x22b5, 0x23},
{0x22b6, 0x4},
{0x22b7, 0xc},
{0x22b8, 0x10},
{0x22b9, 0x0},
{0x22ba, 0x0},
{0x22bb, 0x4},
{0x22bc, 0x15},
{0x22bd, 0x0},
{0x22be, 0x0},
{0x22bf, 0x0},
{0x22c0, 0x7},
{0x22c1, 0xff},
{0x22c2, 0xff},
{0x22c3, 0x95},
{0x22c4, 0x15},
{0x22c5, 0x0},
{0x22c6, 0x0},
{0x22c7, 0x0},
{0x22c8, 0x85},
{0x22c9, 0x21},
{0x22ca, 0x0},
{0x22cb, 0x0},
{0x22cc, 0x44},
{0x22cd, 0x0},
{0x22ce, 0x48},
{0x22cf, 0x0},
{0x22d0, 0x9c},
{0x22d1, 0x21},
{0x22d2, 0x0},
{0x22d3, 0x4},
{0x22d4, 0x9c},
{0x22d5, 0x21},
{0x22d6, 0xff},
{0x22d7, 0xfc},
{0x22d8, 0xd4},
{0x22d9, 0x1},
{0x22da, 0x48},
{0x22db, 0x0},
{0x22dc, 0x7},
{0x22dd, 0xff},
{0x22de, 0xff},
{0x22df, 0xf4},
{0x22e0, 0x15},
{0x22e1, 0x0},
{0x22e2, 0x0},
{0x22e3, 0x0},
{0x22e4, 0x9d},
{0x22e5, 0x60},
{0x22e6, 0x0},
{0x22e7, 0x0},
{0x22e8, 0x85},
{0x22e9, 0x21},
{0x22ea, 0x0},
{0x22eb, 0x0},
{0x22ec, 0x44},
{0x22ed, 0x0},
{0x22ee, 0x48},
{0x22ef, 0x0},
{0x22f0, 0x9c},
{0x22f1, 0x21},
{0x22f2, 0x0},
{0x22f3, 0x4},
{0xfffe,0x50},
{0x0137,0x99},
{REG_NULL, REG_DL},
//patch_end
//IQ_start
//AE
{0xfffe,0x30},
{0x1f00,0x00},
{0x1f01,0x00}, //win_Xstart
{0x1f02,0x00},
{0x1f03,0x00}, //win_Ystart
{0x1f04,0x0f},
{0x1f05,0x00}, //win_width
{0x1f06,0x08},
{0x1f07,0x70}, //win_height
{0x1f08,0x03},
{0x0051,0x03},
{0xfffe,0x14},
{0x000e,0x00}, //isp0_used_i2c
{0x010e,0x60}, //sensor_i2c_id
{0x010f,0x01}, //sensor_i2c_bits
{0x0110,0x05}, //type_gain
{0x0111,0x00}, //type_exp
{0x0114,0x3e}, //exp_addr
{0x0115,0x00},
{0x0116,0x3e},
{0x0117,0x01},
{0x0118,0x3e},
{0x0119,0x02},
{0x011a,0x00},
{0x011b,0x00},
{0x011c,0x00}, //exp_mask
{0x011d,0xff},
{0x011e,0x00},
{0x011f,0xff},
{0x0120,0x00},
{0x0121,0xf0},
{0x0122,0x00},
{0x0123,0x00},
{0x0134,0x3e}, //gain_addr
{0x0135,0x08},
{0x0136,0x3e},
{0x0137,0x09},
{0x0138,0x3e},
{0x0139,0x06},
{0x013a,0x3e},
{0x013b,0x07},
{0x013c,0x00}, //gain_mask
{0x013d,0xff},
{0x013e,0x00},
{0x013f,0xff},
{0x0140,0x00},
{0x0141,0xff},
{0x0142,0x00},
{0x0143,0xff},
//Area Weight
{0xfffe,0x14},
{0x0055,0x02},
{0x0056,0x02},
{0x0057,0x02},
{0x0058,0x02},
{0x0059,0x02},
{0x005a,0x02},
{0x005b,0x02},
{0x005c,0x02},
{0x005d,0x02},
{0x005e,0x02},
{0x005f,0x02},
{0x0060,0x02},
{0x0061,0x02},
{0x0062,0x02},
{0x0063,0x02},
{0x0064,0x02},
{0x0065,0x02},
{0x0066,0x02},
{0x0067,0x02},
{0x0068,0x02},
{0x0069,0x02},
{0x006a,0x02},
{0x006b,0x02},
{0x006c,0x02},
{0x006d,0x02},
//Attention
{0x0088,0x00},
{0x0089,0x00},
{0x008a,0x00},
{0x008b,0x00},
{0x0050,0x01}, //refresh
//AE base
{0xfffe,0x14},
{0x004c,0x00}, //AEC_mode
{0x004d,0x01}, //AE_force_write
{0x00a0,0x01},
{0x00a1,0xc8}, //day_target
{0x00de,0x00},
{0x00df,0x20}, //min_exp
{0x00e0,0x00},
{0x00e1,0x01},
{0x00e2,0x2b},
{0x00e3,0x00}, //max_exp
{0x00fa,0x01},
{0x00fb,0x00}, //max_gain
{0x00fc,0x00},
{0x00fd,0x20}, //min_gain
{0x0104,0x00}, //flicker
{0x0105,0x01}, //min_flickerlines_en
{0x0106,0x11},
{0x0107,0x30}, //60Hz
{0x0108,0x14},
{0x0109,0xa0}, //50Hz
//AE speed
{0x00c6,0x02}, //delay_frame
{0x0144,0x01}, //exp_delay
{0x0145,0x01}, //gain_delay
{0x0031,0x01}, //exp_mode
{0x0032,0x01}, //gain_mode
{0x00c7,0x28}, //finally_thr
{0x00ca,0x00},
{0x00cb,0x40}, //thr_low
{0x00cc,0x00},
{0x00cd,0xa0}, //thr_high
{0x00ce,0x00},
{0x00cf,0x60}, //jump_thr
{0x00d4,0x00},
{0x00d5,0x80}, //jump_mutiple
{0x00d6,0x00},
{0x00d7,0x80}, //max_jump_ratio
{0x00d9,0x00}, //max_jump_cnt
{0x00da,0x00},
{0x00db,0x00}, //luma_diff_thr_low
{0x00dc,0x03},
{0x00dd,0x00}, //luma_diff_thr_high
{0x01bc,0x00},
{0x01bd,0x70}, //thr_l_all
{0x01be,0x00},
{0x01bf,0x60}, //thr_l_avg
{0x00c8,0x01}, //total_speed
{0x0208,0x01}, //limit_speed
//AE smart
{0x0092,0x00}, //smart_mode
{0x0093,0x00}, //analysis_mode
{0x0094,0x00}, //smart_speed_limit
{0x0095,0x01}, //PDFH_move_avg
{0x00ad,0x03}, //ATT_block_cnt
{0x01c0,0x0a}, //PDFH_used_cnt
//table reftarget
{0x0022,0x1e}, //use_cur_fps
{0x01e4,0x00},
{0x01e5,0x00},
{0x01e6,0x0b},
{0x01e7,0x00}, //table0
{0x01e8,0x00},
{0x01e9,0x00},
{0x01ea,0x2c},
{0x01eb,0x00}, //table1
{0x01ec,0x00},
{0x01ed,0x00},
{0x01ee,0xb0},
{0x01ef,0x00}, //table2
{0x01f0,0x00},
{0x01f1,0x02},
{0x01f2,0xc0},
{0x01f3,0x00}, //table3
{0x01f4,0x00},
{0x01f5,0x0b},
{0x01f6,0x00},
{0x01f7,0x00}, //table4
{0x01f8,0x00},
{0x01f9,0x2c},
{0x01fa,0x00},
{0x01fb,0x00}, //table5
//reftarget
{0x00b2,0x00},
{0x00b3,0xf0}, //ref_target_table0
{0x00b4,0x00},
{0x00b5,0xf0}, //ref_target_table1
{0x00b6,0x00},
{0x00b7,0xd0}, //ref_target_table2
{0x00b8,0x00},
{0x00b9,0xb0}, //ref_target_table3
{0x00ba,0x00},
{0x00bb,0xb0}, //ref_target_table4
{0x00bc,0x00},
{0x00bd,0xb0}, //ref_target_table5
{0x01cb,0x00}, //avg_thr_low
{0x01cc,0x60}, //avg_thr_high
{0x01cd,0x23}, //avg_affect_val
//over exposure offset
{0x01d6,0x10},
{0x01d7,0x0e},
{0x01d8,0x1e},
{0x01d9,0x2c},
{0x01da,0x30},
{0x01db,0x28},
//main body ratio table
{0x01dc,0x40},
{0x01dd,0x30},
{0x01de,0x20},
{0x01df,0x10},
{0x01e0,0x00},
{0x01e1,0x00},
{0x01b0,0x40}, //PDFL_brighten_max
{0x01b1,0x25}, //variance_affect_val
{0x01b2,0x01},
{0x01b3,0x00}, //variance_thr_low
{0x01b4,0x08},
{0x01b5,0x00}, //variance_thr_high
{0x01c6,0x30}, //PDFL_target
{0x01c7,0x1f}, //PDFH_max
{0x01c9,0x01}, //PDFH_target
{0x01ca,0x80}, //over_exp_affect_val_1
{0x01d0,0x01}, //over_exp_ref
{0x01d1,0x60}, //over_exp_affect_val_0
{0x01d2,0x08}, //under_exp_affect_val
{0x021d,0x04}, //PDFH_brighten_thr
{0x01b7,0x00}, //bright_ratio_thr_low
{0x01b8,0x20}, //bright_ratio_thr_middle
{0x01b9,0x60}, //bright_ratio_thr_high
{0x01ba,0x10}, //bright_ratio_affect
{0x00a6,0x32}, //CDF_high
{0x00a7,0x20}, //CDF_low
{0x0168,0x00},
{0x0169,0x00}, //min_avg_thr
{0x016a,0x03},
{0x016b,0x00}, //max_avg_thr
{0x016c,0x00},
{0x016d,0xa0}, //min_ATT_thr
{0x016e,0x02},
{0x016f,0x80}, //max_ATT_thr
{0x01d3,0x00}, //ATT_limit_affect_val_low
{0x01d4,0x10}, //ATT_limit_affect_val_high
{0x01d5,0x10}, //global_limit_ratio
{0x1a74,0x01}, //AE_mutiple_frame
{0x1a75,0x00}, //AE_active_frame
//LENC
{0xfffe,0x30},
{0x03ca,0x06}, //lenc_scale
{0x03cb,0x66},
{0x03cc,0x0b},
{0x03cd,0x60},
{0x03ce,0x06},
{0x03cf,0x66},
{0x03d0,0x05},
{0x03d1,0xb0},
{0x000e,0x00},
{0x000f,0x00},
{0x0010,0x00},
{0x0011,0x00},
{0x0012,0x80}, //lenc_skip
{0xfffe,0x14},
{0x0928,0x00},
{0x0929,0x6b}, //Alight_CT_thr
{0x092a,0x00},
{0x092b,0xbb}, //Clight_CT_thr
{0x092c,0x00},
{0x092d,0xe8}, //Dlight_CT_thr
{0x06e5,0x3f}, //A_light
{0x06e6,0x34},
{0x06e7,0x29},
{0x06e8,0x25},
{0x06e9,0x25},
{0x06ea,0x2a},
{0x06eb,0x36},
{0x06ec,0x3f},
{0x06ed,0x1b},
{0x06ee,0x14},
{0x06ef,0x11},
{0x06f0,0x0f},
{0x06f1,0x0f},
{0x06f2,0x11},
{0x06f3,0x15},
{0x06f4,0x1b},
{0x06f5,0x10},
{0x06f6,0x0a},
{0x06f7,0x07},
{0x06f8,0x05},
{0x06f9,0x05},
{0x06fa,0x07},
{0x06fb,0x0b},
{0x06fc,0x10},
{0x06fd,0x0a},
{0x06fe,0x05},
{0x06ff,0x02},
{0x0700,0x00},
{0x0701,0x00},
{0x0702,0x02},
{0x0703,0x05},
{0x0704,0x0a},
{0x0705,0x0a},
{0x0706,0x05},
{0x0707,0x02},
{0x0708,0x00},
{0x0709,0x00},
{0x070a,0x02},
{0x070b,0x05},
{0x070c,0x0a},
{0x070d,0x10},
{0x070e,0x0a},
{0x070f,0x07},
{0x0710,0x06},
{0x0711,0x06},
{0x0712,0x07},
{0x0713,0x0b},
{0x0714,0x10},
{0x0715,0x1c},
{0x0716,0x15},
{0x0717,0x12},
{0x0718,0x10},
{0x0719,0x10},
{0x071a,0x12},
{0x071b,0x16},
{0x071c,0x1c},
{0x071d,0x3f},
{0x071e,0x36},
{0x071f,0x2b},
{0x0720,0x27},
{0x0721,0x27},
{0x0722,0x2b},
{0x0723,0x38},
{0x0724,0x3f},
{0x0725,0x1f},
{0x0726,0x1c},
{0x0727,0x1b},
{0x0728,0x1b},
{0x0729,0x1a},
{0x072a,0x1b},
{0x072b,0x1a},
{0x072c,0x1b},
{0x072d,0x1e},
{0x072e,0x1d},
{0x072f,0x1c},
{0x0730,0x1b},
{0x0731,0x1b},
{0x0732,0x1b},
{0x0733,0x1b},
{0x0734,0x1a},
{0x0735,0x1e},
{0x0736,0x1d},
{0x0737,0x1e},
{0x0738,0x1e},
{0x0739,0x1e},
{0x073a,0x1c},
{0x073b,0x1b},
{0x073c,0x19},
{0x073d,0x1f},
{0x073e,0x20},
{0x073f,0x21},
{0x0740,0x21},
{0x0741,0x20},
{0x0742,0x1f},
{0x0743,0x1d},
{0x0744,0x1a},
{0x0745,0x1f},
{0x0746,0x1f},
{0x0747,0x21},
{0x0748,0x20},
{0x0749,0x20},
{0x074a,0x1e},
{0x074b,0x1c},
{0x074c,0x19},
{0x074d,0x1e},
{0x074e,0x1d},
{0x074f,0x1e},
{0x0750,0x1e},
{0x0751,0x1d},
{0x0752,0x1c},
{0x0753,0x1a},
{0x0754,0x19},
{0x0755,0x1c},
{0x0756,0x1c},
{0x0757,0x1b},
{0x0758,0x1b},
{0x0759,0x1a},
{0x075a,0x1a},
{0x075b,0x1a},
{0x075c,0x19},
{0x075d,0x20},
{0x075e,0x1c},
{0x075f,0x1b},
{0x0760,0x1a},
{0x0761,0x1a},
{0x0762,0x1a},
{0x0763,0x1a},
{0x0764,0x19},
{0x0765,0x21},
{0x0766,0x23},
{0x0767,0x23},
{0x0768,0x23},
{0x0769,0x23},
{0x076a,0x23},
{0x076b,0x24},
{0x076c,0x23},
{0x076d,0x21},
{0x076e,0x22},
{0x076f,0x22},
{0x0770,0x22},
{0x0771,0x22},
{0x0772,0x23},
{0x0773,0x23},
{0x0774,0x23},
{0x0775,0x1f},
{0x0776,0x21},
{0x0777,0x21},
{0x0778,0x21},
{0x0779,0x21},
{0x077a,0x21},
{0x077b,0x21},
{0x077c,0x21},
{0x077d,0x1f},
{0x077e,0x20},
{0x077f,0x20},
{0x0780,0x20},
{0x0781,0x20},
{0x0782,0x21},
{0x0783,0x21},
{0x0784,0x22},
{0x0785,0x1e},
{0x0786,0x1f},
{0x0787,0x1f},
{0x0788,0x20},
{0x0789,0x20},
{0x078a,0x20},
{0x078b,0x21},
{0x078c,0x21},
{0x078d,0x1e},
{0x078e,0x1f},
{0x078f,0x1f},
{0x0790,0x20},
{0x0791,0x20},
{0x0792,0x20},
{0x0793,0x20},
{0x0794,0x21},
{0x0795,0x1f},
{0x0796,0x20},
{0x0797,0x20},
{0x0798,0x20},
{0x0799,0x20},
{0x079a,0x21},
{0x079b,0x22},
{0x079c,0x22},
{0x079d,0x1f},
{0x079e,0x20},
{0x079f,0x20},
{0x07a0,0x20},
{0x07a1,0x20},
{0x07a2,0x20},
{0x07a3,0x21},
{0x07a4,0x20},
{0x07a5,0x3f}, //C_light
{0x07a6,0x2d},
{0x07a7,0x24},
{0x07a8,0x20},
{0x07a9,0x20},
{0x07aa,0x24},
{0x07ab,0x2f},
{0x07ac,0x3f},
{0x07ad,0x17},
{0x07ae,0x11},
{0x07af,0x0e},
{0x07b0,0x0d},
{0x07b1,0x0d},
{0x07b2,0x0f},
{0x07b3,0x12},
{0x07b4,0x18},
{0x07b5,0x0d},
{0x07b6,0x08},
{0x07b7,0x05},
{0x07b8,0x03},
{0x07b9,0x04},
{0x07ba,0x05},
{0x07bb,0x09},
{0x07bc,0x0e},
{0x07bd,0x07},
{0x07be,0x03},
{0x07bf,0x00},
{0x07c0,0x00},
{0x07c1,0x00},
{0x07c2,0x01},
{0x07c3,0x04},
{0x07c4,0x08},
{0x07c5,0x08},
{0x07c6,0x03},
{0x07c7,0x01},
{0x07c8,0x00},
{0x07c9,0x00},
{0x07ca,0x01},
{0x07cb,0x04},
{0x07cc,0x08},
{0x07cd,0x0d},
{0x07ce,0x08},
{0x07cf,0x05},
{0x07d0,0x04},
{0x07d1,0x04},
{0x07d2,0x06},
{0x07d3,0x09},
{0x07d4,0x0e},
{0x07d5,0x18},
{0x07d6,0x12},
{0x07d7,0x0f},
{0x07d8,0x0d},
{0x07d9,0x0d},
{0x07da,0x0f},
{0x07db,0x12},
{0x07dc,0x19},
{0x07dd,0x3f},
{0x07de,0x2f},
{0x07df,0x25},
{0x07e0,0x22},
{0x07e1,0x22},
{0x07e2,0x26},
{0x07e3,0x31},
{0x07e4,0x3f},
{0x07e5,0x2a},
{0x07e6,0x28},
{0x07e7,0x27},
{0x07e8,0x2a},
{0x07e9,0x28},
{0x07ea,0x27},
{0x07eb,0x27},
{0x07ec,0x27},
{0x07ed,0x21},
{0x07ee,0x1f},
{0x07ef,0x1f},
{0x07f0,0x1d},
{0x07f1,0x1d},
{0x07f2,0x1e},
{0x07f3,0x1d},
{0x07f4,0x1d},
{0x07f5,0x20},
{0x07f6,0x21},
{0x07f7,0x21},
{0x07f8,0x23},
{0x07f9,0x22},
{0x07fa,0x1f},
{0x07fb,0x1e},
{0x07fc,0x1b},
{0x07fd,0x23},
{0x07fe,0x23},
{0x07ff,0x25},
{0x0800,0x22},
{0x0801,0x22},
{0x0802,0x23},
{0x0803,0x1f},
{0x0804,0x1e},
{0x0805,0x22},
{0x0806,0x22},
{0x0807,0x25},
{0x0808,0x22},
{0x0809,0x22},
{0x080a,0x22},
{0x080b,0x1f},
{0x080c,0x1d},
{0x080d,0x1f},
{0x080e,0x20},
{0x080f,0x20},
{0x0810,0x22},
{0x0811,0x21},
{0x0812,0x1e},
{0x0813,0x1d},
{0x0814,0x1b},
{0x0815,0x1f},
{0x0816,0x1e},
{0x0817,0x1e},
{0x0818,0x1d},
{0x0819,0x1d},
{0x081a,0x1d},
{0x081b,0x1c},
{0x081c,0x1c},
{0x081d,0x20},
{0x081e,0x1e},
{0x081f,0x1d},
{0x0820,0x1e},
{0x0821,0x1d},
{0x0822,0x1c},
{0x0823,0x1c},
{0x0824,0x1b},
{0x0825,0x25},
{0x0826,0x27},
{0x0827,0x26},
{0x0828,0x28},
{0x0829,0x28},
{0x082a,0x27},
{0x082b,0x28},
{0x082c,0x26},
{0x082d,0x20},
{0x082e,0x21},
{0x082f,0x21},
{0x0830,0x20},
{0x0831,0x20},
{0x0832,0x21},
{0x0833,0x21},
{0x0834,0x22},
{0x0835,0x1e},
{0x0836,0x21},
{0x0837,0x22},
{0x0838,0x24},
{0x0839,0x24},
{0x083a,0x22},
{0x083b,0x21},
{0x083c,0x1f},
{0x083d,0x20},
{0x083e,0x22},
{0x083f,0x25},
{0x0840,0x23},
{0x0841,0x24},
{0x0842,0x24},
{0x0843,0x22},
{0x0844,0x21},
{0x0845,0x1f},
{0x0846,0x21},
{0x0847,0x23},
{0x0848,0x23},
{0x0849,0x23},
{0x084a,0x23},
{0x084b,0x21},
{0x084c,0x20},
{0x084d,0x1c},
{0x084e,0x1f},
{0x084f,0x1f},
{0x0850,0x21},
{0x0851,0x21},
{0x0852,0x1f},
{0x0853,0x1f},
{0x0854,0x1e},
{0x0855,0x1d},
{0x0856,0x1e},
{0x0857,0x1e},
{0x0858,0x1d},
{0x0859,0x1d},
{0x085a,0x1e},
{0x085b,0x1e},
{0x085c,0x1f},
{0x085d,0x1d},
{0x085e,0x1e},
{0x085f,0x1e},
{0x0860,0x1e},
{0x0861,0x1e},
{0x0862,0x1d},
{0x0863,0x1f},
{0x0864,0x1d},
{0x0865,0x3f}, //D_light
{0x0866,0x29},
{0x0867,0x20},
{0x0868,0x1c},
{0x0869,0x1c},
{0x086a,0x20},
{0x086b,0x2a},
{0x086c,0x3f},
{0x086d,0x14},
{0x086e,0x0e},
{0x086f,0x0c},
{0x0870,0x0b},
{0x0871,0x0b},
{0x0872,0x0c},
{0x0873,0x10},
{0x0874,0x15},
{0x0875,0x0b},
{0x0876,0x06},
{0x0877,0x03},
{0x0878,0x02},
{0x0879,0x02},
{0x087a,0x04},
{0x087b,0x07},
{0x087c,0x0c},
{0x087d,0x06},
{0x087e,0x02},
{0x087f,0x00},
{0x0880,0x00},
{0x0881,0x00},
{0x0882,0x00},
{0x0883,0x02},
{0x0884,0x06},
{0x0885,0x06},
{0x0886,0x02},
{0x0887,0x00},
{0x0888,0x00},
{0x0889,0x00},
{0x088a,0x00},
{0x088b,0x03},
{0x088c,0x06},
{0x088d,0x0b},
{0x088e,0x06},
{0x088f,0x04},
{0x0890,0x02},
{0x0891,0x02},
{0x0892,0x04},
{0x0893,0x07},
{0x0894,0x0c},
{0x0895,0x15},
{0x0896,0x0f},
{0x0897,0x0c},
{0x0898,0x0b},
{0x0899,0x0b},
{0x089a,0x0d},
{0x089b,0x10},
{0x089c,0x16},
{0x089d,0x3f},
{0x089e,0x2a},
{0x089f,0x21},
{0x08a0,0x1d},
{0x08a1,0x1d},
{0x08a2,0x22},
{0x08a3,0x2c},
{0x08a4,0x3f},
{0x08a5,0x28},
{0x08a6,0x25},
{0x08a7,0x25},
{0x08a8,0x27},
{0x08a9,0x28},
{0x08aa,0x25},
{0x08ab,0x24},
{0x08ac,0x24},
{0x08ad,0x27},
{0x08ae,0x26},
{0x08af,0x25},
{0x08b0,0x23},
{0x08b1,0x22},
{0x08b2,0x24},
{0x08b3,0x24},
{0x08b4,0x23},
{0x08b5,0x27},
{0x08b6,0x27},
{0x08b7,0x28},
{0x08b8,0x2a},
{0x08b9,0x29},
{0x08ba,0x26},
{0x08bb,0x25},
{0x08bc,0x23},
{0x08bd,0x28},
{0x08be,0x29},
{0x08bf,0x2a},
{0x08c0,0x28},
{0x08c1,0x28},
{0x08c2,0x29},
{0x08c3,0x26},
{0x08c4,0x24},
{0x08c5,0x28},
{0x08c6,0x28},
{0x08c7,0x29},
{0x08c8,0x28},
{0x08c9,0x28},
{0x08ca,0x28},
{0x08cb,0x26},
{0x08cc,0x24},
{0x08cd,0x27},
{0x08ce,0x26},
{0x08cf,0x27},
{0x08d0,0x2a},
{0x08d1,0x29},
{0x08d2,0x25},
{0x08d3,0x24},
{0x08d4,0x23},
{0x08d5,0x25},
{0x08d6,0x25},
{0x08d7,0x25},
{0x08d8,0x22},
{0x08d9,0x22},
{0x08da,0x24},
{0x08db,0x24},
{0x08dc,0x23},
{0x08dd,0x27},
{0x08de,0x23},
{0x08df,0x23},
{0x08e0,0x27},
{0x08e1,0x26},
{0x08e2,0x22},
{0x08e3,0x22},
{0x08e4,0x21},
{0x08e5,0x27},
{0x08e6,0x29},
{0x08e7,0x29},
{0x08e8,0x2d},
{0x08e9,0x2d},
{0x08ea,0x2a},
{0x08eb,0x2a},
{0x08ec,0x29},
{0x08ed,0x25},
{0x08ee,0x28},
{0x08ef,0x27},
{0x08f0,0x25},
{0x08f1,0x25},
{0x08f2,0x27},
{0x08f3,0x27},
{0x08f4,0x27},
{0x08f5,0x24},
{0x08f6,0x26},
{0x08f7,0x26},
{0x08f8,0x2a},
{0x08f9,0x29},
{0x08fa,0x26},
{0x08fb,0x27},
{0x08fc,0x25},
{0x08fd,0x24},
{0x08fe,0x28},
{0x08ff,0x27},
{0x0900,0x28},
{0x0901,0x28},
{0x0902,0x29},
{0x0903,0x28},
{0x0904,0x26},
{0x0905,0x23},
{0x0906,0x27},
{0x0907,0x26},
{0x0908,0x29},
{0x0909,0x29},
{0x090a,0x27},
{0x090b,0x27},
{0x090c,0x25},
{0x090d,0x23},
{0x090e,0x24},
{0x090f,0x23},
{0x0910,0x27},
{0x0911,0x27},
{0x0912,0x23},
{0x0913,0x25},
{0x0914,0x24},
{0x0915,0x22},
{0x0916,0x24},
{0x0917,0x23},
{0x0918,0x22},
{0x0919,0x22},
{0x091a,0x24},
{0x091b,0x24},
{0x091c,0x24},
{0x091d,0x24},
{0x091e,0x24},
{0x091f,0x24},
{0x0920,0x27},
{0x0921,0x27},
{0x0922,0x24},
{0x0923,0x25},
{0x0924,0x24},
{0xfffe,0x30},
{0x03c2,0x18}, //min_q
{0x03c3,0x40}, //max_q
{0x03c4,0x07}, //lenc_ctrl
{0x03c6,0x00},
{0x03c7,0x80}, //autoG_max_gain
{0x03c8,0x00},
{0x03c9,0x40}, //autoG_min_gain
//BLC
{0xfffe,0x30},
{0x0013,0x11},
{0x0014,0x00},
{0x071b,0x44},
//AWB
{0xfffe,0x14},
{0x0248,0x01}, //AWB_mode
{0x0249,0x01}, //AWB_fleximap_en
{0x027a,0x00},
{0x027b,0x40}, //min_num
{0x027c,0x0f},
{0x027d,0xff}, //max_awb_gain
{0x027e,0x04}, //awb_step
{0x027f,0x80}, //max_step_value
{0x02b6,0x06},
{0x02b7,0x00}, //B_temp
{0x02ba,0x04},
{0x02bb,0x00}, //G_temp
{0x02be,0x04},
{0x02bf,0x00}, //R_temp
{0x024a,0x00}, //awb_move_en
{0x024e,0x01},
{0x024f,0x00}, //D65:B_offset
{0x0252,0x01},
{0x0253,0x00}, //D65:R_offset
{0x0256,0x01},
{0x0257,0x00}, //CWF:B_offset
{0x025a,0x01},
{0x025b,0x00}, //CWF:R_offset
{0x025e,0x01},
{0x025f,0x00}, //A:B_offset
{0x0262,0x01},
{0x0263,0x00}, //A:R_offset
{0x0264,0x00},
{0x0265,0x38}, //awb_color0
{0x0266,0x00},
{0x0267,0x61}, //awb_color1
{0x0268,0x00},
{0x0269,0xa7}, //awb_color2
{0x026a,0x80}, //awb_shift_R
{0x026b,0x80}, //awb_shift_B
{0xfffe,0x30},
{0x0708,0x02},
{0x0709,0xa0}, //pixel_max_value
{0x070a,0x00},
{0x070b,0x10}, //pixel_min_value
{0xfffe,0x30},
{0x0730,0x4b},
{0x0731,0x6d},
{0x0732,0x47},
{0x0733,0x68},
{0x0734,0x60},
{0x0735,0x80},
{0x0736,0x46},
{0x0737,0x67},
{0x0738,0x69},
{0x0739,0x86},
{0x073a,0x2d},
{0x073b,0x50},
{0x073c,0x55},
{0x073d,0x77},
{0x073e,0x5a},
{0x073f,0x77},
{0x0740,0x70},
{0x0741,0x90},
{0x0742,0x50},
{0x0743,0x70},
{0x0744,0x7d},
{0x0745,0x9b},
{0x0746,0x2d},
{0x0747,0x4b},
{0x0748,0x30},
{0x0749,0x60},
{0x074a,0x80},
{0x074b,0x90},
{0x074c,0x20},
{0x074d,0x50},
{0x074e,0x90},
{0x074f,0xa0},
{0x0750,0x00},
{0x0751,0x00},
{0x0752,0x00},
{0x0753,0x00},
{0x0754,0x00},
{0x0755,0x00},
{0x0756,0x00},
{0x0757,0x00},
{0x0758,0x00},
{0x0759,0x00},
{0x075a,0x00},
{0x075b,0x00},
{0x075c,0x00},
{0x075d,0x00},
{0x075e,0x00},
{0x075f,0x00},
{0x0760,0x00},
{0x0761,0x00},
{0x0762,0x00},
{0x0763,0x00},
{0x0764,0x00},
{0x0765,0x00},
{0x0766,0x00},
{0x0767,0x00},
{0x0768,0x00},
{0x0769,0x00},
{0x076a,0x00},
{0x076b,0x00},
{0x076c,0x00},
{0x076d,0x00},
{0x076e,0x00},
{0x076f,0x00},
{0x0770,0x11},
{0x0771,0x11},
{0x0772,0x11},
{0x0773,0x00},
{0x0774,0x00},
{0x0775,0x00},
{0x0776,0x00},
{0x0777,0x00},
//RAW Gamma
{0xfffe,0x30},
{0x0901,0x05},
{0x0902,0x0c},
{0x0903,0x17},
{0x0904,0x2d},
{0x0905,0x39},
{0x0906,0x44},
{0x0907,0x4f},
{0x0908,0x59},
{0x0909,0x62},
{0x090a,0x6b},
{0x090b,0x7b},
{0x090c,0x89},
{0x090d,0xa3},
{0x090e,0xbd},
{0x090f,0xd7},
{0x0910,0xff},
//RGB Gamma
{0xfffe,0x30},
{0x1400,0x00},
{0x1401,0x02},
{0x1402,0x05},
{0x1403,0x08},
{0x1404,0x0b},
{0x1405,0x0e},
{0x1406,0x11},
{0x1407,0x14},
{0x1408,0x17},
{0x1409,0x1a},
{0x140a,0x1c},
{0x140b,0x1f},
{0x140c,0x22},
{0x140d,0x25},
{0x140e,0x28},
{0x140f,0x2b},
{0x1410,0x2e},
{0x1411,0x30},
{0x1412,0x33},
{0x1413,0x36},
{0x1414,0x39},
{0x1415,0x3b},
{0x1416,0x3e},
{0x1417,0x41},
{0x1418,0x44},
{0x1419,0x46},
{0x141a,0x49},
{0x141b,0x4c},
{0x141c,0x4e},
{0x141d,0x51},
{0x141e,0x54},
{0x141f,0x56},
{0x1420,0x59},
{0x1421,0x5e},
{0x1422,0x63},
{0x1423,0x68},
{0x1424,0x6d},
{0x1425,0x72},
{0x1426,0x77},
{0x1427,0x7b},
{0x1428,0x80},
{0x1429,0x84},
{0x142a,0x88},
{0x142b,0x8d},
{0x142c,0x91},
{0x142d,0x95},
{0x142e,0x99},
{0x142f,0x9d},
{0x1430,0xa0},
{0x1431,0xa8},
{0x1432,0xaf},
{0x1433,0xb6},
{0x1434,0xbc},
{0x1435,0xc3},
{0x1436,0xc9},
{0x1437,0xcf},
{0x1438,0xd4},
{0x1439,0xda},
{0x143a,0xe0},
{0x143b,0xe5},
{0x143c,0xea},
{0x143d,0xf0},
{0x143e,0xf5},
{0x143f,0xfa},
{0x1440,0xff},
{0x1450,0x60},
{0x1451,0x03},
{0x1452,0x60},
{0x1453,0x30},
//CMX
{0xfffe,0x30},
{0x1200,0x00},
{0x1201,0xe8},
{0x1202,0x00},
{0x1203,0xe8},
{0x1204,0x03},
{0x1205,0x12},
{0x1206,0x02},
{0x1207,0x71},
{0x1208,0x01},
{0x1209,0x9d},
{0x120a,0x01},
{0x120b,0xa7},
{0x120c,0x03},
{0x120d,0x53},
{0x120e,0x01},
{0x120f,0x00},
{0x1210,0x02},
{0x1211,0x24},
{0x1212,0x02},
{0x1213,0x47},
{0x1214,0x00},
{0x1215,0x46},
{0x1216,0x04},
{0x1217,0x0e},
{0x1218,0x02},
{0x1219,0x99},
{0x121a,0x01},
{0x121b,0x00},
{0x121c,0x02},
{0x121d,0x24},
{0x121e,0x02},
{0x121f,0x01},
{0x1220,0x00},
{0x1221,0x46},
{0x1222,0x04},
{0x1223,0x0e},
{0x122e,0x00},
{0x122f,0x00},
{0x1230,0x00},
{0x1228,0x00},
{0x1229,0x84},
{0x122a,0x00},
{0x122b,0xeb},
{0x122c,0x01},
{0x122d,0x28},
{0x1231,0x03}, //cmx_ctrl
{0x1232,0x39},
{0x1233,0x23},
{0x1234,0x0a},
{0x1235,0x0f},
//advance_raw_dns
{0xfffe,0x30},
{0x2000,0x04}, //s0_sigma_0
{0x2001,0x05},
{0x2002,0x0b},
{0x2003,0x10},
{0x2004,0x16},
{0x2005,0x20},
{0x2006,0x0a}, //s0_Gsl_0
{0x2007,0x0a},
{0x2008,0x0a},
{0x2009,0x0a},
{0x200a,0x0a},
{0x200b,0x0a},
{0x200c,0x0a}, //s0_RBsl_0
{0x200d,0x0a},
{0x200e,0x0a},
{0x200f,0x0a},
{0x2010,0x0a},
{0x2011,0x0a},
{0x2012,0x30}, //s0_ps00
{0x2013,0x30},
{0x2014,0x30},
{0x2015,0x30},
{0x2016,0x30},
{0x2017,0x30},
{0x2018,0x30}, //s0_ps10
{0x2019,0x30},
{0x201a,0x30},
{0x201b,0x30},
{0x201c,0x30},
{0x201d,0x30},
{0x201e,0x40}, //s0_ps20
{0x201f,0x40},
{0x2020,0x40},
{0x2021,0x40},
{0x2022,0x40},
{0x2023,0x40},
{0x2024,0x50}, //s0_ps30
{0x2025,0x50},
{0x2026,0x50},
{0x2027,0x50},
{0x2028,0x50},
{0x2029,0x50},
{0x202a,0x08}, //s0_pl00
{0x202b,0x08},
{0x202c,0x08},
{0x202d,0x08},
{0x202e,0x08},
{0x202f,0x08},
{0x2030,0x08}, //s0_pl10
{0x2031,0x08},
{0x2032,0x08},
{0x2033,0x08},
{0x2034,0x08},
{0x2035,0x08},
{0x2036,0x08}, //s0_pl20
{0x2037,0x08},
{0x2038,0x08},
{0x2039,0x08},
{0x203a,0x08},
{0x203b,0x08},
{0x203c,0x04}, //s0_pl30
{0x203d,0x04},
{0x203e,0x04},
{0x203f,0x04},
{0x2040,0x04},
{0x2041,0x04},
{0x2044,0x10}, //thre_y
//UV_dns
{0xfffe,0x30},
{0x2100,0x38}, //l_noise_list0
{0x2101,0x36},
{0x2102,0x30},
{0x2103,0x25},
{0x2104,0x20},
{0x2105,0x17},
{0x2106,0x5f}, //uv_dns_ctrl
{0x2107,0x08}, //noise_man_value
//CIP
{0xfffe,0x30},
{0x0f00,0x47}, //bit[7:4] noise_y_slp bit[3:0] Lsharp
{0x0f02,0x00}, //noise_list0
{0x0f03,0x00},
{0x0f04,0x00},
{0x0f05,0x00},
{0x0f06,0x00},
{0x0f07,0x00},
{0x0f08,0x00},
{0x0f09,0x00},
{0x0f0a,0x05}, //min_shp
{0x0f0b,0x0f}, //max_shp
{0x0f0c,0x02}, //min_detail
{0x0f0d,0x0a}, //max_detail
{0x0f0e,0x01}, //min_shp_gain
{0x0f0f,0x20}, //max_shp_gain
{0x0f10,0x60},
//WDR
{0xfffe,0x30},
{0x2b04,0x07}, //sat_factor
{0x2b16,0x04}, //wdr_ctrl
{0xfffe,0x14},
{0x09ab,0x02}, //Gmax
{0x09ac,0x0c},
{0x09ad,0xe0}, //map_rang
{0x09ae,0x41}, //PDF64_num_thd
{0x09af,0xff}, //gray_high
{0x09b2,0x0f},
{0x09b3,0x48}, //gain_thd
{0x09b4,0x10}, //ext_ratio
{0x09b5,0x14}, //ext_ratio_max
{0x09b6,0x00}, //weak_adj_on
{0xfffe,0x30},
{0x2b9a,0x00},
{0x2b9b,0x00}, //gain_list0
{0x2b9c,0x10},
{0x2b9d,0x00},
{0x2b9e,0x20},
{0x2b9f,0x00},
{0x2ba0,0x40},
{0x2ba1,0x00},
{0x2ba2,0x70},
{0x2ba3,0x00},
{0x2ba4,0xa0},
{0x2ba5,0x00},
{0x2ba6,0xd0},
{0x2ba7,0x00},
{0x2ba8,0x01},
{0x2ba9,0x00},
{0x2bac,0x0b}, //thd0
{0x2bad,0x0b},
{0x2bae,0x0b},
{0x2baf,0x0b},
{0x2bb0,0x0b},
{0x2bb1,0x0b},
{0x2bb2,0x0b},
{0x2bb3,0x0b},
{0x2bb4,0x20}, //thd0_max
{0x2bb5,0x20},
{0x2bb6,0x20},
{0x2bb7,0x20},
{0x2bb8,0x20},
{0x2bb9,0x20},
{0x2bba,0x20},
{0x2bbb,0x20},
{0x2bbc,0x10}, //enhance_ratio0
{0x2bbd,0x10},
{0x2bbe,0x0b},
{0x2bbf,0x08},
{0x2bc0,0x04},
{0x2bc1,0x04},
{0x2bc2,0x04},
{0x2bc3,0x04},
{REG_NULL, REG_DL},
//Auto_Sat
{0xfffe,0x14},
{0x026c,0x01}, //auto_sat_enable
{0x026d,0x20},
{0x026e,0x40}, //sat_U0
{0x026f,0x38},
{0x0270,0x30},
{0x0271,0x20},
{0x0272,0x20},
{0x0273,0x20},
{0x0274,0x40}, //sat_V0
{0x0275,0x38},
{0x0276,0x30},
{0x0277,0x20},
{0x0278,0x20},
{0x0279,0x20},
{REG_NULL, REG_DL},
//TOP
{0xfffe,0x14},
{0x002b,0x01}, //AE_enable
{0x002c,0x01}, //awb_enable
{0x002f,0x01}, //wdr_enable
{0x0030,0x01}, //lenc_enable
{0x0620,0x01},
{0x0621,0x01},
{0xfffe,0x30},
{0x0000,0xe7},
{0x0001,0x9b},
{0x0002,0x96},
{0x0003,0x31},
{0x0004,0x90},
{0x2300,0x0f},
{0x0019,0x8b},
{0x071c,0x0a},
{0x1700,0x09},
{0x1701,0x40},
{0x1702,0x40},
{0x1704,0x22}, //contrast_ygain
{0x1707,0x00}, //ybright
{REG_NULL, 0x00},
};
static const struct regval sensor_xc7160_4k_25fps_2022617_regs[] = {
{0x0103,0x01},
{0x0100,0x00},
{0x36e9,0x80},
{0x36f9,0x80},
{0x3018,0x72},
{0x3019,0x00},
{0x301f,0x66},
{0x3031,0x0a},
{0x3037,0x20},
{0x3038,0x44},
{0x3200,0x00},
{0x3201,0x0a},
{0x3202,0x00},
{0x3203,0x08},
{0x3204,0x0f},
{0x3205,0x19},
{0x3206,0x08},
{0x3207,0x87},
{0x3208,0x0f},
{0x3209,0x08},
{0x320a,0x08},
{0x320b,0x78},
{0x320c,0x08},
{0x320d,0x34},
{0x320e,0x09},
{0x320f,0x60},
{0x3210,0x00},
{0x3211,0x04},
{0x3212,0x00},
{0x3213,0x04},
{0x3241,0x00},
{0x3243,0x03},
{0x3248,0x04},
{0x3271,0x1c},
{0x3273,0x1f},
{0x3301,0x18},
{0x3306,0x88},
{0x3308,0x20},
{0x3309,0x68},
{0x330b,0x70},
{0x330d,0x28},
{0x330e,0x48},
{0x3314,0x94},
{0x331f,0x59},
{0x3332,0x24},
{0x334c,0x10},
{0x3350,0x24},
{0x3358,0x24},
{0x335c,0x24},
{0x335d,0x60},
{0x3364,0x16},
{0x3366,0x92},
{0x3367,0x08},
{0x3368,0x07},
{0x3369,0x00},
{0x336a,0x00},
{0x336b,0x00},
{0x336c,0xc2},
{0x337f,0x33},
{0x3390,0x08},
{0x3391,0x18},
{0x3392,0x38},
{0x3393,0x1c},
{0x3394,0x28},
{0x3395,0x60},
{0x3396,0x08},
{0x3397,0x18},
{0x3398,0x38},
{0x3399,0x18},
{0x339a,0x1c},
{0x339b,0x28},
{0x339c,0x60},
{0x339e,0x24},
{0x33aa,0x24},
{0x33af,0x48},
{0x33e1,0x08},
{0x33e2,0x18},
{0x33e3,0x10},
{0x33e4,0x0c},
{0x33e5,0x10},
{0x33e6,0x06},
{0x33e7,0x02},
{0x33e8,0x18},
{0x33e9,0x10},
{0x33ea,0x0c},
{0x33eb,0x10},
{0x33ec,0x04},
{0x33ed,0x02},
{0x33ee,0xa0},
{0x33ef,0x08},
{0x33f4,0x18},
{0x33f5,0x10},
{0x33f6,0x0c},
{0x33f7,0x10},
{0x33f8,0x06},
{0x33f9,0x02},
{0x33fa,0x18},
{0x33fb,0x10},
{0x33fc,0x0c},
{0x33fd,0x10},
{0x33fe,0x04},
{0x33ff,0x02},
{0x360f,0x01},
{0x3622,0xf7},
{0x3624,0x45},
{0x3628,0x83},
{0x3630,0x80},
{0x3631,0x80},
{0x3632,0xa8},
{0x3633,0x53},
{0x3635,0x02},
{0x3637,0x52},
{0x3638,0x0a},
{0x363a,0x88},
{0x363b,0x06},
{0x363d,0x01},
{0x363e,0x00},
{0x3641,0x00},
{0x3670,0x4a},
{0x3671,0xf7},
{0x3672,0xf7},
{0x3673,0x17},
{0x3674,0x80},
{0x3675,0x85},
{0x3676,0xa5},
{0x367a,0x48},
{0x367b,0x78},
{0x367c,0x48},
{0x367d,0x78},
{0x3690,0x53},
{0x3691,0x63},
{0x3692,0x54},
{0x3699,0x88},
{0x369a,0x9f},
{0x369b,0x9f},
{0x369c,0x48},
{0x369d,0x78},
{0x36a2,0x48},
{0x36a3,0x78},
{0x36bb,0x48},
{0x36bc,0x78},
{0x36c9,0x05},
{0x36ca,0x05},
{0x36cb,0x05},
{0x36cc,0x00},
{0x36cd,0x10},
{0x36ce,0x1a},
{0x36d0,0x30},
{0x36d1,0x48},
{0x36d2,0x78},
{0x36ea,0x39},
{0x36eb,0x04},
{0x36ec,0x05},
{0x36ed,0x24},
{0x36fa,0x39},
{0x36fb,0x13},
{0x36fc,0x10},
{0x36fd,0x14},
{0x3901,0x00},
{0x3902,0xc5},
{0x3904,0x18},
{0x3905,0xd8},
{0x3907,0x00},
{0x3908,0x11},
{0x394c,0x0f},
{0x394d,0x20},
{0x394e,0x08},
{0x394f,0x90},
{0x3980,0x71},
{0x3981,0x70},
{0x3982,0x00},
{0x3983,0x00},
{0x3984,0x20},
{0x3987,0x0b},
{0x3990,0x03},
{0x3991,0xfd},
{0x3992,0x03},
{0x3993,0xfc},
{0x3994,0x00},
{0x3995,0x00},
{0x3996,0x00},
{0x3997,0x05},
{0x3998,0x00},
{0x3999,0x09},
{0x399a,0x00},
{0x399b,0x12},
{0x399c,0x00},
{0x399d,0x12},
{0x399e,0x00},
{0x399f,0x18},
{0x39a0,0x00},
{0x39a1,0x14},
{0x39a2,0x03},
{0x39a3,0xe3},
{0x39a4,0x03},
{0x39a5,0xf2},
{0x39a6,0x03},
{0x39a7,0xf6},
{0x39a8,0x03},
{0x39a9,0xfa},
{0x39aa,0x03},
{0x39ab,0xff},
{0x39ac,0x00},
{0x39ad,0x06},
{0x39ae,0x00},
{0x39af,0x09},
{0x39b0,0x00},
{0x39b1,0x12},
{0x39b2,0x00},
{0x39b3,0x22},
{0x39b4,0x0c},
{0x39b5,0x1c},
{0x39b6,0x38},
{0x39b7,0x5b},
{0x39b8,0x50},
{0x39b9,0x38},
{0x39ba,0x20},
{0x39bb,0x10},
{0x39bc,0x0c},
{0x39bd,0x16},
{0x39be,0x21},
{0x39bf,0x36},
{0x39c0,0x3b},
{0x39c1,0x2a},
{0x39c2,0x16},
{0x39c3,0x0c},
{0x39c5,0x30},
{0x39c6,0x07},
{0x39c7,0xf8},
{0x39c9,0x07},
{0x39ca,0xf8},
{0x39cc,0x00},
{0x39cd,0x1b},
{0x39ce,0x00},
{0x39cf,0x00},
{0x39d0,0x1b},
{0x39d1,0x00},
{0x39e2,0x15},
{0x39e3,0x87},
{0x39e4,0x12},
{0x39e5,0xb7},
{0x39e6,0x00},
{0x39e7,0x8c},
{0x39e8,0x01},
{0x39e9,0x31},
{0x39ea,0x01},
{0x39eb,0xd7},
{0x39ec,0x08},
{0x39ed,0x00},
{0x3e00,0x01},
{0x3e01,0x2b},
{0x3e02,0x80},
{0x3e08,0x03},
{0x3e09,0x40},
{0x3e0e,0x09},
{0x3e14,0x31},
{0x3e16,0x00},
{0x3e17,0xac},
{0x3e18,0x00},
{0x3e19,0xac},
{0x3e1b,0x3a},
{0x3e1e,0x76},
{0x3e25,0x23},
{0x3e26,0x40},
{0x4501,0xa4},
{0x4509,0x10},
{0x4800,0x44},
{0x4837,0x1f},
{0x5799,0x06},
{0x57aa,0x2f},
{0x57ab,0xff},
{0x5988,0x84},
{0x598e,0x07},
{0x598f,0xe8},
{0x36e9,0x53},
{0x36f9,0x23},
{0x0100,0x01},
{REG_NULL, 0x00},
};
#endif
更多推荐

所有评论(0)