Skip to contentSkip to conversation

media: imx: staging cleanup

PATCH In review Jiaqi Shi 3 participants 6 messages Dec 2 – Dec 3

Subsystems (4)
lore
Share & tools
lore

Jiaqi Shi

author
#0 lore raw

v9 cover media: imx: staging cleanup

Changes in v9:
- Split the previous cleanup into three smaller patches as requested by
Frank: control inheritance removal, format handling rework, and FIM removal.
- imx_media_capture_device_remove() removal is a consequence of dropping the per-video-device control handler, not a separate bug fix; the original error paths had no leak.

The result is identical to v8 apart from the commit split.

Validation:
- builds on media-committers next; applies cleanly with git am
- checkpatch.pl --strict is clean
- i.MX register-level and hardware DMA paths remain untested

Jiaqi Shi (3):
media: imx: remove subdev control inheritance to capture video nodes
media: imx: drop legacy capture format handling and validate formats
media: imx: remove frame interval monitor

 Documentation/admin-guide/media/imx.rst       |  31 +-
 .../userspace-api/media/drivers/imx-uapi.rst  | 125 -----
 .../userspace-api/media/drivers/index.rst     |   1 -
 MAINTAINERS                                   |   2 -
 drivers/staging/media/imx/Makefile            |   2 +-
 drivers/staging/media/imx/TODO                |  13 -
 drivers/staging/media/imx/imx-ic-prp.c        |   1 -
 drivers/staging/media/imx/imx-ic-prpencvf.c   |  11 +-
 drivers/staging/media/imx/imx-media-capture.c | 418 ++++++-----------
 drivers/staging/media/imx/imx-media-csi.c     |  84 +---
 .../staging/media/imx/imx-media-dev-common.c  | 113 +----
 drivers/staging/media/imx/imx-media-dev.c     |   1 -
 drivers/staging/media/imx/imx-media-fim.c     | 430 ------------------
 drivers/staging/media/imx/imx-media-utils.c   |   9 +-
 drivers/staging/media/imx/imx-media-vdic.c    |   1 -
 drivers/staging/media/imx/imx-media.h         |  21 +-
 include/linux/imx-media.h                     |  25 -
 include/media/imx.h                           |  11 -
 18 files changed, 182 insertions(+), 1117 deletions(-)
 delete mode 100644 Documentation/userspace-api/media/drivers/imx-uapi.rst
 delete mode 100644 drivers/staging/media/imx/TODO
 delete mode 100644 drivers/staging/media/imx/imx-media-fim.c
 delete mode 100644 include/linux/imx-media.h
 delete mode 100644 include/media/imx.h
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v9 1/3 media: imx: remove subdev control inheritance to capture video nodes

Capture video nodes inherited controls from the pipeline subdevs and refreshed them in the link_notify callback. Userspace should use the subdev-based API instead, so drop the inheritance and the per-video-device control handler it needs.

---
 Documentation/admin-guide/media/imx.rst       |  10 +-
 drivers/staging/media/imx/TODO                |   6 -
 drivers/staging/media/imx/imx-ic-prpencvf.c   |   5 +-
 drivers/staging/media/imx/imx-media-capture.c |  19 ---
 drivers/staging/media/imx/imx-media-csi.c     |   5 +-
 .../staging/media/imx/imx-media-dev-common.c  | 113 +-----------------
 drivers/staging/media/imx/imx-media.h         |   7 +-
 7 files changed, 8 insertions(+), 157 deletions(-)
Documentation/admin-guide/media/imx.rst +3 -7
index bb68100d8acb..b1c5fecfaef7 100644
@@ -394,13 +394,9 @@ scaling up to 1024x1024, CSC, flip, and rotation:
 Usage Notes
 -----------
 
-To aid in configuration and for backward compatibility with V4L2
-applications that access controls only from video device nodes, the
-capture device interfaces inherit controls from the active entities
-in the current pipeline, so controls can be accessed either directly
-from the subdev or from the active capture device interface. For
-example, the FIM controls are available either from the ipuX_csiY
-subdevs or from the active capture device.
+Controls for pipeline entities are accessed through their subdev device
+nodes. For example, the FIM controls are available from the ipuX_csiY
+subdevs.
 
 The following are specific usage notes for the Sabre* reference
 boards:
