@@ -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);
}
@@ -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;
}
@@ -1766,8 +1766,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;
@@ -1780,10 +1781,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)) {
@@ -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;
@@ -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
*/
@@ -510,7 +510,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 = {
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> --- drivers/staging/media/imx/imx-ic-prp.c | 4 +++- drivers/staging/media/imx/imx-ic-prpencvf.c | 5 +++-- drivers/staging/media/imx/imx-media-csi.c | 13 +++++++------ drivers/staging/media/imx/imx-media-vdic.c | 5 +++-- drivers/staging/media/imx/imx-media.h | 3 +++ drivers/staging/media/imx/imx6-mipi-csi2.c | 4 +++- 6 files changed, 22 insertions(+), 12 deletions(-)