Commit a7d5003c authored by Steve Longerbeam's avatar Steve Longerbeam Committed by Mauro Carvalho Chehab
Browse files

media: imx: utils: Rename pixel format selection enumeration



After the introduction of the CS_SEL_BAYER flag, the "codespace"
pixel format selection enumeration wording no longer makes sense
(and even before, when selecting between YUV or RGB formats,
"codespace" was a misuse of the term).

Rename

- 'enum codespace_sel' to 'enum imx_pixfmt_sel'
- CS_SEL_* to PIXFMT_SEL_*
- local vars named cs_sel to fmt_sel or just sel

No functional changes.

Signed-off-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 3130c45c
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ static int prp_enum_mbus_code(struct v4l2_subdev *sd,
	switch (code->pad) {
	case PRP_SINK_PAD:
		ret = imx_media_enum_ipu_format(&code->code, code->index,
						CS_SEL_YUV_RGB);
						PIXFMT_SEL_YUV_RGB);
		break;
	case PRP_SRC_PAD_PRPENC:
	case PRP_SRC_PAD_PRPVF:
@@ -180,10 +180,12 @@ static int prp_set_fmt(struct v4l2_subdev *sd,
				      MIN_H, MAX_H, H_ALIGN, S_ALIGN);

		cc = imx_media_find_ipu_format(sdformat->format.code,
					       CS_SEL_YUV_RGB);
					       PIXFMT_SEL_YUV_RGB);
		if (!cc) {
			imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV_RGB);
			cc = imx_media_find_ipu_format(code, CS_SEL_YUV_RGB);
			imx_media_enum_ipu_format(&code, 0,
						  PIXFMT_SEL_YUV_RGB);
			cc = imx_media_find_ipu_format(code,
						       PIXFMT_SEL_YUV_RGB);
			sdformat->format.code = cc->codes[0];
		}

@@ -438,7 +440,7 @@ static int prp_registered(struct v4l2_subdev *sd)
	priv->frame_interval.denominator = 30;

	/* set a default mbus format  */
	imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
	imx_media_enum_ipu_format(&code, 0, PIXFMT_SEL_YUV);
	return imx_media_init_mbus_fmt(&priv->format_mbus, 640, 480, code,
				       V4L2_FIELD_NONE, NULL);
}
+7 −5
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ static int prp_enum_mbus_code(struct v4l2_subdev *sd,
		return -EINVAL;

	return imx_media_enum_ipu_format(&code->code, code->index,
					 CS_SEL_YUV_RGB);
					 PIXFMT_SEL_YUV_RGB);
}