drivers/staging/media/imx/TODO +0 -6
index 11c9e10d34ae..db82dd684869 100644
@@ -2,12 +2,6 @@
 - The Frame Interval Monitor could be exported to v4l2-core for
   general use.
 
-- This media driver supports inheriting V4L2 controls to the
-  video capture devices, from the subdevices in the capture device's
-  pipeline. The controls for each capture device are updated in the
-  link_notify callback when the pipeline is modified. This feature should be
-  removed, userspace should use the subdev-based userspace API instead.
-
 - Similarly to the legacy control handling, legacy format handling where
   formats on the video nodes are influenced by the active format of the
   connected subdev should be removed.
drivers/staging/media/imx/imx-ic-prpencvf.c +1 -4
index aaa2248780a8..0056d9d2e66c 100644
@@ -1285,7 +1285,7 @@ static int prp_registered(struct v4l2_subdev *sd)
 
 	ret = imx_media_capture_device_register(priv->vdev, 0);
 	if (ret)
-		goto remove_vdev;
+		return ret;
 
 	ret = prp_init_controls(priv);
 	if (ret)
@@ -1295,8 +1295,6 @@ static int prp_registered(struct v4l2_subdev *sd)
 
 unreg_vdev:
 	imx_media_capture_device_unregister(priv->vdev);
-remove_vdev:
-	imx_media_capture_device_remove(priv->vdev);
 	return ret;
 }
 
@@ -1305,7 +1303,6 @@ static void prp_unregistered(struct v4l2_subdev *sd)
 	struct prp_priv *priv = sd_to_priv(sd);
 
 	imx_media_capture_device_unregister(priv->vdev);
-	imx_media_capture_device_remove(priv->vdev);
 
 	v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
 }
drivers/staging/media/imx/imx-media-capture.c +0 -19
index 9216a221b72f..4dcfa0fdf1a4 100644
@@ -12,7 +12,6 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/timer.h>
-#include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
@@ -42,8 +41,6 @@ struct capture_priv {
 	struct list_head ready_q;		/* List of queued buffers */
 	spinlock_t q_lock;			/* Protect ready_q */
 
-	struct v4l2_ctrl_handler ctrl_hdlr;	/* Controls inherited from subdevs */
-
 	bool legacy_api;			/* Use the legacy (pre-MC) API */
 };
 
@@ -553,8 +550,6 @@ static int capture_legacy_subscribe_event(struct v4l2_fh *fh,
 		return v4l2_event_subscribe(fh, sub, 0, NULL);
 	case V4L2_EVENT_SOURCE_CHANGE:
 		return v4l2_src_change_event_subscribe(fh, sub);
-	case V4L2_EVENT_CTRL:
-		return v4l2_ctrl_subscribe_event(fh, sub);
 	default:
 		return -EINVAL;
 	}
@@ -1031,24 +1026,10 @@ imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd,
 		return ERR_PTR(ret);
 	}
 
-	if (legacy_api) {
-		/* Initialize the control handler. */
-		v4l2_ctrl_handler_init(&priv->ctrl_hdlr, 0);
-		vfd->ctrl_handler = &priv->ctrl_hdlr;
-	}
-
 	return &priv->vdev;
 }
 EXPORT_SYMBOL_GPL(imx_media_capture_device_init);
 
-void imx_media_capture_device_remove(struct imx_media_video_dev *vdev)
-{
-	struct capture_priv *priv = to_capture_priv(vdev);
-
-	v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
-}
-EXPORT_SYMBOL_GPL(imx_media_capture_device_remove);
-
 MODULE_DESCRIPTION("i.MX5/6 v4l2 video capture interface driver");
 MODULE_AUTHOR("Steve Longerbeam <[email protected]>");
 MODULE_LICENSE("GPL");
drivers/staging/media/imx/imx-media-csi.c +1 -4
index 2c153a5f9613..cebd1b20b6e8 100644
@@ -1823,12 +1823,10 @@ static int csi_registered(struct v4l2_subdev *sd)
 
 	ret = imx_media_capture_device_register(priv->vdev, 0);
 	if (ret)
