media: smiapp: Don't get binning limits dynamically
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 1 Oct 2019 11:31:38 +0000 (08:31 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 21:54:57 +0000 (18:54 -0300)
The driver implementation assumed the binning limits could change
dynamically based on the binning configuration. This is not actually the
case; these limits are static and suitable to be used with all binning
configurations but possibly not optimal limit for many of those
configurations.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/smiapp/smiapp-core.c

index ea118e0..b490761 100644 (file)
@@ -682,66 +682,6 @@ static int smiapp_get_all_limits(struct smiapp_sensor *sensor)
        return 0;
 }
 
-static int smiapp_get_limits_binning(struct smiapp_sensor *sensor)
-{
-       struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
-       static u32 const limits[] = {
-               SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN,
-               SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN,
-               SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN,
-               SMIAPP_LIMIT_MAX_LINE_LENGTH_PCK_BIN,
-               SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN,
-               SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN_BIN,
-               SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN_BIN,
-       };
-       static u32 const limits_replace[] = {
-               SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES,
-               SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES,
-               SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK,
-               SMIAPP_LIMIT_MAX_LINE_LENGTH_PCK,
-               SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK,
-               SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN,
-               SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN,
-       };
-       unsigned int i;
-       int rval;
-
-       if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY] ==
-           SMIAPP_BINNING_CAPABILITY_NO) {
-               for (i = 0; i < ARRAY_SIZE(limits); i++)
-                       sensor->limits[limits[i]] =
-                               sensor->limits[limits_replace[i]];
-
-               return 0;
-       }
-
-       rval = smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits));
-       if (rval < 0)
-               return rval;
-
-       /*
-        * Sanity check whether the binning limits are valid. If not,
-        * use the non-binning ones.
-        */
-       if (sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN]
-           && sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN]
-           && sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN])
-               return 0;
-
-       for (i = 0; i < ARRAY_SIZE(limits); i++) {
-               dev_dbg(&client->dev,
-                       "replace limit 0x%8.8x \"%s\" = %d, 0x%x\n",
-                       smiapp_reg_limits[limits[i]].addr,
-                       smiapp_reg_limits[limits[i]].what,
-                       sensor->limits[limits_replace[i]],
-                       sensor->limits[limits_replace[i]]);
-               sensor->limits[limits[i]] =
-                       sensor->limits[limits_replace[i]];
-       }
-
-       return 0;
-}
-
 static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
@@ -940,11 +880,6 @@ static int smiapp_update_mode(struct smiapp_sensor *sensor)
        if (rval < 0)
                return rval;
 
-       /* Get updated limits due to binning */
-       rval = smiapp_get_limits_binning(sensor);
-       if (rval < 0)
-               return rval;
-
        rval = smiapp_pll_update(sensor);
        if (rval < 0)
                return rval;