Commit a8ae11cb authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Kleber Sacilotto de Souza

media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit 39034bb0 ]

Commit da298c6d ("[media] v4l2: replace video op g_mbus_fmt by pad
op get_fmt") converted a former ov6650_g_fmt() video operation callback
to an ov6650_get_fmt() pad operation callback.  However, the converted
function disregards a format->which flag that pad operations should
obey and always returns active frame format settings.

That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with
-EINVAL, or providing the response from a pad config argument, likely
updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt().
Since implementation of the latter is trivial, go for it.

Fixes: da298c6d ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt")
Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent e6de2c85
...@@ -524,10 +524,16 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd, ...@@ -524,10 +524,16 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd,
*mf = ov6650_def_fmt; *mf = ov6650_def_fmt;
/* update media bus format code and frame size */ /* update media bus format code and frame size */
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
mf->width = cfg->try_fmt.width;
mf->height = cfg->try_fmt.height;
mf->code = cfg->try_fmt.code;
} else {
mf->width = priv->rect.width >> priv->half_scale; mf->width = priv->rect.width >> priv->half_scale;
mf->height = priv->rect.height >> priv->half_scale; mf->height = priv->rect.height >> priv->half_scale;
mf->code = priv->code; mf->code = priv->code;
}
return 0; return 0;
} }
......
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