-		goto remove_vdev;
+		goto free_fim;
 
 	return 0;
 
-remove_vdev:
-	imx_media_capture_device_remove(priv->vdev);
 free_fim:
 	if (priv->fim)
 		imx_media_fim_free(priv->fim);
@@ -1842,7 +1840,6 @@ static void csi_unregistered(struct v4l2_subdev *sd)
 	struct csi_priv *priv = v4l2_get_subdevdata(sd);
 
 	imx_media_capture_device_unregister(priv->vdev);
-	imx_media_capture_device_remove(priv->vdev);
 
 	if (priv->fim)
 		imx_media_fim_free(priv->fim);
drivers/staging/media/imx/imx-media-dev-common.c +1 -112

131 lines not on this page · raw message

drivers/staging/media/imx/imx-media.h +2 -5
index 537558a7bece..832c9d292353 100644
@@ -125,10 +125,8 @@ static inline struct imx_media_buffer *to_imx_media_vb(struct vb2_buffer *vb)
 }
 
 /*
- * to support control inheritance to video devices, this
- * retrieves a pad's list_head of video devices that can
- * be reached from the pad. Note that only the lists in
- * source pads get populated, sink pads have empty lists.
+ * Retrieve a pad's list of video devices reachable from the pad for
+ * subdev event forwarding. Only source pad lists are populated.
  */
 static inline struct list_head *
 to_pad_vdev_list(struct v4l2_subdev *sd, int pad_index)
@@ -271,7 +269,6 @@ int imx_media_ic_unregister(struct v4l2_subdev *sd);
 struct imx_media_video_dev *
 imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd,
 			      int pad, bool legacy_api);
-void imx_media_capture_device_remove(struct imx_media_video_dev *vdev);
 int imx_media_capture_device_register(struct imx_media_video_dev *vdev,
 				      u32 link_flags);
 void imx_media_capture_device_unregister(struct imx_media_video_dev *vdev);
Signature · 1 line
2.53.0
author
#2 lore raw

PATCH v9 2/3 media: imx: drop legacy capture format handling and validate formats

In reply to Jiaqi Shi

Capture video nodes used a legacy ioctl path that derived the pixel format from the source subdev's active format. Switch to the source-independent format handling, initialize the default to UYVY 640x480, and validate the format against the source at stream time.

Since all nodes now share this path, sanitize the field, clamp dimensions, resolve colorimetry, and guard against sizeimage overflow. Pass ic_route to __capture_try_fmt() so IC nodes only accept YUV/RGB, and keep the user-visible field unchanged via a new stream_field.

---
 Documentation/admin-guide/media/imx.rst       |  10 +-
 drivers/staging/media/imx/TODO                |   4 -
 drivers/staging/media/imx/imx-ic-prpencvf.c   |   6 +-
 drivers/staging/media/imx/imx-media-capture.c | 382 +++++++-----------
 drivers/staging/media/imx/imx-media-csi.c     |   5 +-
 drivers/staging/media/imx/imx-media-utils.c   |   9 +-
 drivers/staging/media/imx/imx-media.h         |   4 +-
 7 files changed, 169 insertions(+), 251 deletions(-)
Documentation/admin-guide/media/imx.rst +5 -5
index b1c5fecfaef7..812c6ac09ab8 100644
@@ -479,7 +479,7 @@ NTSC, or 'alternate'):
    media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480]"
    media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
    # Configure "ipu1_csi0 capture" interface (assumed at /dev/video4)
-   v4l2-ctl -d4 --set-fmt-video=field=interlaced_bt
+   v4l2-ctl -d4 --set-fmt-video=width=720,height=480,field=interlaced_bt
 
 Streaming can then begin on /dev/video4. The v4l2-ctl tool can also be
 used to select any supported YUV pixelformat on /dev/video4.
@@ -506,7 +506,7 @@ alternating fields (field type 'seq-tb' for PAL, or 'alternate').
    media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
    media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
    # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
-   v4l2-ctl -d2 --set-fmt-video=field=none
+   v4l2-ctl -d2 --set-fmt-video=width=720,height=576,field=none
 
 Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be
 used to select any supported YUV pixelformat on /dev/video2.
