Commit 0ab05d7f authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 772cb7f2
...@@ -442,7 +442,9 @@ static int prp_registered(struct v4l2_subdev *sd) ...@@ -442,7 +442,9 @@ static int prp_registered(struct v4l2_subdev *sd)
/* set a default mbus format */ /* set a default mbus format */
imx_media_enum_ipu_formats(&code, 0, PIXFMT_SEL_YUV); 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); V4L2_FIELD_NONE, NULL);
} }
......
...@@ -1255,8 +1255,9 @@ static int prp_registered(struct v4l2_subdev *sd) ...@@ -1255,8 +1255,9 @@ static int prp_registered(struct v4l2_subdev *sd)
for (i = 0; i < PRPENCVF_NUM_PADS; i++) { for (i = 0; i < PRPENCVF_NUM_PADS; i++) {
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i], ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE, IMX_MEDIA_DEF_PIX_WIDTH,
&priv->cc[i]); IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -1758,8 +1758,9 @@ static int csi_registered(struct v4l2_subdev *sd) ...@@ -1758,8 +1758,9 @@ static int csi_registered(struct v4l2_subdev *sd)
/* set a default mbus format */ /* set a default mbus format */
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i], ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE, IMX_MEDIA_DEF_PIX_WIDTH,
&priv->cc[i]); IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret) if (ret)
goto put_csi; goto put_csi;
...@@ -1772,10 +1773,10 @@ static int csi_registered(struct v4l2_subdev *sd) ...@@ -1772,10 +1773,10 @@ static int csi_registered(struct v4l2_subdev *sd)
priv->skip = &csi_skip[0]; priv->skip = &csi_skip[0];
/* init default crop and compose rectangle sizes */ /* init default crop and compose rectangle sizes */
priv->crop.width = 640; priv->crop.width = IMX_MEDIA_DEF_PIX_WIDTH;
priv->crop.height = 480; priv->crop.height = IMX_MEDIA_DEF_PIX_HEIGHT;
priv->compose.width = 640; priv->compose.width = IMX_MEDIA_DEF_PIX_WIDTH;
priv->compose.height = 480; priv->compose.height = IMX_MEDIA_DEF_PIX_HEIGHT;
priv->fim = imx_media_fim_init(&priv->sd); priv->fim = imx_media_fim_init(&priv->sd);
if (IS_ERR(priv->fim)) { if (IS_ERR(priv->fim)) {
......
...@@ -856,8 +856,9 @@ static int vdic_registered(struct v4l2_subdev *sd) ...@@ -856,8 +856,9 @@ static int vdic_registered(struct v4l2_subdev *sd)
/* set a default mbus format */ /* set a default mbus format */
ret = imx_media_init_mbus_fmt(&priv->format_mbus[i], ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
640, 480, code, V4L2_FIELD_NONE, IMX_MEDIA_DEF_PIX_WIDTH,
&priv->cc[i]); IMX_MEDIA_DEF_PIX_HEIGHT, code,
V4L2_FIELD_NONE, &priv->cc[i]);
if (ret) if (ret)
return ret; return ret;
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
#include <video/imx-ipu-v3.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 * Enumeration of the IPU internal sub-devices
*/ */
......
...@@ -571,7 +571,9 @@ static int csi2_registered(struct v4l2_subdev *sd) ...@@ -571,7 +571,9 @@ static int csi2_registered(struct v4l2_subdev *sd)
/* set a default mbus format */ /* set a default mbus format */
return imx_media_init_mbus_fmt(&csi2->format_mbus, 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 = { static const struct media_entity_operations csi2_entity_ops = {
......
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