Skip to contentSkip to conversation

media: imx: staging cleanup and remove frame interval monitor

PATCH Superseded Jiaqi Shi 2 participants 4 messages Dec 1

Subsystems (4)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Jiaqi Shi

author
#0 lore raw

v7 cover media: imx: staging cleanup and remove frame interval monitor

Changes in v7:
- As requested by Hans, do not export the frame interval monitor to v4l2-core. Instead remove it entirely: it is disabled by default, is only used by the CSI driver, has no documentation of a real use-case, and its private controls/event have no standard equivalent.
- Keep the legacy video node control and format handling removal. Per Frank's review, legacy_api is left enabled: the remaining legacy-only ioctls (STD, frame-interval) are outside the TODO scope, and the MC path does not yet implement g_selection or SOURCE_CHANGE, so switching would silently drop them. A full legacy removal can be a follow-up.

This series cleans up the i.MX staging media driver by removing the legacy control inheritance and source-dependent format handling from capture video nodes, and by dropping the i.MX-private frame interval monitor.

Validation:
- allmodconfig build and sparse on drivers/staging/media and drivers/media
- checkpatch.pl --strict is clean
- i.MX register-level and hardware DMA paths remain untested

Jiaqi Shi (2):
media: imx: remove legacy video node control and format handling
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     |  72 +--
 .../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     | 431 ------------------
 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, 181 insertions(+), 1107 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 v7 1/2 media: imx: remove legacy video node control and format handling

Remove control inheritance from pipeline subdevices to video nodes. Userspace should access controls through subdev nodes instead.

Use source-independent format ioctls for all capture nodes and initialize them to the existing UYVY 640x480 default instead of the source subdev active format. Keep stream-time format validation.

Update the usage documentation and remove the completed TODO entries.

---
 Documentation/admin-guide/media/imx.rst       |  20 +-
 drivers/staging/media/imx/TODO                |  10 -
 drivers/staging/media/imx/imx-ic-prpencvf.c   |  10 +-
 drivers/staging/media/imx/imx-media-capture.c | 401 +++++++-----------
 drivers/staging/media/imx/imx-media-csi.c     |  10 +-
 .../staging/media/imx/imx-media-dev-common.c  | 113 +----
 drivers/staging/media/imx/imx-media-utils.c   |   9 +-
 drivers/staging/media/imx/imx-media.h         |  11 +-
 8 files changed, 177 insertions(+), 407 deletions(-)
Documentation/admin-guide/media/imx.rst +8 -12
index bb68100d8acb..812c6ac09ab8 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:
@@ -483,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.
@@ -510,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.
@@ -541,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.
@@ -568,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.
@@ -652,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 -10
index 11c9e10d34ae..43cd030d4bbd 100644
@@ -1,13 +1,3 @@
 
 - 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 +4 -6