@@ -537,7 +537,7 @@ NTSC, or 'alternate'):
    media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x480]"
    media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
    # Configure "ipu1_csi0 capture" interface (assumed at /dev/video0)
-   v4l2-ctl -d0 --set-fmt-video=field=interlaced_bt
+   v4l2-ctl -d0 --set-fmt-video=width=720,height=480,field=interlaced_bt
 
 Streaming can then begin on /dev/video0. The v4l2-ctl tool can also be
 used to select any supported YUV pixelformat on /dev/video0.
@@ -564,7 +564,7 @@ alternating fields (field type 'seq-tb' for PAL, or 'alternate').
    media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
    media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
    # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
-   v4l2-ctl -d2 --set-fmt-video=field=none
+   v4l2-ctl -d2 --set-fmt-video=width=720,height=576,field=none
 
 Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be
 used to select any supported YUV pixelformat on /dev/video2.
@@ -648,7 +648,7 @@ shows colorspace conversion and scaling at IC output.
    media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]"
    media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]"
    # Set a format at the capture interface
-   v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3
+   v4l2-ctl -d /dev/video1 --set-fmt-video=width=800,height=600,pixelformat=RGB3
 
 Streaming can then begin on "ipu1_ic_prpenc capture" node.
 
drivers/staging/media/imx/TODO +0 -4
index db82dd684869..43cd030d4bbd 100644
@@ -1,7 +1,3 @@
 
 - The Frame Interval Monitor could be exported to v4l2-core for
   general use.
-
-- Similarly to the legacy control handling, legacy format handling where
-  formats on the video nodes are influenced by the active format of the
-  connected subdev should be removed.
drivers/staging/media/imx/imx-ic-prpencvf.c +3 -3
index 0056d9d2e66c..111b5f9fd447 100644
@@ -19,7 +19,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-mc.h>
 #include <media/v4l2-subdev.h>
-#include <media/imx.h>
 #include "imx-media.h"
 #include "imx-ic.h"
 
