}
line_length_pck = cis_data->line_length_pck;
- numerator = (u64)cis_data->pclk * frame_duration / (1000 * 1000);
- frame_length_lines = (u16)(numerator / line_length_pck);
+ numerator = (u64)cis_data->pclk * frame_duration;
+ frame_length_lines = (u16)((numerator / line_length_pck) / (1000 * 1000));
dbg_sensor(1, "[MOD:D:%d] %s, vt_pic_clk(%#x) frame_duration = %d us,"
KERN_CONT "(line_length_pck%#x), frame_length_lines(%#x)\n",
cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
if (unlikely(!cis)) {
- err("cis is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
cis_data = cis->cis_data;
if (unlikely(!cis_data)) {
- err("cis_data is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis_data is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
client = cis->client;
if (unlikely(!client)) {
- err("client is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("client is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
/*
* Read sensor frame counter (sensor_fcount address = 0x483F)
ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
if (wait_cnt >= time_out_cnt) {
err("[MOD:D:%d] %s, Don't sensor stream on and time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
ret = -EINVAL;
goto p_err;
}
return ret;
}
-
int sensor_12a10_cis_wait_streamoff(struct v4l2_subdev *subdev)
{
- int ret = 0;
- struct fimc_is_cis *cis;
- struct i2c_client *client;
- cis_shared_data *cis_data;
- u32 wait_cnt = 0, time_out_cnt = 250;
- u8 sensor_fcount = 0;
-
- BUG_ON(!subdev);
-
- cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
- cis_data = cis->cis_data;
- client = cis->client;
-
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
-
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
-
- while (sensor_fcount != 0x00) {
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
-
- usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
- wait_cnt++;
-
- if (wait_cnt >= time_out_cnt) {
- err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
- ret = -EINVAL;
- goto p_err;
- }
-
- dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
- cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
- }
+ int ret = 0;
+ struct fimc_is_cis *cis;
+ struct i2c_client *client;
+ cis_shared_data *cis_data;
+ u32 wait_cnt = 0, time_out_cnt = 250;
+ u8 sensor_fcount = 0;
+
+ BUG_ON(!subdev);
+
+ cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
+ cis_data = cis->cis_data;
+ client = cis->client;
+
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+
+ while (sensor_fcount != 0x00) {
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+
+ usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
+ wait_cnt++;
+
+ if (wait_cnt >= time_out_cnt) {
+ err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ ret = -EINVAL;
+ goto p_err;
+ }
+
+ dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
+ cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
+ }
p_err:
- return ret;
+ return ret;
}
static int sensor_12a10_cis_set_dual_slave_setting(struct fimc_is_cis *cis)
}
/* Short exposure */
- short_coarse_val[0] = (short_coarse_int & 0xF000) >> 12;
- short_coarse_val[1] = (short_coarse_int & 0x0FF0) >> 4;
- short_coarse_val[2] = (short_coarse_int & 0x000F) << 4;
+ short_coarse_val[0] = (u8)((short_coarse_int & 0xF000) >> 12);
+ short_coarse_val[1] = (u8)((short_coarse_int & 0x0FF0) >> 4);
+ short_coarse_val[2] = (u8)((short_coarse_int & 0x000F) << 4);
ret = fimc_is_sensor_write8_array(client, 0x3500, short_coarse_val, 3);
if (ret < 0)
goto p_err;
cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
if (unlikely(!cis)) {
- err("cis is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
cis_data = cis->cis_data;
if (unlikely(!cis_data)) {
- err("cis_data is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis_data is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
client = cis->client;
if (unlikely(!client)) {
- err("client is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("client is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
/*
* Read sensor frame counter (sensor_fcount address = 0x0005)
ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
if (wait_cnt >= time_out_cnt) {
err("[MOD:D:%d] %s, Don't sensor stream on and time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
ret = -EINVAL;
goto p_err;
}
int sensor_12a10ff_cis_wait_streamoff(struct v4l2_subdev *subdev)
{
- int ret = 0;
- struct fimc_is_cis *cis;
- struct i2c_client *client;
- cis_shared_data *cis_data;
- u32 wait_cnt = 0, time_out_cnt = 250;
- u8 sensor_fcount = 0;
-
- BUG_ON(!subdev);
-
- cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
- cis_data = cis->cis_data;
- client = cis->client;
-
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
-
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
-
- while (sensor_fcount != 0x00) {
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
-
- usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
- wait_cnt++;
-
- if (wait_cnt >= time_out_cnt) {
- err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
- ret = -EINVAL;
- goto p_err;
- }
-
- dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
- cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
- }
+ int ret = 0;
+ struct fimc_is_cis *cis;
+ struct i2c_client *client;
+ cis_shared_data *cis_data;
+ u32 wait_cnt = 0, time_out_cnt = 250;
+ u8 sensor_fcount = 0;
+
+ BUG_ON(!subdev);
+
+ cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
+ cis_data = cis->cis_data;
+ client = cis->client;
+
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+
+ while (sensor_fcount != 0x00) {
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x483F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x483F, sensor_fcount, ret);
+
+ usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
+ wait_cnt++;
+
+ if (wait_cnt >= time_out_cnt) {
+ err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ ret = -EINVAL;
+ goto p_err;
+ }
+
+ dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
+ cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
+ }
p_err:
- return ret;
+ return ret;
}
int sensor_12a10ff_cis_long_term_exposure(struct v4l2_subdev *subdev)
0x3809, 0x20, 0x01,
0x380a, 0x06, 0x01,
0x380b, 0xd8, 0x01,
- 0x380d, 0x78, 0x01,
+ 0x380c, 0x0a, 0x01,
+ 0x380d, 0xf0, 0x01,
0x380e, 0x07, 0x01,
0x380f, 0x70, 0x01,
0x3811, 0x07, 0x01,
0x3809, 0x20, 0x01,
0x380a, 0x06, 0x01,
0x380b, 0xd8, 0x01,
+ 0x380c, 0x05, 0x01,
0x380d, 0x78, 0x01,
0x380e, 0x07, 0x01,
0x380f, 0x70, 0x01,
0x3809, 0x80, 0x01,
0x380a, 0x04, 0x01,
0x380b, 0x38, 0x01,
+ 0x380c, 0x05, 0x01,
0x380d, 0x00, 0x01,
0x380e, 0x04, 0x01,
0x380f, 0x12, 0x01,
EXT_CLK_Mhz * 1000 * 1000, /* ext_clk */
769600000, /* mipi_datarate */
160333333, /* pclk = VT pix CLK (this value is different by cis) */
- 0x0EE0, /* frame_length_lines (0x380e) */
- 0x0578, /* line_length_pck (0x380c) */
+ 0x0770, /* frame_length_lines (0x380e) */
+ 0x0AF0, /* line_length_pck (0x380c) */
};
const struct sensor_pll_info_compact sensor_16885c_pllinfo_A_2336x1752_60fps = {
}
cis_data = cis->cis_data;
- cis_data->min_digital_gain[0] = REG_1X_BASE_DGAIN;
- cis_data->min_digital_gain[1] = REG_1X_BASE_DGAIN_VALUE;
+ 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 = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
if (unlikely(!cis)) {
- err("cis is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
cis_data = cis->cis_data;
if (unlikely(!cis_data)) {
- err("cis_data is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("cis_data is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
client = cis->client;
if (unlikely(!client)) {
- err("client is NULL");
- ret = -EINVAL;
- goto p_err;
+ err("client is NULL");
+ ret = -EINVAL;
+ goto p_err;
}
ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
/*
* Read sensor frame counter (sensor_fcount address = 0x485F)
ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
if (wait_cnt >= time_out_cnt) {
err("[MOD:D:%d] %s, Don't sensor stream on and time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
ret = -EINVAL;
goto p_err;
}
int sensor_16885c_cis_wait_streamoff(struct v4l2_subdev *subdev)
{
- int ret = 0;
- struct fimc_is_cis *cis;
- struct i2c_client *client;
- cis_shared_data *cis_data;
- u32 wait_cnt = 0, time_out_cnt = 250;
- u8 sensor_fcount = 0;
-
- BUG_ON(!subdev);
-
- cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
- cis_data = cis->cis_data;
- client = cis->client;
-
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
-
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
-
- while (sensor_fcount != 0x00) {
- I2C_MUTEX_LOCK(cis->i2c_lock);
- ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
- I2C_MUTEX_UNLOCK(cis->i2c_lock);
- if (ret < 0)
- err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
-
- usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
- wait_cnt++;
-
- if (wait_cnt >= time_out_cnt) {
- err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
- cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
- ret = -EINVAL;
- goto p_err;
- }
-
- dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
- cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
- }
+ int ret = 0;
+ struct fimc_is_cis *cis;
+ struct i2c_client *client;
+ cis_shared_data *cis_data;
+ u32 wait_cnt = 0, time_out_cnt = 250;
+ u8 sensor_fcount = 0;
+
+ BUG_ON(!subdev);
+
+ cis = (struct fimc_is_cis *)v4l2_get_subdevdata(subdev);
+ cis_data = cis->cis_data;
+ client = cis->client;
+
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
+
+ while (sensor_fcount != 0x00) {
+ I2C_MUTEX_LOCK(cis->i2c_lock);
+ ret = fimc_is_sensor_read8(client, 0x485F, &sensor_fcount);
+ I2C_MUTEX_UNLOCK(cis->i2c_lock);
+ if (ret < 0)
+ err("i2c transfer fail addr(%x), val(%x), ret = %d\n", 0x485F, sensor_fcount, ret);
+
+ usleep_range(CIS_STREAM_OFF_WAIT_TIME, CIS_STREAM_OFF_WAIT_TIME);
+ wait_cnt++;
+
+ if (wait_cnt >= time_out_cnt) {
+ err("[MOD:D:%d] %s, time out, wait_limit(%d) > time_out(%d), sensor_fcount(%d)",
+ cis->id, __func__, wait_cnt, time_out_cnt, sensor_fcount);
+ ret = -EINVAL;
+ goto p_err;
+ }
+
+ dbg_sensor(1, "[MOD:D:%d] %s, sensor_fcount(%d), (wait_limit(%d) < time_out(%d))\n",
+ cis->id, __func__, sensor_fcount, wait_cnt, time_out_cnt);
+ }
p_err:
- return ret;
+ return ret;
}
static struct fimc_is_cis_ops cis_ops = {