update:1、更新双sensor驱动 2、关闭mpp调试信息,缩小rootfs尺寸
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
#define ID_VAL_LOW 0x52
|
||||
#define SENSOR_FRAME_RATE 30
|
||||
|
||||
#define GAIN_STEP_BASE 64 //mean gain min step is 1/64gain
|
||||
//#define GAIN_STEP_BASE 64 //mean gain min step is 1/64gain
|
||||
|
||||
#define I2C_ADDR 0x60
|
||||
//#define I2C_ADDR_2 0x32
|
||||
@@ -260,6 +260,7 @@ static int setSensorGain(int id, int gain)
|
||||
|
||||
static int sensor_s_gain(int id, int gain_val)
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
int tem_gain_val;
|
||||
|
||||
@@ -301,7 +302,10 @@ static int sensor_s_gain(int id, int gain_val)
|
||||
sensor_write(id, 0x3e08, 0x1f);
|
||||
sensor_write(id, 0x3e09, gain_val >> 3);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
sensor_print("gain_val:%d.\n", gain_val);
|
||||
setSensorGain(id, gain_val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -310,12 +314,43 @@ static int sensor_s_exp_gain(int id, struct sensor_exp_gain *exp_gain)
|
||||
int exp_val,gain_val;
|
||||
int shutter = 0, frame_length = 0;
|
||||
|
||||
//sensor_print("sensor_s_exp_gain exp:%d gain:%d\n", exp_gain->gain_val, exp_gain->exp_val);
|
||||
if((exp_gain->exp_val - exp_gain->exp_val / 16 * 16) > 0) {
|
||||
exp_val = exp_gain->exp_val / 16 + 1;
|
||||
} else {
|
||||
exp_val = exp_gain->exp_val / 16;
|
||||
}
|
||||
exp_val = exp_val & 0xffff;
|
||||
|
||||
gain_val = exp_gain->gain_val * GAIN_STEP_BASE;
|
||||
if((gain_val - gain_val / 16 * 16) > 0) {
|
||||
gain_val = gain_val / 16 + 1;
|
||||
} else {
|
||||
gain_val = gain_val / 16;
|
||||
}
|
||||
if (exp_val > 1250){
|
||||
exp_val = 1250;
|
||||
}
|
||||
sensor_s_exp(id, exp_val);
|
||||
sensor_s_gain(id, gain_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int sensor_g_fps(int id, struct sensor_fps *fps)
|
||||
{
|
||||
data_type frame_length = 0, act_vts = 0;
|
||||
sensor_read(id, 0x320f, &frame_length);
|
||||
act_vts = frame_length << 8;
|
||||
sensor_read(id, 0x320e, &frame_length);
|
||||
act_vts |= frame_length;
|
||||
fps‑>fps = current_win[id]‑>pclk / (current_win[id]‑>hts * act_vts);
|
||||
sensor_dbg("fps = %d\n", fps‑>fps);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int sensor_power(int id, int on)
|
||||
{
|
||||
int ret;
|
||||
@@ -333,13 +368,13 @@ static int sensor_power(int id, int on)
|
||||
vin_set_mclk_freq(id, MCLK);
|
||||
vin_set_mclk(id, 1);
|
||||
hal_usleep(1000);
|
||||
ret = vin_gpio_get_status(id, IR_CUT0);
|
||||
if(ret != 1){ //if not output, set output
|
||||
vin_gpio_set_status(id, IR_CUT0, 1); /* power en*/
|
||||
vin_gpio_write(id, IR_CUT0, CSI_GPIO_HIGH); /* power en*/
|
||||
}
|
||||
//ret = vin_gpio_get_status(id, IR_CUT0);
|
||||
//if(ret != 1){ //if not output, set output
|
||||
// vin_gpio_set_status(id, IR_CUT0, 1); /* power en*/
|
||||
// vin_gpio_write(id, IR_CUT0, CSI_GPIO_HIGH); /* power en*/
|
||||
//}
|
||||
//vin_gpio_get_status(id, IR_CUT0);
|
||||
vin_gpio_read(id, IR_CUT0);
|
||||
//vin_gpio_read(id, IR_CUT0);
|
||||
vin_gpio_set_status(id, PWDN, 1);
|
||||
vin_gpio_set_status(id, RESET, 1);
|
||||
//vin_gpio_set_status(id, IR_CUT0, 1); /* power en*/
|
||||
@@ -431,21 +466,21 @@ static int sensor_init(int id)
|
||||
static struct sensor_format_struct sensor_formats[] = {
|
||||
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,//MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 1600,
|
||||
.height = 1200,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 2200,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 74250000,
|
||||
.mipi_bps = 371250000,
|
||||
.pclk = 71250000,
|
||||
.mipi_bps = 297 * 1000 * 1000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = 1250 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 128 << 4,
|
||||
.gain_max = 16 << 4,
|
||||
.offs_h = 0,
|
||||
.offs_v = 0,
|
||||
.regs = sensor_normal_regs,
|
||||
@@ -512,21 +547,21 @@ static struct sensor_format_struct switch_sensor_formats[] = {
|
||||
|
||||
#if SENSOR_30FPS
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,//MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 1600,
|
||||
.height = 1200,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 2200,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 74250000,
|
||||
.mipi_bps = 371250000,
|
||||
.pclk = 71250000,
|
||||
.mipi_bps = 297 * 1000 * 1000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = 1250 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 128 << 4,
|
||||
.gain_max = 16 << 4,
|
||||
.switch_regs = sensor_normal_regs,
|
||||
.switch_regs_size = ARRAY_SIZE(sensor_normal_regs),
|
||||
}
|
||||
@@ -622,7 +657,8 @@ static int sensor_reg_init(int id, int isp_id)
|
||||
sensor_s_exp_gain(id, &exp_gain);
|
||||
|
||||
sc202cs_sensor_vts = current_win[id]->vts;
|
||||
//sensor_dbg("sc202cs_sensor_vts = %d\n", sc202cs_sensor_vts);
|
||||
sensor_dbg("sc202cs_sensor_vts = %d, exp_val = %d, gain_val = %d\n",
|
||||
sc202cs_sensor_vts, exp_gain.exp_val, exp_gain.gain_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user