@@ -203,7 +202,7 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct ipuv3_channel *ch)
 
 	done = priv->active_vb2_buf[priv->ipu_buf_num];
 	if (done) {
-		done->vbuf.field = vdev->fmt.field;
+		done->vbuf.field = vdev->stream_field;
 		done->vbuf.sequence = priv->frame_sequence;
 		vb = &done->vbuf.vb2_buf;
 		vb->timestamp = ktime_get_ns();
@@ -362,6 +361,7 @@ static int prp_setup_channel(struct prp_priv *priv,
 
 	memset(&image, 0, sizeof(image));
 	image.pix = vdev->fmt;
+	image.pix.field = vdev->stream_field;
 	image.rect = vdev->compose;
 
 	/*
@@ -1279,7 +1279,7 @@ static int prp_registered(struct v4l2_subdev *sd)
 
 	priv->vdev = imx_media_capture_device_init(ic_priv->ipu_dev,
 						   &ic_priv->sd,
-						   PRPENCVF_SRC_PAD, true);
+						   PRPENCVF_SRC_PAD, true, true);
 	if (IS_ERR(priv->vdev))
 		return PTR_ERR(priv->vdev);
 
drivers/staging/media/imx/imx-media-capture.c +148 -234

543 lines not on this page · raw message

drivers/staging/media/imx/imx-media-csi.c +3 -2
index cebd1b20b6e8..3392afc0f187 100644
@@ -266,7 +266,7 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
 
 	done = priv->active_vb2_buf[priv->ipu_buf_num];
 	if (done) {
-		done->vbuf.field = vdev->fmt.field;
+		done->vbuf.field = vdev->stream_field;
 		done->vbuf.sequence = priv->frame_sequence;
 		vb = &done->vbuf.vb2_buf;
 		vb->timestamp = ktime_get_ns();
@@ -423,6 +423,7 @@ static int csi_idmac_setup_channel(struct csi_priv *priv,
 
 	memset(&image, 0, sizeof(image));
 	image.pix = vdev->fmt;
+	image.pix.field = vdev->stream_field;
 	image.rect = vdev->compose;
 
 	csi_idmac_setup_vb2_buf(priv, phys);
@@ -1815,7 +1816,7 @@ static int csi_registered(struct v4l2_subdev *sd)
 	}
 
 	priv->vdev = imx_media_capture_device_init(priv->sd.dev, &priv->sd,
-						   CSI_SRC_PAD_IDMAC, true);
+						   CSI_SRC_PAD_IDMAC, true, false);
 	if (IS_ERR(priv->vdev)) {
 		ret = PTR_ERR(priv->vdev);
 		goto free_fim;
drivers/staging/media/imx/imx-media-utils.c +7 -2
index fad2ee02ea25..267d0a51e0d9 100644
@@ -494,6 +494,7 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
 {
 	u32 width;
 	u32 stride;
+	u64 sizeimage;
 
 	if (!cc) {
 		cc = imx_media_find_ipu_format(mbus->code,
@@ -534,8 +535,12 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
 	pix->quantization = mbus->quantization;
 	pix->field = mbus->field;
 	pix->bytesperline = stride;
-	pix->sizeimage = cc->planar ? ((stride * pix->height * cc->bpp) >> 3) :
-			 stride * pix->height;
+	sizeimage = (u64)stride * pix->height;
+	if (cc->planar)
+		sizeimage = (sizeimage * cc->bpp) >> 3;
+	if (sizeimage > U32_MAX)
+		return -EINVAL;
+	pix->sizeimage = sizeimage;
 
 	return 0;
 }
drivers/staging/media/imx/imx-media.h +3 -1
index 832c9d292353..c09546fcf080 100644
@@ -109,6 +109,8 @@ struct imx_media_video_dev {
 
 	/* the user format */
 	struct v4l2_pix_format fmt;
+	/* field order resolved for the current stream */
+	u32 stream_field;
 	/* the compose rectangle */
 	struct v4l2_rect compose;
 	const struct imx_media_pixfmt *cc;
@@ -268,7 +270,7 @@ int imx_media_ic_unregister(struct v4l2_subdev *sd);
 /* imx-media-capture.c */
 struct imx_media_video_dev *
 imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd,
-			      int pad, bool legacy_api);
+			      int pad, bool legacy_api, bool ic_route);
 int imx_media_capture_device_register(struct imx_media_video_dev *vdev,
 				      u32 link_flags);
 void imx_media_capture_device_unregister(struct imx_media_video_dev *vdev);
Signature · 1 line
2.53.0
author
#3 lore raw

PATCH v9 3/3 media: imx: remove frame interval monitor

In reply to Jiaqi Shi

The frame interval monitor is disabled by default, has no documented userspace use-case, and has no standard equivalent. The media maintainer does not want it in v4l2-core, so remove it instead of exporting it.

---
 Documentation/admin-guide/media/imx.rst       |  15 +-
 .../userspace-api/media/drivers/imx-uapi.rst  | 125 -----
 .../userspace-api/media/drivers/index.rst     |   1 -
 MAINTAINERS                                   |   2 -
 drivers/staging/media/imx/Makefile            |   2 +-
 drivers/staging/media/imx/TODO                |   3 -
 drivers/staging/media/imx/imx-ic-prp.c        |   1 -
 drivers/staging/media/imx/imx-media-capture.c |  17 -
 drivers/staging/media/imx/imx-media-csi.c     |  76 +---
 drivers/staging/media/imx/imx-media-dev.c     |   1 -
 drivers/staging/media/imx/imx-media-fim.c     | 430 ------------------
 drivers/staging/media/imx/imx-media-vdic.c    |   1 -
 drivers/staging/media/imx/imx-media.h         |  10 -
 include/linux/imx-media.h                     |  25 -
 include/media/imx.h                           |  11 -
 15 files changed, 8 insertions(+), 712 deletions(-)
 delete mode 100644 Documentation/userspace-api/media/drivers/imx-uapi.rst
 delete mode 100644 drivers/staging/media/imx/TODO
 delete mode 100644 drivers/staging/media/imx/imx-media-fim.c
 delete mode 100644 include/linux/imx-media.h
 delete mode 100644 include/media/imx.h
