media: atomisp: Remove V4L2_CID_BIN_FACTOR_HORZ/_VERT
authorHans de Goede <hdegoede@redhat.com>
Mon, 12 Dec 2022 21:32:22 +0000 (22:32 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 8 Feb 2023 07:01:53 +0000 (08:01 +0100)
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: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
drivers/staging/media/atomisp/include/linux/atomisp.h
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_subdev.c

index 4968ec51ff1be72a2baf2792397c89620834dbc0..0d90683ed227d82a6f204ece872b7a0dbe837684 100644 (file)
@@ -241,24 +241,6 @@ static int gc0310_write_reg_array(struct i2c_client *client,
        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)
 
 {
@@ -441,12 +423,6 @@ static int gc0310_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_EXPOSURE_ABSOLUTE:
                ret = gc0310_q_exposure(&dev->sd, &ctrl->val);
                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:
                ret = -EINVAL;
        }
@@ -491,28 +467,6 @@ static const struct v4l2_ctrl_config gc0310_controls[] = {
                .step = 1,
                .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)
index 1df38f5fe1f4eb33a8e0ca5efb61aa1b2981bb59..0e5a981dd331c6d7dcc662872f4bf4ef3b362290 100644 (file)
@@ -1016,24 +1016,6 @@ static int mt9m114_s_exposure_selection(struct v4l2_subdev *sd,
        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)
 {
        struct i2c_client *c = v4l2_get_subdevdata(sd);
@@ -1159,12 +1141,6 @@ static int mt9m114_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_EXPOSURE_ZONE_NUM:
                ret = mt9m114_g_exposure_zone_num(&dev->sd, &ctrl->val);
                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:
                ret = mt9m114_g_ev(&dev->sd, &ctrl->val);
                break;
@@ -1237,28 +1213,6 @@ static struct v4l2_ctrl_config mt9m114_controls[] = {
                .def = 1,
                .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,
                .id = V4L2_CID_EXPOSURE,
index 9379c25205b4d6f81e72085eae54bdb7b2168267..88fdeb828c6c96e724fae0f5ff0716c2036695cb 100644 (file)
@@ -119,27 +119,6 @@ static int ov2680_write_reg_array(struct i2c_client *client,
        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,
                                  int gain, int digitgain)
 
@@ -419,12 +398,6 @@ static int ov2680_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_EXPOSURE_ABSOLUTE:
                ret = ov2680_q_exposure(&dev->sd, &ctrl->val);
                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:
                ret = -EINVAL;
        }
@@ -449,28 +422,6 @@ static const struct v4l2_ctrl_config ov2680_controls[] = {
                .def = 0x00,
                .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,
                .id = V4L2_CID_VFLIP,
index e65759499d81aeb7fac614b973de73714fb2201e..da8c3b1d3bcd8a0bdfc88b8ea17ab0f115fe98ca 100644 (file)
@@ -415,24 +415,6 @@ static int ov5693_write_reg_array(struct i2c_client *client,
        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,
                                  int gain, int digitgain)
 
@@ -1014,12 +996,6 @@ static int ov5693_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_FOCUS_STATUS:
                ret = ov5693_q_focus_status(&dev->sd, &ctrl->val);
                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:
                ret = -EINVAL;
        }
@@ -1099,28 +1075,6 @@ static const struct v4l2_ctrl_config ov5693_controls[] = {
                .def = 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)
index d6da776e9bf4aea767c1be31d1de7fb10393d186..63b1bcd35399bc82611f56ccd3a41853534501b0 100644 (file)
@@ -1071,10 +1071,6 @@ struct atomisp_sensor_ae_bracketing_lut {
 /* Query Focus Status */
 #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 */
 #define V4L2_CID_G_SKIP_FRAMES            (V4L2_CID_CAMERA_LASTP1 + 17)
 
index 1e1464abf32bfe281a31896aef60e280ce9d204f..b7872d7ac0c30df9064f82bd4b46ee732428d75f 100644 (file)
@@ -172,24 +172,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = {
                .step = 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,
                .type = V4L2_CTRL_TYPE_BITMASK,
@@ -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_AUTO:
                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_TEST_PATTERN:
                case V4L2_CID_TEST_PATTERN_COLOR_R:
index cadc468b4c2f62eda9751b88dd4c6eeefa91db01..fc9e07bf63ae12cb92023dce24e3e2a194d5fdf4 100644 (file)
@@ -574,40 +574,6 @@ static int isp_subdev_set_selection(struct v4l2_subdev *sd,
                                            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,
                             struct v4l2_subdev_state *sd_state,
                             uint32_t which,
@@ -645,7 +611,7 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd,
                                                         ATOMISP_INPUT_STREAM_GENERAL, ffmt);
                        atomisp_css_input_set_binning_factor(isp_sd,
                                                             ATOMISP_INPUT_STREAM_GENERAL,
-                                                            atomisp_get_sensor_bin_factor(isp_sd));
+                                                            0);
                        atomisp_css_input_set_bayer_order(isp_sd, ATOMISP_INPUT_STREAM_GENERAL,
                                                          fc->bayer_order);
                        atomisp_css_input_set_format(isp_sd, ATOMISP_INPUT_STREAM_GENERAL,