return ret;
}
+#define REG_1X_BASE_DGAIN_VALUE 1000
+#define REG_1X_BASE_DGAIN 0x0400
+
+u32 sensor_12a10_dgain_to_reg_value(u32 permile)
+{
+ u32 reg_dgain;
+ reg_dgain = permile * REG_1X_BASE_DGAIN / REG_1X_BASE_DGAIN_VALUE;
+
+ return reg_dgain;
+}
+
int sensor_12a10_cis_set_digital_gain(struct v4l2_subdev *subdev, struct ae_param *dgain)
{
int ret = 0;
u16 long_gain = 0;
u16 short_gain = 0;
+ u8 reg_short_gain[2] = {0};
#ifdef DEBUG_SENSOR_TIME
struct timeval st, end;
cis_data = cis->cis_data;
- long_gain = (u16)sensor_cis_calc_dgain_code(dgain->long_val);
- short_gain = (u16)sensor_cis_calc_dgain_code(dgain->short_val);
+ long_gain = (u16)sensor_12a10_dgain_to_reg_value(dgain->long_val);
+ short_gain = (u16)sensor_12a10_dgain_to_reg_value(dgain->short_val);
if (long_gain < cis->cis_data->min_digital_gain[0])
long_gain = cis->cis_data->min_digital_gain[0];
if (short_gain > cis->cis_data->max_digital_gain[0])
short_gain = cis->cis_data->max_digital_gain[0];
+ reg_short_gain[0] = (short_gain & 0x3FFF) >> 8;
+ reg_short_gain[1] = (short_gain & 0xFF);
+ fimc_is_sensor_write8(client, 0x350A, reg_short_gain[0]);
+ fimc_is_sensor_write8(client, 0x350B, reg_short_gain[1]);
+
dbg_sensor(1, "[MOD:D:%d] %s(vsync cnt = %d), input_dgain = %d/%d us, long_gain(%#x), short_gain(%#x)\n",
cis->id, __func__, cis->cis_data->sen_vsync_count, dgain->long_val,
dgain->short_val, long_gain, short_gain);
}
cis_data = cis->cis_data;
- cis_data->min_digital_gain[0] = 0x100;
- cis_data->min_digital_gain[1] = 1000;
+ cis_data->min_digital_gain[0] = REG_1X_BASE_DGAIN;
+ cis_data->min_digital_gain[1] = REG_1X_BASE_DGAIN_VALUE;
*min_dgain = cis_data->min_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,
}
cis_data = cis->cis_data;
- cis_data->max_digital_gain[0] = 0x100;
- cis_data->max_digital_gain[1] = 1000;
+ cis_data->max_digital_gain[0] = 0x3FFF;
+ cis_data->max_digital_gain[1] = 16000;
*max_dgain = cis_data->max_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,
return ret;
}
+#define REG_1X_BASE_DGAIN_VALUE 1000
+#define REG_1X_BASE_DGAIN 0x0400
+
+u32 sensor_12a10ff_dgain_to_reg_value(u32 permile)
+{
+ u32 reg_dgain;
+ reg_dgain = permile * REG_1X_BASE_DGAIN / REG_1X_BASE_DGAIN_VALUE;
+
+ return reg_dgain;
+}
+
int sensor_12a10ff_cis_set_digital_gain(struct v4l2_subdev *subdev, struct ae_param *dgain)
{
int ret = 0;
u16 long_gain = 0;
u16 short_gain = 0;
+ u8 reg_short_gain[2] = {0};
#ifdef DEBUG_SENSOR_TIME
struct timeval st, end;
cis_data = cis->cis_data;
- long_gain = (u16)sensor_cis_calc_dgain_code(dgain->long_val);
- short_gain = (u16)sensor_cis_calc_dgain_code(dgain->short_val);
+ long_gain = (u16)sensor_12a10ff_dgain_to_reg_value(dgain->long_val);
+ short_gain = (u16)sensor_12a10ff_dgain_to_reg_value(dgain->short_val);
if (long_gain < cis->cis_data->min_digital_gain[0])
long_gain = cis->cis_data->min_digital_gain[0];
if (short_gain > cis->cis_data->max_digital_gain[0])
short_gain = cis->cis_data->max_digital_gain[0];
+ reg_short_gain[0] = (short_gain & 0x3FFF) >> 8;
+ reg_short_gain[1] = (short_gain & 0xFF);
+ fimc_is_sensor_write8(client, 0x350A, reg_short_gain[0]);
+ fimc_is_sensor_write8(client, 0x350B, reg_short_gain[1]);
+
dbg_sensor(1, "[MOD:D:%d] %s(vsync cnt = %d), input_dgain = %d/%d us, long_gain(%#x), short_gain(%#x)\n",
cis->id, __func__, cis->cis_data->sen_vsync_count, dgain->long_val,
dgain->short_val, long_gain, short_gain);
}
cis_data = cis->cis_data;
- cis_data->min_digital_gain[0] = 0x100;
- cis_data->min_digital_gain[1] = 1000;
+ cis_data->min_digital_gain[0] = REG_1X_BASE_DGAIN;
+ cis_data->min_digital_gain[1] = REG_1X_BASE_DGAIN_VALUE;
*min_dgain = cis_data->min_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,
}
cis_data = cis->cis_data;
- cis_data->max_digital_gain[0] = 0x100;
- cis_data->max_digital_gain[1] = 1000;
+ cis_data->max_digital_gain[0] = 0x3FFF;
+ cis_data->max_digital_gain[1] = 16000;
*max_dgain = cis_data->max_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,
return ret;
}
+#define REG_1X_BASE_DGAIN_VALUE 1000
+#define REG_1X_BASE_DGAIN 0x0400
+
+u32 sensor_16885c_dgain_to_reg_value(u32 permile)
+{
+ u32 reg_dgain;
+ reg_dgain = permile * REG_1X_BASE_DGAIN / REG_1X_BASE_DGAIN_VALUE;
+
+ return reg_dgain;
+}
+
int sensor_16885c_cis_set_digital_gain(struct v4l2_subdev *subdev, struct ae_param *dgain)
{
int ret = 0;
u16 long_gain = 0;
u16 short_gain = 0;
+ u8 reg_short_gain[2] = {0};
#ifdef DEBUG_SENSOR_TIME
struct timeval st, end;
cis_data = cis->cis_data;
- long_gain = (u16)sensor_cis_calc_dgain_code(dgain->long_val);
- short_gain = (u16)sensor_cis_calc_dgain_code(dgain->short_val);
+ long_gain = (u16)sensor_16885c_dgain_to_reg_value(dgain->long_val);
+ short_gain = (u16)sensor_16885c_dgain_to_reg_value(dgain->short_val);
if (long_gain < cis->cis_data->min_digital_gain[0])
long_gain = cis->cis_data->min_digital_gain[0];
if (short_gain > cis->cis_data->max_digital_gain[0])
short_gain = cis->cis_data->max_digital_gain[0];
+ reg_short_gain[0] = (short_gain & 0x3FFF) >> 8;
+ reg_short_gain[1] = (short_gain & 0xFF);
+ fimc_is_sensor_write8(client, 0x3676, reg_short_gain[0]);
+ fimc_is_sensor_write8(client, 0x3677, reg_short_gain[1]);
+
dbg_sensor(1, "[MOD:D:%d] %s(vsync cnt = %d), input_dgain = %d/%d us, long_gain(%#x), short_gain(%#x)\n",
cis->id, __func__, cis->cis_data->sen_vsync_count, dgain->long_val,
dgain->short_val, long_gain, short_gain);
}
cis_data = cis->cis_data;
- cis_data->min_digital_gain[0] = 0x100;
- cis_data->min_digital_gain[1] = 1000;
+ cis_data->min_digital_gain[0] = REG_1X_BASE_DGAIN;
+ cis_data->min_digital_gain[1] = REG_1X_BASE_DGAIN_VALUE;
*min_dgain = cis_data->min_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,
}
cis_data = cis->cis_data;
- cis_data->max_digital_gain[0] = 0x100;
- cis_data->max_digital_gain[1] = 1000;
+ cis_data->max_digital_gain[0] = 0x3FFF;
+ cis_data->max_digital_gain[1] = 16000;
*max_dgain = cis_data->max_digital_gain[1];
dbg_sensor(1, "[%s] code %d, permile %d\n", __func__,