Documentation/admin-guide/media/imx.rst +1 -14
index 812c6ac09ab8..b1998dcc4344 100644
@@ -98,9 +98,6 @@ Some of the features of this driver include:
   CSI. There is also support in the future for sending frames to the
   VDIC from memory buffers via output/mem2mem devices.
 
-- Includes a Frame Interval Monitor (FIM) that can correct vertical sync
-  problems with the ADV718x video decoders.
-
 
 Topology
 --------
@@ -220,8 +217,6 @@ or unqualified interlaced). The capture interface will enforce the same
 field order as the source pad field order (interlaced-bt if source pad
 is seq-bt, interlaced-tb if source pad is seq-tb).
 
-For events produced by ipuX_csiY, see ref:`imx_api_ipuX_csiY`.
-
 Cropping in ipuX_csiY
 ---------------------
 
@@ -266,11 +261,6 @@ rate by half at the IDMAC output source pad:
    media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]"
    media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]"
 
-Frame Interval Monitor in ipuX_csiY
------------------------------------
-
-See ref:`imx_api_FIM`.
-
 ipuX_vdic
 ---------
 
@@ -395,8 +385,7 @@ Usage Notes
 -----------
 
 Controls for pipeline entities are accessed through their subdev device
-nodes. For example, the FIM controls are available from the ipuX_csiY
-subdevs.
+nodes.
 
 The following are specific usage notes for the Sabre* reference
 boards:
@@ -690,8 +679,6 @@ File list
 ---------
 
 drivers/staging/media/imx/
-include/media/imx.h
-include/linux/imx-media.h
 
 References
 ----------
Documentation/userspace-api/media/drivers/imx-uapi.rst deleted +0 -125

125 lines not on this page · raw message

Documentation/userspace-api/media/drivers/index.rst +0 -1
index 8d2c489b8453..3f6b9a5ceefd 100644
@@ -32,7 +32,6 @@ For more details see the file COPYING in the source distribution of Linux.
 	cx2341x-uapi
 	dcmipp
 	dw100
-	imx-uapi
 	mali-c55
 	max2175
 	npcm-video
MAINTAINERS +0 -2
index 926c9beb308a..5510bdda72e9 100644
@@ -16787,8 +16787,6 @@ T:	git git://linuxtv.org/media.git
 F:	Documentation/admin-guide/media/imx.rst
 F:	Documentation/devicetree/bindings/media/fsl,imx6-mipi-csi2.yaml
 F:	drivers/staging/media/imx/
-F:	include/linux/imx-media.h
-F:	include/media/imx.h
 
 MEDIA DRIVERS FOR FREESCALE IMX7/8
 M:	Laurent Pinchart <[email protected]>
drivers/staging/media/imx/Makefile +1 -1
index 330e0825f506..fe2001a76f7a 100644
@@ -6,7 +6,7 @@ imx6-media-objs := imx-media-dev.o imx-media-internal-sd.o \
 	imx-ic-common.o imx-ic-prp.o imx-ic-prpencvf.o imx-media-vdic.o \
 	imx-media-csc-scaler.o
 
-imx6-media-csi-objs := imx-media-csi.o imx-media-fim.o
+imx6-media-csi-objs := imx-media-csi.o
 
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx6-media.o
drivers/staging/media/imx/TODO deleted +0 -3
deleted file mode 100644
index 43cd030d4bbd..000000000000
@@ -1,3 +0,0 @@
-
-- The Frame Interval Monitor could be exported to v4l2-core for
-  general use.
drivers/staging/media/imx/imx-ic-prp.c +0 -1
index b2c648149964..d2f54b42ebde 100644
@@ -18,7 +18,6 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-subdev.h>
-#include <media/imx.h>
 #include "imx-media.h"
 #include "imx-ic.h"
 
drivers/staging/media/imx/imx-media-capture.c +0 -17
index 2bd3f336b36b..217e57532a8c 100644
@@ -21,7 +21,6 @@
 #include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
 #include <video/imx-ipu-v3.h>
-#include <media/imx.h>
 #include "imx-media.h"
 
 #define IMX_CAPTURE_NAME "imx-capture"
@@ -282,17 +281,6 @@ static int capture_g_selection(struct file *file, void *fh,
 	return 0;
 }
 
-static int capture_subscribe_event(struct v4l2_fh *fh,
-				   const struct v4l2_event_subscription *sub)
-{
-	switch (sub->type) {
-	case V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR:
-		return v4l2_event_subscribe(fh, sub, 0, NULL);
-	default:
-		return -EINVAL;
-	}
-}
-
 static const struct v4l2_ioctl_ops capture_ioctl_ops = {
 	.vidioc_querycap		= capture_querycap,
 
@@ -314,9 +302,6 @@ static const struct v4l2_ioctl_ops capture_ioctl_ops = {
 	.vidioc_expbuf			= vb2_ioctl_expbuf,
 	.vidioc_streamon		= vb2_ioctl_streamon,
 	.vidioc_streamoff		= vb2_ioctl_streamoff,
-
-	.vidioc_subscribe_event		= capture_subscribe_event,
-	.vidioc_unsubscribe_event	= v4l2_event_unsubscribe,
 };
 
 /* -----------------------------------------------------------------------------
@@ -431,8 +416,6 @@ static int capture_legacy_subscribe_event(struct v4l2_fh *fh,
 					  const struct v4l2_event_subscription *sub)
 {
 	switch (sub->type) {
-	case V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR:
-		return v4l2_event_subscribe(fh, sub, 0, NULL);
 	case V4L2_EVENT_SOURCE_CHANGE:
 		return v4l2_src_change_event_subscribe(fh, sub);
 	default:
drivers/staging/media/imx/imx-media-csi.c +6 -70

215 lines not on this page · raw message

drivers/staging/media/imx/imx-media-dev.c +0 -1
index a8f39319bd8a..287c9b97f9ad 100644
@@ -8,7 +8,6 @@
 #include <linux/platform_device.h>
 #include <media/v4l2-async.h>
 #include <media/v4l2-event.h>
-#include <media/imx.h>
 #include "imx-media.h"
 
 static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)
drivers/staging/media/imx/imx-media-fim.c deleted +0 -430

430 lines not on this page · raw message

drivers/staging/media/imx/imx-media-vdic.c +0 -1
index 8dcbb6fe7649..a4f70a9e5ebc 100644
@@ -9,7 +9,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-mc.h>
 #include <media/v4l2-subdev.h>
-#include <media/imx.h>
 #include "imx-media.h"
 
 /*
drivers/staging/media/imx/imx-media.h +0 -10
index c09546fcf080..c641ba6757a3 100644
@@ -234,16 +234,6 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev,
 int imx_media_dev_notifier_register(struct imx_media_dev *imxmd,
 				    const struct v4l2_async_notifier_operations *ops);
 
-/* imx-media-fim.c */
-struct imx_media_fim;
-void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp);
-void imx_media_fim_set_stream(struct imx_media_fim *fim,
-			      const struct v4l2_fract *frame_interval,
-			      bool on);
-int imx_media_fim_add_controls(struct imx_media_fim *fim);
-struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
-void imx_media_fim_free(struct imx_media_fim *fim);
-
 /* imx-media-internal-sd.c */
 int imx_media_register_ipu_internal_subdevs(struct imx_media_dev *imxmd,
 					    struct v4l2_subdev *csi);
include/linux/imx-media.h deleted +0 -25
deleted file mode 100644
index e017e1779118..000000000000
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2014-2017 Mentor Graphics Inc.
- */
-
-#ifndef __LINUX_IMX_MEDIA_H__
-#define __LINUX_IMX_MEDIA_H__
-
-/*
- * events from the subdevs
- */
-#define V4L2_EVENT_IMX_CLASS                V4L2_EVENT_PRIVATE_START
-#define V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR (V4L2_EVENT_IMX_CLASS + 1)
-
-enum imx_ctrl_id {
-	V4L2_CID_IMX_FIM_ENABLE = (V4L2_CID_USER_IMX_BASE + 0),
-	V4L2_CID_IMX_FIM_NUM,
-	V4L2_CID_IMX_FIM_TOLERANCE_MIN,
-	V4L2_CID_IMX_FIM_TOLERANCE_MAX,
-	V4L2_CID_IMX_FIM_NUM_SKIP,
-	V4L2_CID_IMX_FIM_ICAP_EDGE,
-	V4L2_CID_IMX_FIM_ICAP_CHANNEL,
-};
-
-#endif
include/media/imx.h deleted +0 -11
deleted file mode 100644
index 5f14acdd7f4b..000000000000
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2014-2017 Mentor Graphics Inc.
- */
-
-#ifndef __MEDIA_IMX_H__
-#define __MEDIA_IMX_H__
-
-#include <linux/imx-media.h>
-
-#endif
Signature · 1 line
2.53.0
#4 lore raw
In reply to Jiaqi Shi
Quoted 15 lines · Jiaqi Shi

