Commit 159a61da authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Remove V4L2_CID_BIN_FACTOR_HORZ/_VERT

The bin-factor-x and bin-factor-y ctrls are only used internally to
get a single value to pass to atomisp_css_input_set_binning_factor(),
which is supposed to tune the lens-shading correction for the binning
factor. But all sensor drivers return either 0 or 1 for this,
with 0 meaning unset and 1 meaning no-binning. Even though some modes
do actually do binning ...

Also note that the removed atomisp_get_sensor_bin_factor() would fall
back to 0 if either the x and y factor differ or if the ctrls are not
implemented (not all sensor drivers implement them).

Simply always pass 0 to atomisp_css_input_set_binning_factor().

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: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 7f048750
...@@ -241,24 +241,6 @@ static int gc0310_write_reg_array(struct i2c_client *client, ...@@ -241,24 +241,6 @@ static int gc0310_write_reg_array(struct i2c_client *client,
return __gc0310_flush_reg_array(client, &ctrl); return __gc0310_flush_reg_array(client, &ctrl);
} }
static int gc0310_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val)
{
struct gc0310_device *dev = to_gc0310_sensor(sd);
*val = dev->res->bin_factor_x;
return 0;
}
static int gc0310_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
{
struct gc0310_device *dev = to_gc0310_sensor(sd);
*val = dev->res->bin_factor_y;
return 0;
}
static int gc0310_set_gain(struct v4l2_subdev *sd, int gain) static int gc0310_set_gain(struct v4l2_subdev *sd, int gain)
{ {
...@@ -441,12 +423,6 @@ static int gc0310_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ...@@ -441,12 +423,6 @@ static int gc0310_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_EXPOSURE_ABSOLUTE: case V4L2_CID_EXPOSURE_ABSOLUTE:
ret = gc0310_q_exposure(&dev->sd, &ctrl->val); ret = gc0310_q_exposure(&dev->sd, &ctrl->val);
break; break;
case V4L2_CID_BIN_FACTOR_HORZ:
ret = gc0310_g_bin_factor_x(&dev->sd, &ctrl->val);
break;
case V4L2_CID_BIN_FACTOR_VERT:
ret = gc0310_g_bin_factor_y(&dev->sd, &ctrl->val);
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -491,28 +467,6 @@ static const struct v4l2_ctrl_config gc0310_controls[] = { ...@@ -491,28 +467,6 @@ static const struct v4l2_ctrl_config gc0310_controls[] = {
.step = 1, .step = 1,
.def = 0, .def = 0,
}, },
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_HORZ,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "horizontal binning factor",
.min = 0,
.max = GC0310_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_VERT,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "vertical binning factor",
.min = 0,
.max = GC0310_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
}; };
static int gc0310_init(struct v4l2_subdev *sd) static int gc0310_init(struct v4l2_subdev *sd)
......
...@@ -1016,24 +1016,6 @@ static int mt9m114_s_exposure_selection(struct v4l2_subdev *sd, ...@@ -1016,24 +1016,6 @@ static int mt9m114_s_exposure_selection(struct v4l2_subdev *sd,
return 0; return 0;
} }
static int mt9m114_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val)
{
struct mt9m114_device *dev = to_mt9m114_sensor(sd);
*val = mt9m114_res[dev->res].bin_factor_x;
return 0;
}
static int mt9m114_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
{
struct mt9m114_device *dev = to_mt9m114_sensor(sd);
*val = mt9m114_res[dev->res].bin_factor_y;
return 0;
}
static int mt9m114_s_ev(struct v4l2_subdev *sd, s32 val) static int mt9m114_s_ev(struct v4l2_subdev *sd, s32 val)
{ {
struct i2c_client *c = v4l2_get_subdevdata(sd); struct i2c_client *c = v4l2_get_subdevdata(sd);
...@@ -1159,12 +1141,6 @@ static int mt9m114_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1159,12 +1141,6 @@ static int mt9m114_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_EXPOSURE_ZONE_NUM: case V4L2_CID_EXPOSURE_ZONE_NUM:
ret = mt9m114_g_exposure_zone_num(&dev->sd, &ctrl->val); ret = mt9m114_g_exposure_zone_num(&dev->sd, &ctrl->val);
break; break;
case V4L2_CID_BIN_FACTOR_HORZ:
ret = mt9m114_g_bin_factor_x(&dev->sd, &ctrl->val);
break;
case V4L2_CID_BIN_FACTOR_VERT:
ret = mt9m114_g_bin_factor_y(&dev->sd, &ctrl->val);
break;
case V4L2_CID_EXPOSURE: case V4L2_CID_EXPOSURE:
ret = mt9m114_g_ev(&dev->sd, &ctrl->val); ret = mt9m114_g_ev(&dev->sd, &ctrl->val);
break; break;
...@@ -1237,28 +1213,6 @@ static struct v4l2_ctrl_config mt9m114_controls[] = { ...@@ -1237,28 +1213,6 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
.def = 1, .def = 1,
.flags = 0, .flags = 0,
}, },
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_HORZ,
.name = "horizontal binning factor",
.type = V4L2_CTRL_TYPE_INTEGER,
.min = 0,
.max = MT9M114_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_VERT,
.name = "vertical binning factor",
.type = V4L2_CTRL_TYPE_INTEGER,
.min = 0,
.max = MT9M114_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{ {
.ops = &ctrl_ops, .ops = &ctrl_ops,
.id = V4L2_CID_EXPOSURE, .id = V4L2_CID_EXPOSURE,
......
...@@ -119,27 +119,6 @@ static int ov2680_write_reg_array(struct i2c_client *client, ...@@ -119,27 +119,6 @@ static int ov2680_write_reg_array(struct i2c_client *client,
return 0; return 0;
} }
static int ov2680_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val)
{
struct ov2680_device *dev = to_ov2680_sensor(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
dev_dbg(&client->dev, "++++ov2680_g_bin_factor_x\n");
*val = dev->res->bin_factor_x;
return 0;
}
static int ov2680_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
{
struct ov2680_device *dev = to_ov2680_sensor(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
*val = dev->res->bin_factor_y;
dev_dbg(&client->dev, "++++ov2680_g_bin_factor_y\n");
return 0;
}
static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg, static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
int gain, int digitgain) int gain, int digitgain)
...@@ -419,12 +398,6 @@ static int ov2680_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ...@@ -419,12 +398,6 @@ static int ov2680_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_EXPOSURE_ABSOLUTE: case V4L2_CID_EXPOSURE_ABSOLUTE:
ret = ov2680_q_exposure(&dev->sd, &ctrl->val); ret = ov2680_q_exposure(&dev->sd, &ctrl->val);
break; break;
case V4L2_CID_BIN_FACTOR_HORZ:
ret = ov2680_g_bin_factor_x(&dev->sd, &ctrl->val);
break;
case V4L2_CID_BIN_FACTOR_VERT:
ret = ov2680_g_bin_factor_y(&dev->sd, &ctrl->val);
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -449,28 +422,6 @@ static const struct v4l2_ctrl_config ov2680_controls[] = { ...@@ -449,28 +422,6 @@ static const struct v4l2_ctrl_config ov2680_controls[] = {
.def = 0x00, .def = 0x00,
.flags = 0, .flags = 0,
}, },
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_HORZ,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "horizontal binning factor",
.min = 0,
.max = OV2680_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_VERT,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "vertical binning factor",
.min = 0,
.max = OV2680_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{ {
.ops = &ctrl_ops, .ops = &ctrl_ops,
.id = V4L2_CID_VFLIP, .id = V4L2_CID_VFLIP,
......
...@@ -415,24 +415,6 @@ static int ov5693_write_reg_array(struct i2c_client *client, ...@@ -415,24 +415,6 @@ static int ov5693_write_reg_array(struct i2c_client *client,
return __ov5693_flush_reg_array(client, &ctrl); return __ov5693_flush_reg_array(client, &ctrl);
} }
static int ov5693_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val)
{
struct ov5693_device *dev = to_ov5693_sensor(sd);
*val = ov5693_res[dev->fmt_idx].bin_factor_x;
return 0;
}
static int ov5693_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val)
{
struct ov5693_device *dev = to_ov5693_sensor(sd);
*val = ov5693_res[dev->fmt_idx].bin_factor_y;
return 0;
}
static long __ov5693_set_exposure(struct v4l2_subdev *sd, int coarse_itg, static long __ov5693_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
int gain, int digitgain) int gain, int digitgain)
...@@ -1014,12 +996,6 @@ static int ov5693_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1014,12 +996,6 @@ static int ov5693_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_FOCUS_STATUS: case V4L2_CID_FOCUS_STATUS:
ret = ov5693_q_focus_status(&dev->sd, &ctrl->val); ret = ov5693_q_focus_status(&dev->sd, &ctrl->val);
break; break;
case V4L2_CID_BIN_FACTOR_HORZ:
ret = ov5693_g_bin_factor_x(&dev->sd, &ctrl->val);
break;
case V4L2_CID_BIN_FACTOR_VERT:
ret = ov5693_g_bin_factor_y(&dev->sd, &ctrl->val);
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -1099,28 +1075,6 @@ static const struct v4l2_ctrl_config ov5693_controls[] = { ...@@ -1099,28 +1075,6 @@ static const struct v4l2_ctrl_config ov5693_controls[] = {
.def = 0, .def = 0,
.flags = 0, .flags = 0,
}, },
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_HORZ,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "horizontal binning factor",
.min = 0,
.max = OV5693_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
{
.ops = &ctrl_ops,
.id = V4L2_CID_BIN_FACTOR_VERT,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "vertical binning factor",
.min = 0,
.max = OV5693_BIN_FACTOR_MAX,
.step = 1,
.def = 0,
.flags = 0,
},
}; };
static int ov5693_init(struct v4l2_subdev *sd) static int ov5693_init(struct v4l2_subdev *sd)
......
...@@ -1071,10 +1071,6 @@ struct atomisp_sensor_ae_bracketing_lut { ...@@ -1071,10 +1071,6 @@ struct atomisp_sensor_ae_bracketing_lut {
/* Query Focus Status */ /* Query Focus Status */
#define V4L2_CID_FOCUS_STATUS (V4L2_CID_CAMERA_LASTP1 + 14) #define V4L2_CID_FOCUS_STATUS (V4L2_CID_CAMERA_LASTP1 + 14)
/* Query sensor's binning factor */
#define V4L2_CID_BIN_FACTOR_HORZ (V4L2_CID_CAMERA_LASTP1 + 15)
#define V4L2_CID_BIN_FACTOR_VERT (V4L2_CID_CAMERA_LASTP1 + 16)
/* number of frames to skip at stream start */ /* number of frames to skip at stream start */
#define V4L2_CID_G_SKIP_FRAMES (V4L2_CID_CAMERA_LASTP1 + 17) #define V4L2_CID_G_SKIP_FRAMES (V4L2_CID_CAMERA_LASTP1 + 17)
......
...@@ -172,24 +172,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = { ...@@ -172,24 +172,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = {
.step = 1, .step = 1,
.default_value = 1, .default_value = 1,
}, },
{
.id = V4L2_CID_BIN_FACTOR_HORZ,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Horizontal binning factor",
.minimum = 0,
.maximum = 10,
.step = 1,
.default_value = 0,
},
{
.id = V4L2_CID_BIN_FACTOR_VERT,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Vertical binning factor",
.minimum = 0,
.maximum = 10,
.step = 1,
.default_value = 0,
},
{ {
.id = V4L2_CID_2A_STATUS, .id = V4L2_CID_2A_STATUS,
.type = V4L2_CTRL_TYPE_BITMASK, .type = V4L2_CTRL_TYPE_BITMASK,
...@@ -1836,8 +1818,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, ...@@ -1836,8 +1818,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,
case V4L2_CID_EXPOSURE_ABSOLUTE: case V4L2_CID_EXPOSURE_ABSOLUTE:
case V4L2_CID_EXPOSURE_AUTO: case V4L2_CID_EXPOSURE_AUTO:
case V4L2_CID_IRIS_ABSOLUTE: case V4L2_CID_IRIS_ABSOLUTE:
case V4L2_CID_BIN_FACTOR_HORZ:
case V4L2_CID_BIN_FACTOR_VERT:
case V4L2_CID_3A_LOCK: case V4L2_CID_3A_LOCK:
case V4L2_CID_TEST_PATTERN: case V4L2_CID_TEST_PATTERN:
case V4L2_CID_TEST_PATTERN_COLOR_R: case V4L2_CID_TEST_PATTERN_COLOR_R:
......
...@@ -574,40 +574,6 @@ static int isp_subdev_set_selection(struct v4l2_subdev *sd, ...@@ -574,40 +574,6 @@ static int isp_subdev_set_selection(struct v4l2_subdev *sd,
sel->target, sel->flags, &sel->r); sel->target, sel->flags, &sel->r);
} }
static int atomisp_get_sensor_bin_factor(struct atomisp_sub_device *asd)
{
struct v4l2_control ctrl = {0};
struct atomisp_device *isp = asd->isp;
int hbin, vbin;
int ret;
if (isp->inputs[asd->input_curr].type == FILE_INPUT ||
isp->inputs[asd->input_curr].type == TEST_PATTERN)
return 0;
ctrl.id = V4L2_CID_BIN_FACTOR_HORZ;
ret =
v4l2_g_ctrl(isp->inputs[asd->input_curr].camera->ctrl_handler,
&ctrl);
hbin = ctrl.value;
ctrl.id = V4L2_CID_BIN_FACTOR_VERT;
ret |=
v4l2_g_ctrl(isp->inputs[asd->input_curr].camera->ctrl_handler,
&ctrl);
vbin = ctrl.value;
/*
* ISP needs to know binning factor from sensor.
* In case horizontal and vertical sensor's binning factors
* are different or sensor does not support binning factor CID,
* ISP will apply default 0 value.
*/
if (ret || hbin != vbin)
hbin = 0;
return hbin;
}
void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
uint32_t which, uint32_t which,
...@@ -645,7 +611,7 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, ...@@ -645,7 +611,7 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd,
ATOMISP_INPUT_STREAM_GENERAL, ffmt); ATOMISP_INPUT_STREAM_GENERAL, ffmt);
atomisp_css_input_set_binning_factor(isp_sd, atomisp_css_input_set_binning_factor(isp_sd,
ATOMISP_INPUT_STREAM_GENERAL, ATOMISP_INPUT_STREAM_GENERAL,
atomisp_get_sensor_bin_factor(isp_sd)); 0);
atomisp_css_input_set_bayer_order(isp_sd, ATOMISP_INPUT_STREAM_GENERAL, atomisp_css_input_set_bayer_order(isp_sd, ATOMISP_INPUT_STREAM_GENERAL,
fc->bayer_order); fc->bayer_order);
atomisp_css_input_set_format(isp_sd, ATOMISP_INPUT_STREAM_GENERAL, atomisp_css_input_set_format(isp_sd, ATOMISP_INPUT_STREAM_GENERAL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment