diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-01-13 16:01:40 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-02-08 08:24:34 +0100 |
commit | f4ed8e3ba64a5cef32846e63c59897354bcb6d50 (patch) | |
tree | 72c1f2116304daf1e2425830b12be394a2c715ce /drivers | |
parent | a6fc86ed57a108cdc5078d93b17bcf56c234f94c (diff) | |
download | linux-f4ed8e3ba64a5cef32846e63c59897354bcb6d50.tar.gz linux-f4ed8e3ba64a5cef32846e63c59897354bcb6d50.tar.bz2 linux-f4ed8e3ba64a5cef32846e63c59897354bcb6d50.zip |
media: atomisp: ov2680: Drop v4l2_find_nearest_size() call from set_fmt()
Since we now calculate timings baded on the desired width and height,
any width and height are valid as long as they don't exceed the sensor's
dimensions.
Drop the v4l2_find_nearest_size() call and instead clamp the requested
width and height.
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index e90a7737a56d..0433d542226f 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -510,17 +510,14 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, struct ov2680_device *dev = to_ov2680_sensor(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *fmt; - struct ov2680_resolution *res; + unsigned int width, height; int ret = 0; - res = v4l2_find_nearest_size(ov2680_res_preview, ARRAY_SIZE(ov2680_res_preview), - width, height, - format->format.width, format->format.height); - if (!res) - res = &ov2680_res_preview[N_RES_PREVIEW - 1]; + width = min_t(unsigned int, ALIGN(format->format.width, 2), OV2680_NATIVE_WIDTH); + height = min_t(unsigned int, ALIGN(format->format.height, 2), OV2680_NATIVE_HEIGHT); fmt = __ov2680_get_pad_format(dev, sd_state, format->pad, format->which); - ov2680_fill_format(dev, fmt, res->width, res->height); + ov2680_fill_format(dev, fmt, width, height); format->format = *fmt; |