Changes in v9:
- Split the previous cleanup into three smaller patches as requested by
Frank: control inheritance removal, format handling rework, and FIM removal.
- imx_media_capture_device_remove() removal is a consequence of dropping the per-video-device control handler, not a separate bug fix; the original error paths had no leak.

The result is identical to v8 apart from the commit split.

Validation:
- builds on media-committers next; applies cleanly with git am
- checkpatch.pl --strict is clean
- i.MX register-level and hardware DMA paths remain untested

Quoted 5 lines

Jiaqi Shi (3):
media: imx: remove subdev control inheritance to capture video nodes
media: imx: drop legacy capture format handling and validate formats
media: imx: remove frame interval monitor

Basic look good, I need some time to find a board to run a test for it.

I hope more peoples can join review.

Frank

Quoted 29 lines
 Documentation/admin-guide/media/imx.rst       |  31 +-
 .../userspace-api/media/drivers/imx-uapi.rst  | 125 -----
 .../userspace-api/media/drivers/index.rst     |   1 -
 MAINTAINERS                                   |   2 -
 drivers/staging/media/imx/Makefile            |   2 +-
 drivers/staging/media/imx/TODO                |  13 -
 drivers/staging/media/imx/imx-ic-prp.c        |   1 -
 drivers/staging/media/imx/imx-ic-prpencvf.c   |  11 +-
 drivers/staging/media/imx/imx-media-capture.c | 418 ++++++-----------
 drivers/staging/media/imx/imx-media-csi.c     |  84 +---
 .../staging/media/imx/imx-media-dev-common.c  | 113 +----
 drivers/staging/media/imx/imx-media-dev.c     |   1 -
 drivers/staging/media/imx/imx-media-fim.c     | 430 ------------------
 drivers/staging/media/imx/imx-media-utils.c   |   9 +-
 drivers/staging/media/imx/imx-media-vdic.c    |   1 -
 drivers/staging/media/imx/imx-media.h         |  21 +-
 include/linux/imx-media.h                     |  25 -
 include/media/imx.h                           |  11 -
 18 files changed, 182 insertions(+), 1117 deletions(-)
 delete mode 100644 Documentation/userspace-api/media/drivers/imx-uapi.rst
 delete mode 100644 drivers/staging/media/imx/TODO
 delete mode 100644 drivers/staging/media/imx/imx-media-fim.c
 delete mode 100644 include/linux/imx-media.h
 delete mode 100644 include/media/imx.h

--
2.53.0

#5 lore raw
Quoted 22 lines · Frank Li
Quoted 15 lines · Jiaqi Shi

Changes in v9:
- Split the previous cleanup into three smaller patches as requested by
Frank: control inheritance removal, format handling rework, and FIM removal.
- imx_media_capture_device_remove() removal is a consequence of dropping the per-video-device control handler, not a separate bug fix; the original error paths had no leak.

The result is identical to v8 apart from the commit split.

Validation:
- builds on media-committers next; applies cleanly with git am
- checkpatch.pl --strict is clean
- i.MX register-level and hardware DMA paths remain untested

Quoted 5 lines

Jiaqi Shi (3):
media: imx: remove subdev control inheritance to capture video nodes
media: imx: drop legacy capture format handling and validate formats
media: imx: remove frame interval monitor

Quoted 4 lines

Basic look good, I need some time to find a board to run a test for it.

I hope more peoples can join review.

I do have an i.MX6 SabreLite board with the OV5640 sensor, and I can ressurect it for testing the series on the weekend. Is it known, if this changeset has been tested on some hardware?

Signature · 2 lines
Best wishes,
Vladimir