media: imx: Set default sizes through macros in all drivers

All drivers use 640x480 as the default size, but they all hardcode those
values. Create two global macros named IMX_MEDIA_DEF_PIX_WIDTH and
IMX_MEDIA_DEF_PIX_HEIGHT to store the default size, and use them through
the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Laurent Pinchart 2021-02-15 05:26:29 +01:00 committed by Mauro Carvalho Chehab
parent 772cb7f2cf
commit 0ab05d7f7d
6 changed files with 22 additions and 12 deletions

View File

@ -442,7 +442,9 @@ static int prp_registered(struct v4l2_subdev *sd)
/* set a default mbus format */
imx_media_enum_ipu_formats(&code, 0, PIXFMT_SEL_YUV);
return imx_media_init_mbus_fmt(&priv->format_mbus, 640, 480, code,
return imx_media_init_mbus_fmt(&priv->format_mbus,
IMX_MEDIA_DEF_PIX_WIDTH,
IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, NULL);
}

View File

@ -1255,8 +1255,9 @@ static int prp_registered(struct v4l2_subdev *sd)
for (i = 0; i < PRPENCVF_NUM_PADS; i++) {
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE,
&priv->cc[i]);
IMX_MEDIA_DEF_PIX_WIDTH,
IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret)
return ret;
}

View File

@ -1758,8 +1758,9 @@ static int csi_registered(struct v4l2_subdev *sd)
/* set a default mbus format */
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE,
&priv->cc[i]);
IMX_MEDIA_DEF_PIX_WIDTH,
IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret)
goto put_csi;
@ -1772,10 +1773,10 @@ static int csi_registered(struct v4l2_subdev *sd)
priv->skip = &csi_skip[0];
/* init default crop and compose rectangle sizes */
priv->crop.width = 640;
priv->crop.height = 480;
priv->compose.width = 640;
priv->compose.height = 480;
priv->crop.width = IMX_MEDIA_DEF_PIX_WIDTH;
priv->crop.height = IMX_MEDIA_DEF_PIX_HEIGHT;
priv->compose.width = IMX_MEDIA_DEF_PIX_WIDTH;
priv->compose.height = IMX_MEDIA_DEF_PIX_HEIGHT;
priv->fim = imx_media_fim_init(&priv->sd);
if (IS_ERR(priv->fim)) {

View File

@ -856,8 +856,9 @@ static int vdic_registered(struct v4l2_subdev *sd)
/* set a default mbus format */
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE,
&priv->cc[i]);
IMX_MEDIA_DEF_PIX_WIDTH,
IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret)
return ret;

View File

@ -15,6 +15,9 @@
#include <media/videobuf2-dma-contig.h>
#include <video/imx-ipu-v3.h>
#define IMX_MEDIA_DEF_PIX_WIDTH 640
#define IMX_MEDIA_DEF_PIX_HEIGHT 480
/*
* Enumeration of the IPU internal sub-devices
*/

View File

@ -571,7 +571,9 @@ static int csi2_registered(struct v4l2_subdev *sd)
/* set a default mbus format */
return imx_media_init_mbus_fmt(&csi2->format_mbus,
640, 480, 0, V4L2_FIELD_NONE, NULL);
IMX_MEDIA_DEF_PIX_WIDTH,
IMX_MEDIA_DEF_PIX_HEIGHT, 0,
V4L2_FIELD_NONE, NULL);
}
static const struct media_entity_operations csi2_entity_ops = {