static int prp_get_fmt(struct v4l2_subdev *sd,
@@ -886,12 +886,14 @@ static void prp_try_fmt(struct prp_priv *priv,
{
	struct v4l2_mbus_framefmt *infmt;

	*cc = imx_media_find_ipu_format(sdformat->format.code, CS_SEL_YUV_RGB);
	*cc = imx_media_find_ipu_format(sdformat->format.code,
					PIXFMT_SEL_YUV_RGB);
	if (!*cc) {
		u32 code;

		imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV_RGB);
		*cc = imx_media_find_ipu_format(code, CS_SEL_YUV_RGB);
		imx_media_enum_ipu_format(&code, 0, PIXFMT_SEL_YUV_RGB);
		*cc = imx_media_find_ipu_format(code, PIXFMT_SEL_YUV_RGB);

		sdformat->format.code = (*cc)->codes[0];
	}

@@ -1249,7 +1251,7 @@ static int prp_registered(struct v4l2_subdev *sd)
	u32 code;

	/* set a default mbus format  */
	imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
	imx_media_enum_ipu_format(&code, 0, PIXFMT_SEL_YUV);
	for (i = 0; i < PRPENCVF_NUM_PADS; i++) {
		ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
					      640, 480, code, V4L2_FIELD_NONE,
+18 −16
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static int capture_enum_framesizes(struct file *file, void *fh,
	};
	int ret;

	cc = imx_media_find_format(fsize->pixel_format, CS_SEL_ANY);
	cc = imx_media_find_format(fsize->pixel_format, PIXFMT_SEL_ANY);
	if (!cc)
		return -EINVAL;

@@ -133,7 +133,7 @@ static int capture_enum_frameintervals(struct file *file, void *fh,
	};
	int ret;

	cc = imx_media_find_format(fival->pixel_format, CS_SEL_ANY);
	cc = imx_media_find_format(fival->pixel_format, PIXFMT_SEL_ANY);
	if (!cc)
		return -EINVAL;

@@ -168,17 +168,18 @@ static int capture_enum_fmt_vid_cap(struct file *file, void *fh,
	}

	cc_src = imx_media_find_ipu_format(fmt_src.format.code,
					   CS_SEL_YUV_RGB);
					   PIXFMT_SEL_YUV_RGB);
	if (cc_src) {
		u32 cs_sel = (cc_src->cs == IPUV3_COLORSPACE_YUV) ?
			CS_SEL_YUV : CS_SEL_RGB;
		enum imx_pixfmt_sel fmt_sel =
			(cc_src->cs == IPUV3_COLORSPACE_YUV) ?
			PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;

		ret = imx_media_enum_format(&fourcc, f->index, cs_sel);
		ret = imx_media_enum_format(&fourcc, f->index, fmt_sel);
		if (ret)
			return ret;
	} else {
		cc_src = imx_media_find_mbus_format(fmt_src.format.code,
						    CS_SEL_ANY);
						    PIXFMT_SEL_ANY);
		if (WARN_ON(!cc_src))
			return -EINVAL;

@@ -211,22 +212,23 @@ static int __capture_try_fmt_vid_cap(struct capture_priv *priv,
	const struct imx_media_pixfmt *cc, *cc_src;

	cc_src = imx_media_find_ipu_format(fmt_src->format.code,
					   CS_SEL_YUV_RGB);
					   PIXFMT_SEL_YUV_RGB);
	if (cc_src) {
		u32 fourcc, cs_sel;
		enum imx_pixfmt_sel fmt_sel;
		u32 fourcc;

		cs_sel = (cc_src->cs == IPUV3_COLORSPACE_YUV) ?
			CS_SEL_YUV : CS_SEL_RGB;
		fmt_sel = (cc_src->cs == IPUV3_COLORSPACE_YUV) ?
			PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;
		fourcc = f->fmt.pix.pixelformat;

		cc = imx_media_find_format(fourcc, cs_sel);
		cc = imx_media_find_format(fourcc, fmt_sel);
		if (!cc) {
			imx_media_enum_format(&fourcc, 0, cs_sel);
			cc = imx_media_find_format(fourcc, cs_sel);
			imx_media_enum_format(&fourcc, 0, fmt_sel);
			cc = imx_media_find_format(fourcc, fmt_sel);
		}
	} else {
		cc_src = imx_media_find_mbus_format(fmt_src->format.code,
						    CS_SEL_ANY);
						    PIXFMT_SEL_ANY);
		if (WARN_ON(!cc_src))
			return -EINVAL;

@@ -792,7 +794,7 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
	vdev->compose.width = fmt_src.format.width;
	vdev->compose.height = fmt_src.format.height;
	vdev->cc = imx_media_find_format(vdev->fmt.fmt.pix.pixelformat,
					 CS_SEL_ANY);
					 PIXFMT_SEL_ANY);

	v4l2_info(sd, "Registered %s as /dev/%s\n", vfd->name,
		  video_device_node_name(vfd));
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ static int ipu_csc_scaler_enum_fmt(struct file *file, void *fh,
	u32 fourcc;
	int ret;

	ret = imx_media_enum_format(&fourcc, f->index, CS_SEL_YUV_RGB);
	ret = imx_media_enum_format(&fourcc, f->index, PIXFMT_SEL_YUV_RGB);
	if (ret)
		return ret;

+20 −15
Original line number Diff line number Diff line
@@ -1234,12 +1234,12 @@ static int csi_enum_mbus_code(struct v4l2_subdev *sd,
	mutex_lock(&priv->lock);

	infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, code->which);
	incc = imx_media_find_mbus_format(infmt->code, CS_SEL_ANY);
	incc = imx_media_find_mbus_format(infmt->code, PIXFMT_SEL_ANY);

	switch (code->pad) {
	case CSI_SINK_PAD:
		ret = imx_media_enum_mbus_format(&code->code, code->index,
						 CS_SEL_ANY);
						 PIXFMT_SEL_ANY);
		break;
	case CSI_SRC_PAD_DIRECT:
	case CSI_SRC_PAD_IDMAC:
@@ -1256,11 +1256,13 @@ static int csi_enum_mbus_code(struct v4l2_subdev *sd,
			}
			code->code = infmt->code;
		} else {
			u32 cs_sel = (incc->cs == IPUV3_COLORSPACE_YUV) ?
				CS_SEL_YUV : CS_SEL_RGB;
			enum imx_pixfmt_sel fmt_sel =
				(incc->cs == IPUV3_COLORSPACE_YUV) ?
				PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;

			ret = imx_media_enum_ipu_format(&code->code,
							code->index,
							cs_sel);
							fmt_sel);
		}
		break;
	default:
@@ -1433,7 +1435,7 @@ static void csi_try_fmt(struct csi_priv *priv,
	switch (sdformat->pad) {
	case CSI_SRC_PAD_DIRECT:
	case CSI_SRC_PAD_IDMAC:
		incc = imx_media_find_mbus_format(infmt->code, CS_SEL_ANY);
		incc = imx_media_find_mbus_format(infmt->code, PIXFMT_SEL_ANY);

		sdformat->format.width = compose->width;
		sdformat->format.height = compose->height;
@@ -1442,14 +1444,15 @@ static void csi_try_fmt(struct csi_priv *priv,
			sdformat->format.code = infmt->code;
			*cc = incc;
		} else {
			u32 cs_sel = (incc->cs == IPUV3_COLORSPACE_YUV) ?
				CS_SEL_YUV : CS_SEL_RGB;
			enum imx_pixfmt_sel fmt_sel =
				(incc->cs == IPUV3_COLORSPACE_YUV) ?
				PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;

			*cc = imx_media_find_ipu_format(sdformat->format.code,
							cs_sel);
							fmt_sel);
			if (!*cc) {
				imx_media_enum_ipu_format(&code, 0, cs_sel);
				*cc = imx_media_find_ipu_format(code, cs_sel);
				imx_media_enum_ipu_format(&code, 0, fmt_sel);
				*cc = imx_media_find_ipu_format(code, fmt_sel);
				sdformat->format.code = (*cc)->codes[0];
			}
		}
@@ -1469,10 +1472,12 @@ static void csi_try_fmt(struct csi_priv *priv,
				      MIN_H, MAX_H, H_ALIGN, S_ALIGN);

		*cc = imx_media_find_mbus_format(sdformat->format.code,
						 CS_SEL_ANY);
						 PIXFMT_SEL_ANY);
		if (!*cc) {
			imx_media_enum_mbus_format(&code, 0, CS_SEL_YUV_RGB);
			*cc = imx_media_find_mbus_format(code, CS_SEL_YUV_RGB);
			imx_media_enum_mbus_format(&code, 0,
						   PIXFMT_SEL_YUV_RGB);
			*cc = imx_media_find_mbus_format(code,
							 PIXFMT_SEL_YUV_RGB);
			sdformat->format.code = (*cc)->codes[0];
		}

@@ -1758,7 +1763,7 @@ static int csi_registered(struct v4l2_subdev *sd)
	for (i = 0; i < CSI_NUM_PADS; i++) {
		code = 0;
		if (i != CSI_SINK_PAD)
			imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);
			imx_media_enum_ipu_format(&code, 0, PIXFMT_SEL_YUV);

		/* set a default mbus format  */
		ret = imx_media_init_mbus_fmt(&priv->format_mbus[i],
Loading