index ceb5ea40ebe1..6a5b709b027d 100644
@@ -203,7 +203,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 +362,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;
 
 	/*
@@ -1280,13 +1281,13 @@ 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);
 
 	ret = imx_media_capture_device_register(priv->vdev, 0);
 	if (ret)
-		goto remove_vdev;
+		return ret;
 
 	ret = prp_init_controls(priv);
 	if (ret)
@@ -1296,8 +1297,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;
 }
 
@@ -1306,7 +1305,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 +148 -253

584 lines not on this page · raw message

drivers/staging/media/imx/imx-media-csi.c +4 -6
index 34827f96067a..c30fd5c37b53 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;
@@ -1823,12 +1824,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 +1841,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-utils.c +7 -2
index 7bdcb88a686b..7cd69a698124 100644
@@ -522,6 +522,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,
@@ -562,8 +563,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 +5 -6
index 537558a7bece..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;
@@ -125,10 +127,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)
@@ -270,8 +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);
-void imx_media_capture_device_remove(struct imx_media_video_dev *vdev);
+			      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
#2 lore raw

PATCH v7 2/2 media: imx: remove frame interval monitor

In reply to Jiaqi Shi

The frame interval monitor is an i.MX-private feature that measures CSI frame intervals using private controls and a private event. It is disabled by default, is only wired into the CSI driver, and aside from the driver-specific UAPI page has no documentation.

There is no evidence of a real userspace consumer, and the media maintainer considers it dubious for v4l2-core. Remove it rather than exporting it to the core as previously suggested in the TODO.

This drops imx-media-fim.c, the private control and event definitions in include/linux/imx-media.h along with the include/media/imx.h wrapper, the CSI integration, the capture event subscriptions, the driver-specific UAPI documentation, and the remaining TODO entry.

---
 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-ic-prpencvf.c   |   1 -
 drivers/staging/media/imx/imx-media-capture.c |  17 -
 drivers/staging/media/imx/imx-media-csi.c     |  64 +--
 drivers/staging/media/imx/imx-media-dev.c     |   1 -
 drivers/staging/media/imx/imx-media-fim.c     | 431 ------------------
 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 -
 16 files changed, 7 insertions(+), 703 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 d738990161bd..60468896a42d 100644
@@ -16785,8 +16785,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 4c0aee369025..9673b31e1118 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-ic-prpencvf.c +0 -1
index 6a5b709b027d..1b77c210766d 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"
 
drivers/staging/media/imx/imx-media-capture.c +0 -17
index 409520b01d85..242b40dd31fe 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 +5 -59

161 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 -431

431 lines not on this page · raw message

drivers/staging/media/imx/imx-media-vdic.c +0 -1
index 4838d11f5f6d..da24a6329933 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
#3 lore raw

Re: [PATCH v7 2/2] media: imx: remove frame interval monitor

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] media: imx: leftover ctrl_hdlr and event flag in csi_link_setup() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] media: imx: leftover ctrl_hdlr and event flag in csi_link_setup()
--

commit 6f716e2afb6327485ec2c915b81e9c49fba76201
Author: Jiaqi Shi <[email protected]>

media: imx: remove frame interval monitor

This commit removes the i.MX-private frame interval monitor (FIM), its controls and event definitions, its CSI and capture integrations, and its documentation and TODO entry.

Quoted 4 lines
drivers/staging/media/imx/imx-media-csi.c +0 -0
index c30fd5c37b536..8b8451ae2cf5e 100644

[ ... ]

Quoted 13 lines
drivers/staging/media/imx/imx-media-csi.c +0 -6
@@ -1115,12 +1096,6 @@ static int csi_link_setup(struct media_entity *entity,
 			goto out;
 		}
 
-		if (priv->fim) {
-			ret = imx_media_fim_add_controls(priv->fim);
-			if (ret)
-				goto out;
-		}
-
 		priv->dest = IPU_CSI_DEST_IDMAC;
 	} else {
 		if (!is_media_entity_v4l2_subdev(remote->entity)) {

[ ... ]

Quoted 13 lines
drivers/staging/media/imx/imx-media-csi.c +0 -5
@@ -1877,11 +1829,6 @@ static const struct media_entity_operations csi_entity_ops = {
 	.get_fwnode_pad = csi_get_fwnode_pad,
 };
 
-static const struct v4l2_subdev_core_ops csi_core_ops = {
-	.subscribe_event = csi_subscribe_event,
-	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
-};
-
 static const struct v4l2_subdev_video_ops csi_video_ops = {
 	.s_stream = csi_s_stream,
 };

drivers/staging/media/imx/imx-media-csi.c static const struct v4l2_subdev_pad_ops csi_pad_ops = { · line 1852

Quoted 7 lines
drivers/staging/media/imx/imx-media-csi.c +0 -1
@@ -1900,7 +1847,6 @@ static const struct v4l2_subdev_pad_ops csi_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops csi_subdev_ops = {
-	.core = &csi_core_ops,
 	.video = &csi_video_ops,
 	.pad = &csi_pad_ops,
 };

[Severity: Low]
With FIM and csi_core_ops removed, the CSI subdev has no remaining controls or events, so should priv->ctrl_hdlr and V4L2_SUBDEV_FL_HAS_EVENTS be removed as well?

imx_csi_probe() still sets V4L2_SUBDEV_FL_HAS_EVENTS on priv->sd.flags and attaches priv->ctrl_hdlr to priv->sd.ctrl_handler, and disabling a source pad link in csi_link_setup() still tears down and re-initializes the empty handler:

drivers/staging/media/imx/imx-media-csi.c:csi_link_setup() {
    ...
	if (flags & MEDIA_LNK_FL_ENABLED) {
		if (priv->sink) {
			ret = -EBUSY;
			goto out;
		}
	} else {
		v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
		v4l2_ctrl_handler_init(&priv->ctrl_hdlr, 0);
		priv->sink = NULL;
    ...
}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2