media: atomisp: Remove custom ATOMISP_IOC_G_SENSOR_MODE_DATA ioctl
This ioctl returns a number of fixed sensor parameters + a number of mode-specific parameters. With libcamera these fixed parameters are instead stored in a table with sensor-name to parameters mappings (camera_sensor_properties.cpp); and the variable parameters can be derived from the set fmt. So this custom ioctl is not necessary; and it currently has no users. Remove the ioctl and all the sensor drivers xxxx_get_intg_factor() helpers which return this info. This is part of a patch-series which tries to remove atomisp specific / custom code from the sensor drivers, with as end goal to make the atomisp drivers regular camera sensor drivers. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
8b3332b278
commit
7f04875057
|
@ -259,140 +259,6 @@ static int gc0310_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gc0310_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct gc0310_resolution *res)
|
||||
{
|
||||
struct v4l2_subdev *sd = i2c_get_clientdata(client);
|
||||
struct gc0310_device *dev = to_gc0310_sensor(sd);
|
||||
struct atomisp_sensor_mode_data *buf = &info->data;
|
||||
u16 val;
|
||||
u8 reg_val;
|
||||
int ret;
|
||||
unsigned int hori_blanking;
|
||||
unsigned int vert_blanking;
|
||||
unsigned int sh_delay;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
/* pixel clock calculattion */
|
||||
dev->vt_pix_clk_freq_mhz = 14400000; // 16.8MHz
|
||||
buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz;
|
||||
dev_dbg(&client->dev, "vt_pix_clk_freq_mhz=%d\n", buf->vt_pix_clk_freq_mhz);
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = GC0310_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
GC0310_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = GC0310_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
GC0310_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = GC0310_FINE_INTG_TIME_MIN;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
/* Getting crop_horizontal_start */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_CROP_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_CROP_START_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_start = val | (reg_val & 0xFF);
|
||||
dev_dbg(&client->dev, "crop_horizontal_start=%d\n", buf->crop_horizontal_start);
|
||||
|
||||
/* Getting crop_vertical_start */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_CROP_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_CROP_START_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_start = val | (reg_val & 0xFF);
|
||||
dev_dbg(&client->dev, "crop_vertical_start=%d\n", buf->crop_vertical_start);
|
||||
|
||||
/* Getting output_width */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_OUTSIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_OUTSIZE_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = val | (reg_val & 0xFF);
|
||||
dev_dbg(&client->dev, "output_width=%d\n", buf->output_width);
|
||||
|
||||
/* Getting output_height */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_OUTSIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_OUTSIZE_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = val | (reg_val & 0xFF);
|
||||
dev_dbg(&client->dev, "output_height=%d\n", buf->output_height);
|
||||
|
||||
buf->crop_horizontal_end = buf->crop_horizontal_start + buf->output_width - 1;
|
||||
buf->crop_vertical_end = buf->crop_vertical_start + buf->output_height - 1;
|
||||
dev_dbg(&client->dev, "crop_horizontal_end=%d\n", buf->crop_horizontal_end);
|
||||
dev_dbg(&client->dev, "crop_vertical_end=%d\n", buf->crop_vertical_end);
|
||||
|
||||
/* Getting line_length_pck */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_BLANKING_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_H_BLANKING_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
hori_blanking = val | (reg_val & 0xFF);
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_SH_DELAY, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
sh_delay = reg_val;
|
||||
buf->line_length_pck = buf->output_width + hori_blanking + sh_delay + 4;
|
||||
dev_dbg(&client->dev, "hori_blanking=%d sh_delay=%d line_length_pck=%d\n", hori_blanking,
|
||||
sh_delay, buf->line_length_pck);
|
||||
|
||||
/* Getting frame_length_lines */
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_BLANKING_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
val = (reg_val & 0xFF) << 8;
|
||||
ret = gc0310_read_reg(client, GC0310_8BIT,
|
||||
GC0310_V_BLANKING_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
vert_blanking = val | (reg_val & 0xFF);
|
||||
buf->frame_length_lines = buf->output_height + vert_blanking;
|
||||
dev_dbg(&client->dev, "vert_blanking=%d frame_length_lines=%d\n", vert_blanking,
|
||||
buf->frame_length_lines);
|
||||
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
res->bin_factor_x : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
res->bin_factor_y : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
|
||||
|
||||
{
|
||||
|
@ -889,12 +755,6 @@ static int gc0310_set_fmt(struct v4l2_subdev *sd,
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = gc0310_get_intg_factor(client, gc0310_info, dev->res);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "failed to get integration_factor\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
mutex_unlock(&dev->input_lock);
|
||||
return ret;
|
||||
|
|
|
@ -220,114 +220,6 @@ static int gc2235_write_reg_array(struct i2c_client *client,
|
|||
return __gc2235_flush_reg_array(client, &ctrl);
|
||||
}
|
||||
|
||||
static int gc2235_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct gc2235_resolution *res)
|
||||
{
|
||||
struct v4l2_subdev *sd = i2c_get_clientdata(client);
|
||||
struct gc2235_device *dev = to_gc2235_sensor(sd);
|
||||
struct atomisp_sensor_mode_data *buf = &info->data;
|
||||
u16 reg_val, reg_val_h;
|
||||
int ret;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
/* pixel clock calculattion */
|
||||
buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz = 30000000;
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = GC2235_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
GC2235_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = GC2235_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
GC2235_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = GC2235_FINE_INTG_TIME_MIN;
|
||||
buf->frame_length_lines = res->lines_per_frame;
|
||||
buf->line_length_pck = res->pixels_per_line;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_H_CROP_START_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_H_CROP_START_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
buf->crop_horizontal_start = (reg_val_h << 8) | reg_val;
|
||||
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_V_CROP_START_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_V_CROP_START_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
buf->crop_vertical_start = (reg_val_h << 8) | reg_val;
|
||||
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_H_OUTSIZE_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_H_OUTSIZE_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = (reg_val_h << 8) | reg_val;
|
||||
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_V_OUTSIZE_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_V_OUTSIZE_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = (reg_val_h << 8) | reg_val;
|
||||
|
||||
buf->crop_horizontal_end = buf->crop_horizontal_start +
|
||||
buf->output_width - 1;
|
||||
buf->crop_vertical_end = buf->crop_vertical_start +
|
||||
buf->output_height - 1;
|
||||
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_HB_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_HB_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
#if 0
|
||||
u16 dummy = (reg_val_h << 8) | reg_val;
|
||||
#endif
|
||||
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_SH_DELAY_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_SH_DELAY_L, ®_val);
|
||||
|
||||
#if 0
|
||||
buf->line_length_pck = buf->output_width + 16 + dummy +
|
||||
(((u16)reg_val_h << 8) | (u16)reg_val) + 4;
|
||||
#endif
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_VB_H, ®_val_h);
|
||||
ret = gc2235_read_reg(client, GC2235_8BIT,
|
||||
GC2235_VB_L, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
#if 0
|
||||
buf->frame_length_lines = buf->output_height + 32 +
|
||||
(((u16)reg_val_h << 8) | (u16)reg_val);
|
||||
#endif
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
res->bin_factor_x : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
res->bin_factor_y : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long __gc2235_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
|
||||
int gain, int digitgain)
|
||||
|
||||
|
@ -680,11 +572,6 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = gc2235_get_intg_factor(client, gc2235_info,
|
||||
dev->res);
|
||||
if (ret)
|
||||
dev_err(&client->dev, "failed to get integration_factor\n");
|
||||
|
||||
err:
|
||||
mutex_unlock(&dev->input_lock);
|
||||
return ret;
|
||||
|
|
|
@ -612,96 +612,6 @@ static int mt9m114_res2size(struct v4l2_subdev *sd, int *h_size, int *v_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt9m114_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct mt9m114_res_struct *res)
|
||||
{
|
||||
struct atomisp_sensor_mode_data *buf;
|
||||
u32 reg_val;
|
||||
int ret;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
buf = &info->data;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_32BIT,
|
||||
REG_PIXEL_CLK, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->vt_pix_clk_freq_mhz = reg_val;
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = MT9M114_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
MT9M114_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = MT9M114_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
MT9M114_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = MT9M114_FINE_INTG_TIME_MIN;
|
||||
|
||||
buf->frame_length_lines = res->lines_per_frame;
|
||||
buf->line_length_pck = res->pixels_per_line;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_H_START, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_start = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_V_START, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_start = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_H_END, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_end = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_V_END, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_end = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_WIDTH, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_HEIGHT, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_TIMING_HTS, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->line_length_pck = reg_val;
|
||||
|
||||
ret = mt9m114_read_reg(client, MISENSOR_16BIT,
|
||||
REG_TIMING_VTS, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->frame_length_lines = reg_val;
|
||||
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
res->bin_factor_x : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
res->bin_factor_y : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mt9m114_get_fmt(struct v4l2_subdev *sd,
|
||||
struct v4l2_subdev_state *sd_state,
|
||||
struct v4l2_subdev_format *format)
|
||||
|
@ -823,12 +733,6 @@ static int mt9m114_set_fmt(struct v4l2_subdev *sd,
|
|||
mt9m114_res[index].used = false;
|
||||
}
|
||||
}
|
||||
ret = mt9m114_get_intg_factor(c, mt9m114_info,
|
||||
&mt9m114_res[res->res]);
|
||||
if (ret) {
|
||||
dev_err(&c->dev, "failed to get integration_factor\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
* mt9m114 - we don't poll for context switch
|
||||
* because it does not happen with streaming disabled.
|
||||
|
|
|
@ -140,82 +140,6 @@ static int ov2680_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ov2680_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct ov2680_resolution *res)
|
||||
{
|
||||
struct atomisp_sensor_mode_data *buf = &info->data;
|
||||
unsigned int pix_clk_freq_hz;
|
||||
u32 reg_val;
|
||||
int ret;
|
||||
|
||||
dev_dbg(&client->dev, "++++ov2680_get_intg_factor\n");
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
/* pixel clock */
|
||||
pix_clk_freq_hz = res->pix_clk_freq * 1000000;
|
||||
|
||||
buf->vt_pix_clk_freq_mhz = pix_clk_freq_hz;
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = OV2680_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
OV2680_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = OV2680_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
OV2680_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = OV2680_FINE_INTG_TIME_MIN;
|
||||
buf->frame_length_lines = res->lines_per_frame;
|
||||
buf->line_length_pck = res->pixels_per_line;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_HORIZONTAL_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_start = reg_val;
|
||||
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_VERTICAL_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_start = reg_val;
|
||||
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_HORIZONTAL_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_end = reg_val;
|
||||
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_VERTICAL_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_end = reg_val;
|
||||
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_HORIZONTAL_OUTPUT_SIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = reg_val;
|
||||
|
||||
ret = ov2680_read_reg(client, 2,
|
||||
OV2680_VERTICAL_OUTPUT_SIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = reg_val;
|
||||
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
(res->bin_factor_x * 2) : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
(res->bin_factor_y * 2) : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
|
||||
int gain, int digitgain)
|
||||
|
||||
|
@ -818,12 +742,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = ov2680_get_intg_factor(client, ov2680_info, res);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "failed to get integration factor\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* recall flip functions to avoid flip registers
|
||||
* were overridden by default setting
|
||||
|
|
|
@ -261,113 +261,6 @@ static int ov2722_write_reg_array(struct i2c_client *client,
|
|||
return __ov2722_flush_reg_array(client, &ctrl);
|
||||
}
|
||||
|
||||
static int ov2722_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct ov2722_resolution *res)
|
||||
{
|
||||
struct v4l2_subdev *sd = i2c_get_clientdata(client);
|
||||
struct ov2722_device *dev = NULL;
|
||||
struct atomisp_sensor_mode_data *buf = &info->data;
|
||||
const unsigned int ext_clk_freq_hz = 19200000;
|
||||
const unsigned int pll_invariant_div = 10;
|
||||
unsigned int pix_clk_freq_hz;
|
||||
u16 pre_pll_clk_div;
|
||||
u16 pll_multiplier;
|
||||
u16 op_pix_clk_div;
|
||||
u16 reg_val;
|
||||
int ret;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
dev = to_ov2722_sensor(sd);
|
||||
|
||||
/* pixel clock calculattion */
|
||||
ret = ov2722_read_reg(client, OV2722_8BIT,
|
||||
OV2722_SC_CMMN_PLL_CTRL3, &pre_pll_clk_div);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_8BIT,
|
||||
OV2722_SC_CMMN_PLL_MULTIPLIER, &pll_multiplier);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_8BIT,
|
||||
OV2722_SC_CMMN_PLL_DEBUG_OPT, &op_pix_clk_div);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pre_pll_clk_div = (pre_pll_clk_div & 0x70) >> 4;
|
||||
if (!pre_pll_clk_div)
|
||||
return -EINVAL;
|
||||
|
||||
pll_multiplier = pll_multiplier & 0x7f;
|
||||
op_pix_clk_div = op_pix_clk_div & 0x03;
|
||||
pix_clk_freq_hz = ext_clk_freq_hz / pre_pll_clk_div * pll_multiplier
|
||||
* op_pix_clk_div / pll_invariant_div;
|
||||
|
||||
dev->vt_pix_clk_freq_mhz = pix_clk_freq_hz;
|
||||
buf->vt_pix_clk_freq_mhz = pix_clk_freq_hz;
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = OV2722_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
OV2722_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = OV2722_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
OV2722_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = OV2722_FINE_INTG_TIME_MIN;
|
||||
buf->frame_length_lines = res->lines_per_frame;
|
||||
buf->line_length_pck = res->pixels_per_line;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_H_CROP_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_start = reg_val;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_V_CROP_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_start = reg_val;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_H_CROP_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_end = reg_val;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_V_CROP_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_end = reg_val;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_H_OUTSIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = reg_val;
|
||||
|
||||
ret = ov2722_read_reg(client, OV2722_16BIT,
|
||||
OV2722_V_OUTSIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = reg_val;
|
||||
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
res->bin_factor_x : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
res->bin_factor_y : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long __ov2722_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
|
||||
int gain, int digitgain)
|
||||
|
||||
|
@ -812,10 +705,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd,
|
|||
}
|
||||
}
|
||||
|
||||
ret = ov2722_get_intg_factor(client, ov2722_info, dev->res);
|
||||
if (ret)
|
||||
dev_err(&client->dev, "failed to get integration_factor\n");
|
||||
|
||||
err:
|
||||
mutex_unlock(&dev->input_lock);
|
||||
return ret;
|
||||
|
|
|
@ -146,7 +146,6 @@ struct gc0310_device {
|
|||
struct v4l2_ctrl_handler ctrl_handler;
|
||||
|
||||
struct camera_sensor_platform_data *platform_data;
|
||||
int vt_pix_clk_freq_mhz;
|
||||
struct gc0310_resolution *res;
|
||||
u8 type;
|
||||
bool power_on;
|
||||
|
|
|
@ -158,7 +158,6 @@ struct gc2235_device {
|
|||
struct gc2235_resolution *res;
|
||||
|
||||
struct camera_sensor_platform_data *platform_data;
|
||||
int vt_pix_clk_freq_mhz;
|
||||
u8 type;
|
||||
};
|
||||
|
||||
|
|
|
@ -201,7 +201,6 @@ struct ov2722_device {
|
|||
struct ov2722_resolution *res;
|
||||
|
||||
struct camera_sensor_platform_data *platform_data;
|
||||
int vt_pix_clk_freq_mhz;
|
||||
int run_mode;
|
||||
u16 pixels_per_line;
|
||||
u16 lines_per_frame;
|
||||
|
|
|
@ -433,84 +433,6 @@ static int ov5693_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ov5693_get_intg_factor(struct i2c_client *client,
|
||||
struct camera_mipi_info *info,
|
||||
const struct ov5693_resolution *res)
|
||||
{
|
||||
struct v4l2_subdev *sd = i2c_get_clientdata(client);
|
||||
struct ov5693_device *dev = to_ov5693_sensor(sd);
|
||||
struct atomisp_sensor_mode_data *buf = &info->data;
|
||||
unsigned int pix_clk_freq_hz;
|
||||
u16 reg_val;
|
||||
int ret;
|
||||
|
||||
if (!info)
|
||||
return -EINVAL;
|
||||
|
||||
/* pixel clock */
|
||||
pix_clk_freq_hz = res->pix_clk_freq * 1000000;
|
||||
|
||||
dev->vt_pix_clk_freq_mhz = pix_clk_freq_hz;
|
||||
buf->vt_pix_clk_freq_mhz = pix_clk_freq_hz;
|
||||
|
||||
/* get integration time */
|
||||
buf->coarse_integration_time_min = OV5693_COARSE_INTG_TIME_MIN;
|
||||
buf->coarse_integration_time_max_margin =
|
||||
OV5693_COARSE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_min = OV5693_FINE_INTG_TIME_MIN;
|
||||
buf->fine_integration_time_max_margin =
|
||||
OV5693_FINE_INTG_TIME_MAX_MARGIN;
|
||||
|
||||
buf->fine_integration_time_def = OV5693_FINE_INTG_TIME_MIN;
|
||||
buf->frame_length_lines = res->lines_per_frame;
|
||||
buf->line_length_pck = res->pixels_per_line;
|
||||
buf->read_mode = res->bin_mode;
|
||||
|
||||
/* get the cropping and output resolution to ISP for this mode. */
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_HORIZONTAL_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_start = reg_val;
|
||||
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_VERTICAL_START_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_start = reg_val;
|
||||
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_HORIZONTAL_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_horizontal_end = reg_val;
|
||||
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_VERTICAL_END_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->crop_vertical_end = reg_val;
|
||||
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_HORIZONTAL_OUTPUT_SIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_width = reg_val;
|
||||
|
||||
ret = ov5693_read_reg(client, OV5693_16BIT,
|
||||
OV5693_VERTICAL_OUTPUT_SIZE_H, ®_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
buf->output_height = reg_val;
|
||||
|
||||
buf->binning_factor_x = res->bin_factor_x ?
|
||||
res->bin_factor_x : 1;
|
||||
buf->binning_factor_y = res->bin_factor_y ?
|
||||
res->bin_factor_y : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long __ov5693_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
|
||||
int gain, int digitgain)
|
||||
|
||||
|
@ -1596,18 +1518,10 @@ static int ov5693_set_fmt(struct v4l2_subdev *sd,
|
|||
if (ret)
|
||||
dev_warn(&client->dev, "ov5693 stream off err\n");
|
||||
|
||||
ret = ov5693_get_intg_factor(client, ov5693_info,
|
||||
&ov5693_res[dev->fmt_idx]);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "failed to get integration_factor\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ov5693_info->metadata_width = fmt->width * 10 / 8;
|
||||
ov5693_info->metadata_height = 1;
|
||||
ov5693_info->metadata_effective_width = &ov5693_embedded_effective_size;
|
||||
|
||||
err:
|
||||
mutex_unlock(&dev->input_lock);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,6 @@ struct ov5693_device {
|
|||
|
||||
struct camera_sensor_platform_data *platform_data;
|
||||
ktime_t timestamp_t_focus_abs;
|
||||
int vt_pix_clk_freq_mhz;
|
||||
int fmt_idx;
|
||||
int run_mode;
|
||||
int otp_size;
|
||||
|
|
|
@ -636,28 +636,6 @@ struct atomisp_overlay {
|
|||
unsigned int overlay_start_y;
|
||||
};
|
||||
|
||||
/* Sensor resolution specific data for AE calculation.*/
|
||||
struct atomisp_sensor_mode_data {
|
||||
unsigned int coarse_integration_time_min;
|
||||
unsigned int coarse_integration_time_max_margin;
|
||||
unsigned int fine_integration_time_min;
|
||||
unsigned int fine_integration_time_max_margin;
|
||||
unsigned int fine_integration_time_def;
|
||||
unsigned int frame_length_lines;
|
||||
unsigned int line_length_pck;
|
||||
unsigned int read_mode;
|
||||
unsigned int vt_pix_clk_freq_mhz;
|
||||
unsigned int crop_horizontal_start; /* Sensor crop start cord. (x0,y0)*/
|
||||
unsigned int crop_vertical_start;
|
||||
unsigned int crop_horizontal_end; /* Sensor crop end cord. (x1,y1)*/
|
||||
unsigned int crop_vertical_end;
|
||||
unsigned int output_width; /* input size to ISP after binning/scaling */
|
||||
unsigned int output_height;
|
||||
u8 binning_factor_x; /* horizontal binning factor used */
|
||||
u8 binning_factor_y; /* vertical binning factor used */
|
||||
u16 hts;
|
||||
};
|
||||
|
||||
struct atomisp_exposure {
|
||||
unsigned int integration_time[8];
|
||||
unsigned int shutter_speed[8];
|
||||
|
@ -945,10 +923,6 @@ struct atomisp_sensor_ae_bracketing_lut {
|
|||
#define ATOMISP_IOC_CAMERA_BRIDGE \
|
||||
_IOWR('v', BASE_VIDIOC_PRIVATE + 19, struct atomisp_bc_video_package)
|
||||
|
||||
/* Sensor resolution specific info for AE */
|
||||
#define ATOMISP_IOC_G_SENSOR_MODE_DATA \
|
||||
_IOR('v', BASE_VIDIOC_PRIVATE + 20, struct atomisp_sensor_mode_data)
|
||||
|
||||
#define ATOMISP_IOC_S_EXPOSURE \
|
||||
_IOW('v', BASE_VIDIOC_PRIVATE + 21, struct atomisp_exposure)
|
||||
|
||||
|
|
|
@ -210,7 +210,6 @@ struct camera_mipi_info {
|
|||
unsigned int num_lanes;
|
||||
enum atomisp_input_format input_format;
|
||||
enum atomisp_bayer_order raw_bayer_order;
|
||||
struct atomisp_sensor_mode_data data;
|
||||
enum atomisp_input_format metadata_format;
|
||||
u32 metadata_width;
|
||||
u32 metadata_height;
|
||||
|
|
|
@ -36,12 +36,6 @@ a camera_mipi_info struct. This struct is allocated/managed by
|
|||
the core atomisp code. The most important parts of the struct
|
||||
are filled by the atomisp core itself, like e.g. the port number.
|
||||
|
||||
The sensor drivers on a set_fmt call do fill in camera_mipi_info.data
|
||||
which is a atomisp_sensor_mode_data struct. This gets filled from
|
||||
a function called <sensor_name>_get_intg_factor(). This struct is not
|
||||
used by the atomisp code at all. It is returned to userspace by
|
||||
a ATOMISP_IOC_G_SENSOR_MODE_DATA and the Android userspace does use this.
|
||||
|
||||
Other members of camera_mipi_info which are set by some drivers are:
|
||||
-metadata_width, metadata_height, metadata_effective_width, set by
|
||||
the ov5693 driver (and used by the atomisp core)
|
||||
|
|
|
@ -4212,25 +4212,6 @@ int atomisp_digital_zoom(struct atomisp_sub_device *asd, int flag,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function to get sensor specific info for current resolution,
|
||||
* which will be used for auto exposure conversion.
|
||||
*/
|
||||
int atomisp_get_sensor_mode_data(struct atomisp_sub_device *asd,
|
||||
struct atomisp_sensor_mode_data *config)
|
||||
{
|
||||
struct camera_mipi_info *mipi_info;
|
||||
struct atomisp_device *isp = asd->isp;
|
||||
|
||||
mipi_info = atomisp_to_sensor_mipi_info(
|
||||
isp->inputs[asd->input_curr].camera);
|
||||
if (!mipi_info)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(config, &mipi_info->data, sizeof(*config));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __atomisp_update_stream_env(struct atomisp_sub_device *asd,
|
||||
u16 stream_index, struct atomisp_input_stream_info *stream_info)
|
||||
{
|
||||
|
|
|
@ -259,9 +259,6 @@ int atomisp_makeup_css_parameters(struct atomisp_sub_device *asd,
|
|||
int atomisp_compare_grid(struct atomisp_sub_device *asd,
|
||||
struct atomisp_grid_info *atomgrid);
|
||||
|
||||
int atomisp_get_sensor_mode_data(struct atomisp_sub_device *asd,
|
||||
struct atomisp_sensor_mode_data *config);
|
||||
|
||||
/* This function looks up the closest available resolution. */
|
||||
int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
|
||||
bool *res_overflow);
|
||||
|
|
|
@ -2282,10 +2282,6 @@ static long atomisp_vidioc_default(struct file *file, void *fh,
|
|||
err = atomisp_fixed_pattern_table(asd, arg);
|
||||
break;
|
||||
|
||||
case ATOMISP_IOC_G_SENSOR_MODE_DATA:
|
||||
err = atomisp_get_sensor_mode_data(asd, arg);
|
||||
break;
|
||||
|
||||
case ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA:
|
||||
if (motor)
|
||||
err = v4l2_subdev_call(motor, core, ioctl, cmd, arg);
|
||||
|
|
Loading…
Reference in New Issue