mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 13:56:41 +07:00
[media] ov772x: avoid calling ov772x_select_params() twice
Merge ov772x_s_fmt into ov772x_set_fmt. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
b174eb750e
commit
08c4627c79
@ -894,38 +894,15 @@ static int ov772x_get_fmt(struct v4l2_subdev *sd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
|
||||||
{
|
|
||||||
struct ov772x_priv *priv = to_ov772x(sd);
|
|
||||||
const struct ov772x_color_format *cfmt;
|
|
||||||
const struct ov772x_win_size *win;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ov772x_select_params(mf, &cfmt, &win);
|
|
||||||
|
|
||||||
ret = ov772x_set_params(priv, cfmt, win);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
priv->win = win;
|
|
||||||
priv->cfmt = cfmt;
|
|
||||||
|
|
||||||
mf->code = cfmt->code;
|
|
||||||
mf->width = win->rect.width;
|
|
||||||
mf->height = win->rect.height;
|
|
||||||
mf->field = V4L2_FIELD_NONE;
|
|
||||||
mf->colorspace = cfmt->colorspace;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ov772x_set_fmt(struct v4l2_subdev *sd,
|
static int ov772x_set_fmt(struct v4l2_subdev *sd,
|
||||||
struct v4l2_subdev_pad_config *cfg,
|
struct v4l2_subdev_pad_config *cfg,
|
||||||
struct v4l2_subdev_format *format)
|
struct v4l2_subdev_format *format)
|
||||||
{
|
{
|
||||||
|
struct ov772x_priv *priv = to_ov772x(sd);
|
||||||
struct v4l2_mbus_framefmt *mf = &format->format;
|
struct v4l2_mbus_framefmt *mf = &format->format;
|
||||||
const struct ov772x_color_format *cfmt;
|
const struct ov772x_color_format *cfmt;
|
||||||
const struct ov772x_win_size *win;
|
const struct ov772x_win_size *win;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (format->pad)
|
if (format->pad)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -938,9 +915,17 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
|
|||||||
mf->field = V4L2_FIELD_NONE;
|
mf->field = V4L2_FIELD_NONE;
|
||||||
mf->colorspace = cfmt->colorspace;
|
mf->colorspace = cfmt->colorspace;
|
||||||
|
|
||||||
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
|
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
|
||||||
return ov772x_s_fmt(sd, mf);
|
cfg->try_fmt = *mf;
|
||||||
cfg->try_fmt = *mf;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ov772x_set_params(priv, cfmt, win);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
priv->win = win;
|
||||||
|
priv->cfmt = cfmt;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user