All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] media: imx: imx7-media-csi: Destage driver
@ 2022-09-07 20:04 Laurent Pinchart
  2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

Hello,

This patch series is the last step of the imx7-media-csi driver
destaging journey. Patch 1/6 starts by decoupling the imx7-media-csi and
imx8mq-mipi-csi2 drivers in Kconfig, and patch 2/6 performs the
destaging. Patches 3/6 to 6/6 then handle the low-hanging fruits of the
staging imx cleanup by dropping features that were only used by the
imx7-media-csi driver.

The patches apply on top of [1].

https://lore.kernel.org/linux-media/20220907191547.19255-1-laurent.pinchart@ideasonboard.com

Laurent Pinchart (6):
  media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  media: imx: Unstage the imx7-media-csi driver
  staging: media: imx: Drop imx_media_subdev_bound()
  staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI
  staging: media: imx: Drop unused helper functions
  staging: media: imx: Make imx_media_of_add_csi() static

 MAINTAINERS                                   |  2 +-
 drivers/media/platform/nxp/Kconfig            | 13 ++++
 drivers/media/platform/nxp/Makefile           |  1 +
 .../platform/nxp}/imx7-media-csi.c            | 24 +++++++
 drivers/staging/media/imx/Kconfig             | 17 +++--
 drivers/staging/media/imx/Makefile            |  3 +-
 drivers/staging/media/imx/TODO                | 29 --------
 .../staging/media/imx/imx-media-dev-common.c  | 14 ----
 drivers/staging/media/imx/imx-media-of.c      |  5 +-
 drivers/staging/media/imx/imx-media-utils.c   | 68 -------------------
 drivers/staging/media/imx/imx-media.h         | 13 ----
 11 files changed, 52 insertions(+), 137 deletions(-)
 rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  3:58   ` paul.elder
  2022-09-09 18:22   ` Laurent Pinchart
  2022-09-07 20:04 ` [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver Laurent Pinchart
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The imx8mq-mipi-csi2 driver targets SoCs that also run the
imx7-media-csi driver, but they are distinct. Decouple them in Kconfig
to prepare for destaging of the imx7-media-csi driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++
 drivers/staging/media/imx/Makefile |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
index 0bacac302d7e..bfb849701489 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI
 	  i.MX6UL/L, i.MX7 or i.MX8M.
 endmenu
 endif
+
+config VIDEO_IMX8MQ_MIPI_CSI2
+	tristate "NXP i.MX8MQ MIPI CSI-2 receiver"
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on VIDEO_DEV
+	select MEDIA_CONTROLLER
+	select V4L2_FWNODE
+	select VIDEO_V4L2_SUBDEV_API
+	help
+	  V4L2 driver for the MIPI CSI-2 receiver found in the i.MX8MQ SoC.
diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
index d82be898145b..cef9f30eb401 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -15,4 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
-obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
+obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
  2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  4:04   ` paul.elder
  2022-09-08 15:06   ` Rui Miguel Silva
  2022-09-07 20:04 ` [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound() Laurent Pinchart
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The imx7-media-csi driver, currently in staging, is ready for
prime-time. The staging TODO file lists a few items specific to that
driver, that are already addressed (the "all of the above" part) or can
be addressed later:

- The frame interval monitoring support is a software mechanism to
  monitor the device for unexpected stalls, and should be part of the
  V4L2 core if desired.

- Restricting the support media bus formats based on the SoC integration
  only aims at reducing userspace confusion by not enumerating options
  that are known not to be possible, it won't cause regressions if
  handled later.

Move the description of the media bus format restriction TODO item to
the driver, drop the other TODO items, and move the driver out of
staging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 MAINTAINERS                                   |  2 +-
 drivers/media/platform/nxp/Kconfig            | 13 +++++++++
 drivers/media/platform/nxp/Makefile           |  1 +
 .../platform/nxp}/imx7-media-csi.c            | 24 +++++++++++++++
 drivers/staging/media/imx/Kconfig             |  7 -----
 drivers/staging/media/imx/Makefile            |  1 -
 drivers/staging/media/imx/TODO                | 29 -------------------
 7 files changed, 39 insertions(+), 38 deletions(-)
 rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 338c155f60ef..1dfa1d51955c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12595,7 +12595,7 @@ F:	Documentation/admin-guide/media/imx7.rst
 F:	Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
 F:	Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
 F:	drivers/media/platform/nxp/imx-mipi-csis.c
-F:	drivers/staging/media/imx/imx7-media-csi.c
+F:	drivers/media/platform/nxp/imx7-media-csi.c
 
 MEDIA DRIVERS FOR HELENE
 M:	Abylay Ospan <aospan@netup.ru>
diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig
index 1ac0a6e91111..3aa4207bcd41 100644
--- a/drivers/media/platform/nxp/Kconfig
+++ b/drivers/media/platform/nxp/Kconfig
@@ -4,6 +4,19 @@
 
 comment "NXP media platform drivers"
 
+config VIDEO_IMX7_CSI
+	tristate "NXP CSI Bridge driver"
+	depends on ARCH_MXC || COMPILE_TEST
+	depends on HAS_DMA
+	depends on VIDEO_DEV
+	select MEDIA_CONTROLLER
+	select V4L2_FWNODE
+	select VIDEOBUF2_DMA_CONTIG
+	select VIDEO_V4L2_SUBDEV_API
+	help
+	  Driver for the NXP Camera Sensor Interface (CSI) Bridge. This device
+	  is found in the i.MX6UL/L, i.MX7 and i.MX8M[MQ] SoCs.
+
 config VIDEO_IMX_MIPI_CSIS
 	tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models"
 	depends on ARCH_MXC || COMPILE_TEST
diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile
index efc38c6578ce..92cb8f4c215e 100644
--- a/drivers/media/platform/nxp/Makefile
+++ b/drivers/media/platform/nxp/Makefile
@@ -2,6 +2,7 @@
 
 obj-y += imx-jpeg/
 
+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
 obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
 obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o
diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
similarity index 97%
rename from drivers/staging/media/imx/imx7-media-csi.c
rename to drivers/media/platform/nxp/imx7-media-csi.c
index 21d6e56ffcd4..72de9fc9862a 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -807,6 +807,30 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)
  * List of supported pixel formats for the subdevs. Keep V4L2_PIX_FMT_UYVY and
  * MEDIA_BUS_FMT_UYVY8_2X8 first to match IMX7_CSI_DEF_PIX_FORMAT and
  * IMX7_CSI_DEF_MBUS_CODE.
+ *
+ * TODO: Restrict the supported formats list based on the SoC integration.
+ *
+ * The CSI bridge can be configured to sample pixel components from the Rx queue
+ * in single (8bpp) or double (16bpp) component modes. Image format variants
+ * with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the pixel
+ * components sampling size per each clock cycle and their packing mode (see
+ * imx7_csi_configure() for details).
+ *
+ * As the CSI bridge can be interfaced with different IP blocks depending on the
+ * SoC model it is integrated on, the Rx queue sampling size should match the
+ * size of the samples transferred by the transmitting IP block. To avoid
+ * misconfigurations of the capture pipeline, the enumeration of the supported
+ * formats should be restricted to match the pixel source transmitting mode.
+ *
+ * Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
+ * receiver which operates in dual pixel sampling mode. The CSI bridge should
+ * only expose the 1X16 formats variant which instructs it to operate in dual
+ * pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
+ * which supports both serial and parallel input, it should expose both
+ * variants.
+ *
+ * This currently only applies to YUYV formats, but other formats might need to
+ * be handled in the same way.
  */
 static const struct imx7_csi_pixfmt pixel_formats[] = {
 	/*** YUV formats start here ***/
diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
index bfb849701489..21fd79515042 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -23,13 +23,6 @@ config VIDEO_IMX_CSI
 	default y
 	help
 	  A video4linux camera sensor interface driver for i.MX5/6.
-
-config VIDEO_IMX7_CSI
-	tristate "i.MX6UL/L / i.MX7 / i.MX8M Camera Sensor Interface driver"
-	default y
-	help
-	  Enable support for video4linux camera sensor interface driver for
-	  i.MX6UL/L, i.MX7 or i.MX8M.
 endmenu
 endif
 
diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
index cef9f30eb401..906a422aa656 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -14,5 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
-obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
 obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
index 5d3a337c8702..afee26870af7 100644
--- a/drivers/staging/media/imx/TODO
+++ b/drivers/staging/media/imx/TODO
@@ -23,32 +23,3 @@
 - 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.
-
-- i.MX7: all of the above, since it uses the imx media core
-
-- i.MX7: use Frame Interval Monitor
-
-- imx7-media-csi: Restrict the supported formats list to the SoC version.
-
-  The imx7 CSI bridge can be configured to sample pixel components from the Rx
-  queue in single (8bpp) or double (16bpp) component modes. Image format
-  variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the
-  pixel components sampling size per each clock cycle and their packing mode
-  (see imx7_csi_configure() for details).
-
-  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
-  the SoC model it is integrated on, the Rx queue sampling size should match
-  the size of the samples transferred by the transmitting IP block.
-
-  To avoid mis-configurations of the capture pipeline, the enumeration of the
-  supported formats should be restricted to match the pixel source transmitting
-  mode.
-
-  Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
-  receiver which operates in dual pixel sampling mode. The CSI bridge should
-  only expose the 1X16 formats variant which instructs it to operate in dual
-  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
-  which supports both serial and parallel input, it should expose both variants.
-
-  This currently only applies to YUYV formats, but other formats might need
-  to be handled in the same way.
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound()
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
  2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
  2022-09-07 20:04 ` [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  4:08   ` paul.elder
  2022-09-07 20:04 ` [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI Laurent Pinchart
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The imx_media_subdev_bound() function is a no-op, and the async notifier
.bound() operation is optional. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-dev-common.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c
index e6d6ed3b1161..8f7ced3a9cca 100644
--- a/drivers/staging/media/imx/imx-media-dev-common.c
+++ b/drivers/staging/media/imx/imx-media-dev-common.c
@@ -19,18 +19,6 @@ static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)
 	return container_of(n, struct imx_media_dev, notifier);
 }
 
-/* async subdev bound notifier */
-static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
-				  struct v4l2_subdev *sd,
-				  struct v4l2_async_subdev *asd)
-{
-	struct imx_media_dev *imxmd = notifier2dev(notifier);
-
-	dev_dbg(imxmd->md.dev, "subdev %s bound\n", sd->name);
-
-	return 0;
-}
-
 /*
  * Create the missing media links from the CSI-2 receiver.
  * Called after all async subdevs have bound.
@@ -337,7 +325,6 @@ static void imx_media_notify(struct v4l2_subdev *sd, unsigned int notification,
 }
 
 static const struct v4l2_async_notifier_operations imx_media_notifier_ops = {
-	.bound = imx_media_subdev_bound,
 	.complete = imx_media_probe_complete,
 };
 
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
                   ` (2 preceding siblings ...)
  2022-09-07 20:04 ` [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound() Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  4:10   ` paul.elder
  2022-09-07 20:04 ` [PATCH 5/6] staging: media: imx: Drop unused helper functions Laurent Pinchart
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The IMX_MEDIA_GRP_ID_CSI group ID isn't used anymore. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-dev-common.c | 1 -
 drivers/staging/media/imx/imx-media.h            | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c
index 8f7ced3a9cca..991820a8500f 100644
--- a/drivers/staging/media/imx/imx-media-dev-common.c
+++ b/drivers/staging/media/imx/imx-media-dev-common.c
@@ -39,7 +39,6 @@ static void imx_media_create_csi2_links(struct imx_media_dev *imxmd)
 	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
 		/* skip if not a CSI or a CSI mux */
 		if (!(sd->grp_id & IMX_MEDIA_GRP_ID_IPU_CSI) &&
-		    !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI) &&
 		    !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI_MUX))
 			continue;
 
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index f263fc3adbb9..5e794f291da6 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -299,7 +299,6 @@ void imx_media_csc_scaler_device_unregister(struct imx_media_video_dev *vdev);
 
 /* subdev group ids */
 #define IMX_MEDIA_GRP_ID_CSI2          BIT(8)
-#define IMX_MEDIA_GRP_ID_CSI           BIT(9)
 #define IMX_MEDIA_GRP_ID_IPU_CSI_BIT   10
 #define IMX_MEDIA_GRP_ID_IPU_CSI       (0x3 << IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
 #define IMX_MEDIA_GRP_ID_IPU_CSI0      BIT(IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/6] staging: media: imx: Drop unused helper functions
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
                   ` (3 preceding siblings ...)
  2022-09-07 20:04 ` [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  4:12   ` paul.elder
  2022-09-07 20:04 ` [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static Laurent Pinchart
  2022-09-13  9:48 ` [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Alexander Stein
  6 siblings, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The imx_media_find_subdev_by_fwnode(),
imx_media_find_subdev_by_devname(), imx_media_pipeline_csi2_channel()
and imx_media_pipeline_video_device() helper functions are not used.
Drop them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-utils.c | 68 ---------------------
 drivers/staging/media/imx/imx-media.h       | 10 ---
 2 files changed, 78 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 294c808b2ebe..07770b47e19b 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -626,36 +626,6 @@ void imx_media_grp_id_to_sd_name(char *sd_name, int sz, u32 grp_id, int ipu_id)
 }
 EXPORT_SYMBOL_GPL(imx_media_grp_id_to_sd_name);
 
-struct v4l2_subdev *
-imx_media_find_subdev_by_fwnode(struct imx_media_dev *imxmd,
-				struct fwnode_handle *fwnode)
-{
-	struct v4l2_subdev *sd;
-
-	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
-		if (sd->fwnode == fwnode)
-			return sd;
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_fwnode);
-
-struct v4l2_subdev *
-imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd,
-				 const char *devname)
-{
-	struct v4l2_subdev *sd;
-
-	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
-		if (!strcmp(devname, dev_name(sd->dev)))
-			return sd;
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_devname);
-
 /*
  * Adds a video device to the master video device list. This is called
  * when a video device is registered.
@@ -756,25 +726,6 @@ find_pipeline_entity(struct media_entity *start, u32 grp_id,
 	return pad ? pad->entity : NULL;
 }
 
-/*
- * Find the upstream mipi-csi2 virtual channel reached from the given
- * start entity in the current pipeline.
- * Must be called with mdev->graph_mutex held.
- */
-int imx_media_pipeline_csi2_channel(struct media_entity *start_entity)
-{
-	struct media_pad *pad;
-	int ret = -EPIPE;
-
-	pad = imx_media_pipeline_pad(start_entity, IMX_MEDIA_GRP_ID_CSI2,
-				     0, true);
-	if (pad)
-		ret = pad->index - 1;
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(imx_media_pipeline_csi2_channel);
-
 /*
  * Find a subdev reached upstream from the given start entity in
  * the current pipeline.
@@ -794,25 +745,6 @@ imx_media_pipeline_subdev(struct media_entity *start_entity, u32 grp_id,
 }
 EXPORT_SYMBOL_GPL(imx_media_pipeline_subdev);
 
-/*
- * Find a subdev reached upstream from the given start entity in
- * the current pipeline.
- * Must be called with mdev->graph_mutex held.
- */
-struct video_device *
-imx_media_pipeline_video_device(struct media_entity *start_entity,
-				enum v4l2_buf_type buftype, bool upstream)
-{
-	struct media_entity *me;
-
-	me = find_pipeline_entity(start_entity, 0, buftype, upstream);
-	if (!me)
-		return ERR_PTR(-ENODEV);
-
-	return media_entity_to_video_device(me);
-}
-EXPORT_SYMBOL_GPL(imx_media_pipeline_video_device);
-
 /*
  * Find a fwnode endpoint that maps to the given subdevice's pad.
  * If there are multiple endpoints that map to the pad, only the
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 5e794f291da6..5a1436dbb12d 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -201,24 +201,14 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
 				  const struct imx_media_pixfmt *cc);
 void imx_media_grp_id_to_sd_name(char *sd_name, int sz,
 				 u32 grp_id, int ipu_id);
-struct v4l2_subdev *
-imx_media_find_subdev_by_fwnode(struct imx_media_dev *imxmd,
-				struct fwnode_handle *fwnode);
-struct v4l2_subdev *
-imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd,
-				 const char *devname);
 void imx_media_add_video_device(struct imx_media_dev *imxmd,
 				struct imx_media_video_dev *vdev);
-int imx_media_pipeline_csi2_channel(struct media_entity *start_entity);
 struct media_pad *
 imx_media_pipeline_pad(struct media_entity *start_entity, u32 grp_id,
 		       enum v4l2_buf_type buftype, bool upstream);
 struct v4l2_subdev *
 imx_media_pipeline_subdev(struct media_entity *start_entity, u32 grp_id,
 			  bool upstream);
-struct video_device *
-imx_media_pipeline_video_device(struct media_entity *start_entity,
-				enum v4l2_buf_type buftype, bool upstream);
 struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad);
 
 struct imx_media_dma_buf {
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
                   ` (4 preceding siblings ...)
  2022-09-07 20:04 ` [PATCH 5/6] staging: media: imx: Drop unused helper functions Laurent Pinchart
@ 2022-09-07 20:04 ` Laurent Pinchart
  2022-09-08  4:16   ` paul.elder
  2022-09-13  9:48 ` [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Alexander Stein
  6 siblings, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-07 20:04 UTC (permalink / raw)
  To: linux-media
  Cc: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

The imx_media_of_add_csi() function is only called in its compilation
unit. Make it static and don't export it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-of.c | 5 ++---
 drivers/staging/media/imx/imx-media.h    | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
index 59f1eb7b62bc..92a99010c150 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -16,8 +16,8 @@
 #include <video/imx-ipu-v3.h>
 #include "imx-media.h"
 
-int imx_media_of_add_csi(struct imx_media_dev *imxmd,
-			 struct device_node *csi_np)
+static int imx_media_of_add_csi(struct imx_media_dev *imxmd,
+				struct device_node *csi_np)
 {
 	struct v4l2_async_subdev *asd;
 	int ret = 0;
@@ -41,7 +41,6 @@ int imx_media_of_add_csi(struct imx_media_dev *imxmd,
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(imx_media_of_add_csi);
 
 int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,
 			     struct device_node *np)
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 5a1436dbb12d..c12ecaf378fe 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -252,8 +252,6 @@ void imx_media_unregister_ipu_internal_subdevs(struct imx_media_dev *imxmd);
 /* imx-media-of.c */
 int imx_media_add_of_subdevs(struct imx_media_dev *dev,
 			     struct device_node *np);
-int imx_media_of_add_csi(struct imx_media_dev *imxmd,
-			 struct device_node *csi_np);
 
 /* imx-media-vdic.c */
 struct v4l2_subdev *imx_media_vdic_register(struct v4l2_device *v4l2_dev,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
@ 2022-09-08  3:58   ` paul.elder
  2022-09-09 18:22   ` Laurent Pinchart
  1 sibling, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  3:58 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:19PM +0300, Laurent Pinchart wrote:
> The imx8mq-mipi-csi2 driver targets SoCs that also run the
> imx7-media-csi driver, but they are distinct. Decouple them in Kconfig
> to prepare for destaging of the imx7-media-csi driver.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/Kconfig  | 10 ++++++++++
>  drivers/staging/media/imx/Makefile |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> index 0bacac302d7e..bfb849701489 100644
> --- a/drivers/staging/media/imx/Kconfig
> +++ b/drivers/staging/media/imx/Kconfig
> @@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI
>  	  i.MX6UL/L, i.MX7 or i.MX8M.
>  endmenu
>  endif
> +
> +config VIDEO_IMX8MQ_MIPI_CSI2
> +	tristate "NXP i.MX8MQ MIPI CSI-2 receiver"
> +	depends on ARCH_MXC || COMPILE_TEST
> +	depends on VIDEO_DEV
> +	select MEDIA_CONTROLLER
> +	select V4L2_FWNODE
> +	select VIDEO_V4L2_SUBDEV_API
> +	help
> +	  V4L2 driver for the MIPI CSI-2 receiver found in the i.MX8MQ SoC.
> diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> index d82be898145b..cef9f30eb401 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -15,4 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
>  
>  obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
> +obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver
  2022-09-07 20:04 ` [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver Laurent Pinchart
@ 2022-09-08  4:04   ` paul.elder
  2022-09-08 15:06   ` Rui Miguel Silva
  1 sibling, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  4:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:20PM +0300, Laurent Pinchart wrote:
> The imx7-media-csi driver, currently in staging, is ready for
> prime-time. The staging TODO file lists a few items specific to that
> driver, that are already addressed (the "all of the above" part) or can
> be addressed later:
> 
> - The frame interval monitoring support is a software mechanism to
>   monitor the device for unexpected stalls, and should be part of the
>   V4L2 core if desired.
> 
> - Restricting the support media bus formats based on the SoC integration
>   only aims at reducing userspace confusion by not enumerating options
>   that are known not to be possible, it won't cause regressions if
>   handled later.
> 
> Move the description of the media bus format restriction TODO item to
> the driver, drop the other TODO items, and move the driver out of
> staging.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  MAINTAINERS                                   |  2 +-
>  drivers/media/platform/nxp/Kconfig            | 13 +++++++++
>  drivers/media/platform/nxp/Makefile           |  1 +
>  .../platform/nxp}/imx7-media-csi.c            | 24 +++++++++++++++
>  drivers/staging/media/imx/Kconfig             |  7 -----
>  drivers/staging/media/imx/Makefile            |  1 -
>  drivers/staging/media/imx/TODO                | 29 -------------------
>  7 files changed, 39 insertions(+), 38 deletions(-)
>  rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 338c155f60ef..1dfa1d51955c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12595,7 +12595,7 @@ F:	Documentation/admin-guide/media/imx7.rst
>  F:	Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
>  F:	Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
>  F:	drivers/media/platform/nxp/imx-mipi-csis.c
> -F:	drivers/staging/media/imx/imx7-media-csi.c
> +F:	drivers/media/platform/nxp/imx7-media-csi.c
>  
>  MEDIA DRIVERS FOR HELENE
>  M:	Abylay Ospan <aospan@netup.ru>
> diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig
> index 1ac0a6e91111..3aa4207bcd41 100644
> --- a/drivers/media/platform/nxp/Kconfig
> +++ b/drivers/media/platform/nxp/Kconfig
> @@ -4,6 +4,19 @@
>  
>  comment "NXP media platform drivers"
>  
> +config VIDEO_IMX7_CSI
> +	tristate "NXP CSI Bridge driver"
> +	depends on ARCH_MXC || COMPILE_TEST
> +	depends on HAS_DMA
> +	depends on VIDEO_DEV
> +	select MEDIA_CONTROLLER
> +	select V4L2_FWNODE
> +	select VIDEOBUF2_DMA_CONTIG
> +	select VIDEO_V4L2_SUBDEV_API
> +	help
> +	  Driver for the NXP Camera Sensor Interface (CSI) Bridge. This device
> +	  is found in the i.MX6UL/L, i.MX7 and i.MX8M[MQ] SoCs.
> +
>  config VIDEO_IMX_MIPI_CSIS
>  	tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models"
>  	depends on ARCH_MXC || COMPILE_TEST
> diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile
> index efc38c6578ce..92cb8f4c215e 100644
> --- a/drivers/media/platform/nxp/Makefile
> +++ b/drivers/media/platform/nxp/Makefile
> @@ -2,6 +2,7 @@
>  
>  obj-y += imx-jpeg/
>  
> +obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
>  obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
>  obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> similarity index 97%
> rename from drivers/staging/media/imx/imx7-media-csi.c
> rename to drivers/media/platform/nxp/imx7-media-csi.c
> index 21d6e56ffcd4..72de9fc9862a 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -807,6 +807,30 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)
>   * List of supported pixel formats for the subdevs. Keep V4L2_PIX_FMT_UYVY and
>   * MEDIA_BUS_FMT_UYVY8_2X8 first to match IMX7_CSI_DEF_PIX_FORMAT and
>   * IMX7_CSI_DEF_MBUS_CODE.
> + *
> + * TODO: Restrict the supported formats list based on the SoC integration.
> + *
> + * The CSI bridge can be configured to sample pixel components from the Rx queue
> + * in single (8bpp) or double (16bpp) component modes. Image format variants
> + * with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the pixel
> + * components sampling size per each clock cycle and their packing mode (see
> + * imx7_csi_configure() for details).
> + *
> + * As the CSI bridge can be interfaced with different IP blocks depending on the
> + * SoC model it is integrated on, the Rx queue sampling size should match the
> + * size of the samples transferred by the transmitting IP block. To avoid
> + * misconfigurations of the capture pipeline, the enumeration of the supported
> + * formats should be restricted to match the pixel source transmitting mode.
> + *
> + * Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> + * receiver which operates in dual pixel sampling mode. The CSI bridge should
> + * only expose the 1X16 formats variant which instructs it to operate in dual
> + * pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> + * which supports both serial and parallel input, it should expose both
> + * variants.
> + *
> + * This currently only applies to YUYV formats, but other formats might need to
> + * be handled in the same way.
>   */
>  static const struct imx7_csi_pixfmt pixel_formats[] = {
>  	/*** YUV formats start here ***/
> diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> index bfb849701489..21fd79515042 100644
> --- a/drivers/staging/media/imx/Kconfig
> +++ b/drivers/staging/media/imx/Kconfig
> @@ -23,13 +23,6 @@ config VIDEO_IMX_CSI
>  	default y
>  	help
>  	  A video4linux camera sensor interface driver for i.MX5/6.
> -
> -config VIDEO_IMX7_CSI
> -	tristate "i.MX6UL/L / i.MX7 / i.MX8M Camera Sensor Interface driver"
> -	default y
> -	help
> -	  Enable support for video4linux camera sensor interface driver for
> -	  i.MX6UL/L, i.MX7 or i.MX8M.
>  endmenu
>  endif
>  
> diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> index cef9f30eb401..906a422aa656 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -14,5 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
>  
> -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
> index 5d3a337c8702..afee26870af7 100644
> --- a/drivers/staging/media/imx/TODO
> +++ b/drivers/staging/media/imx/TODO
> @@ -23,32 +23,3 @@
>  - 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.
> -
> -- i.MX7: all of the above, since it uses the imx media core
> -
> -- i.MX7: use Frame Interval Monitor
> -
> -- imx7-media-csi: Restrict the supported formats list to the SoC version.
> -
> -  The imx7 CSI bridge can be configured to sample pixel components from the Rx
> -  queue in single (8bpp) or double (16bpp) component modes. Image format
> -  variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the
> -  pixel components sampling size per each clock cycle and their packing mode
> -  (see imx7_csi_configure() for details).
> -
> -  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
> -  the SoC model it is integrated on, the Rx queue sampling size should match
> -  the size of the samples transferred by the transmitting IP block.
> -
> -  To avoid mis-configurations of the capture pipeline, the enumeration of the
> -  supported formats should be restricted to match the pixel source transmitting
> -  mode.
> -
> -  Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> -  receiver which operates in dual pixel sampling mode. The CSI bridge should
> -  only expose the 1X16 formats variant which instructs it to operate in dual
> -  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> -  which supports both serial and parallel input, it should expose both variants.
> -
> -  This currently only applies to YUYV formats, but other formats might need
> -  to be handled in the same way.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound()
  2022-09-07 20:04 ` [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound() Laurent Pinchart
@ 2022-09-08  4:08   ` paul.elder
  0 siblings, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  4:08 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:21PM +0300, Laurent Pinchart wrote:
> The imx_media_subdev_bound() function is a no-op, and the async notifier
> .bound() operation is optional. Drop it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/imx-media-dev-common.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c
> index e6d6ed3b1161..8f7ced3a9cca 100644
> --- a/drivers/staging/media/imx/imx-media-dev-common.c
> +++ b/drivers/staging/media/imx/imx-media-dev-common.c
> @@ -19,18 +19,6 @@ static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)
>  	return container_of(n, struct imx_media_dev, notifier);
>  }
>  
> -/* async subdev bound notifier */
> -static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
> -				  struct v4l2_subdev *sd,
> -				  struct v4l2_async_subdev *asd)
> -{
> -	struct imx_media_dev *imxmd = notifier2dev(notifier);
> -
> -	dev_dbg(imxmd->md.dev, "subdev %s bound\n", sd->name);
> -
> -	return 0;
> -}
> -
>  /*
>   * Create the missing media links from the CSI-2 receiver.
>   * Called after all async subdevs have bound.
> @@ -337,7 +325,6 @@ static void imx_media_notify(struct v4l2_subdev *sd, unsigned int notification,
>  }
>  
>  static const struct v4l2_async_notifier_operations imx_media_notifier_ops = {
> -	.bound = imx_media_subdev_bound,
>  	.complete = imx_media_probe_complete,
>  };
>  

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI
  2022-09-07 20:04 ` [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI Laurent Pinchart
@ 2022-09-08  4:10   ` paul.elder
  0 siblings, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  4:10 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:22PM +0300, Laurent Pinchart wrote:
> The IMX_MEDIA_GRP_ID_CSI group ID isn't used anymore. Drop it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/imx-media-dev-common.c | 1 -
>  drivers/staging/media/imx/imx-media.h            | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c
> index 8f7ced3a9cca..991820a8500f 100644
> --- a/drivers/staging/media/imx/imx-media-dev-common.c
> +++ b/drivers/staging/media/imx/imx-media-dev-common.c
> @@ -39,7 +39,6 @@ static void imx_media_create_csi2_links(struct imx_media_dev *imxmd)
>  	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
>  		/* skip if not a CSI or a CSI mux */
>  		if (!(sd->grp_id & IMX_MEDIA_GRP_ID_IPU_CSI) &&
> -		    !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI) &&
>  		    !(sd->grp_id & IMX_MEDIA_GRP_ID_CSI_MUX))
>  			continue;
>  
> diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> index f263fc3adbb9..5e794f291da6 100644
> --- a/drivers/staging/media/imx/imx-media.h
> +++ b/drivers/staging/media/imx/imx-media.h
> @@ -299,7 +299,6 @@ void imx_media_csc_scaler_device_unregister(struct imx_media_video_dev *vdev);
>  
>  /* subdev group ids */
>  #define IMX_MEDIA_GRP_ID_CSI2          BIT(8)
> -#define IMX_MEDIA_GRP_ID_CSI           BIT(9)
>  #define IMX_MEDIA_GRP_ID_IPU_CSI_BIT   10
>  #define IMX_MEDIA_GRP_ID_IPU_CSI       (0x3 << IMX_MEDIA_GRP_ID_IPU_CSI_BIT)
>  #define IMX_MEDIA_GRP_ID_IPU_CSI0      BIT(IMX_MEDIA_GRP_ID_IPU_CSI_BIT)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] staging: media: imx: Drop unused helper functions
  2022-09-07 20:04 ` [PATCH 5/6] staging: media: imx: Drop unused helper functions Laurent Pinchart
@ 2022-09-08  4:12   ` paul.elder
  0 siblings, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  4:12 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:23PM +0300, Laurent Pinchart wrote:
> The imx_media_find_subdev_by_fwnode(),
> imx_media_find_subdev_by_devname(), imx_media_pipeline_csi2_channel()
> and imx_media_pipeline_video_device() helper functions are not used.
> Drop them.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/imx-media-utils.c | 68 ---------------------
>  drivers/staging/media/imx/imx-media.h       | 10 ---
>  2 files changed, 78 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
> index 294c808b2ebe..07770b47e19b 100644
> --- a/drivers/staging/media/imx/imx-media-utils.c
> +++ b/drivers/staging/media/imx/imx-media-utils.c
> @@ -626,36 +626,6 @@ void imx_media_grp_id_to_sd_name(char *sd_name, int sz, u32 grp_id, int ipu_id)
>  }
>  EXPORT_SYMBOL_GPL(imx_media_grp_id_to_sd_name);
>  
> -struct v4l2_subdev *
> -imx_media_find_subdev_by_fwnode(struct imx_media_dev *imxmd,
> -				struct fwnode_handle *fwnode)
> -{
> -	struct v4l2_subdev *sd;
> -
> -	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
> -		if (sd->fwnode == fwnode)
> -			return sd;
> -	}
> -
> -	return NULL;
> -}
> -EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_fwnode);
> -
> -struct v4l2_subdev *
> -imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd,
> -				 const char *devname)
> -{
> -	struct v4l2_subdev *sd;
> -
> -	list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
> -		if (!strcmp(devname, dev_name(sd->dev)))
> -			return sd;
> -	}
> -
> -	return NULL;
> -}
> -EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_devname);
> -
>  /*
>   * Adds a video device to the master video device list. This is called
>   * when a video device is registered.
> @@ -756,25 +726,6 @@ find_pipeline_entity(struct media_entity *start, u32 grp_id,
>  	return pad ? pad->entity : NULL;
>  }
>  
> -/*
> - * Find the upstream mipi-csi2 virtual channel reached from the given
> - * start entity in the current pipeline.
> - * Must be called with mdev->graph_mutex held.
> - */
> -int imx_media_pipeline_csi2_channel(struct media_entity *start_entity)
> -{
> -	struct media_pad *pad;
> -	int ret = -EPIPE;
> -
> -	pad = imx_media_pipeline_pad(start_entity, IMX_MEDIA_GRP_ID_CSI2,
> -				     0, true);
> -	if (pad)
> -		ret = pad->index - 1;
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL_GPL(imx_media_pipeline_csi2_channel);
> -
>  /*
>   * Find a subdev reached upstream from the given start entity in
>   * the current pipeline.
> @@ -794,25 +745,6 @@ imx_media_pipeline_subdev(struct media_entity *start_entity, u32 grp_id,
>  }
>  EXPORT_SYMBOL_GPL(imx_media_pipeline_subdev);
>  
> -/*
> - * Find a subdev reached upstream from the given start entity in
> - * the current pipeline.
> - * Must be called with mdev->graph_mutex held.
> - */
> -struct video_device *
> -imx_media_pipeline_video_device(struct media_entity *start_entity,
> -				enum v4l2_buf_type buftype, bool upstream)
> -{
> -	struct media_entity *me;
> -
> -	me = find_pipeline_entity(start_entity, 0, buftype, upstream);
> -	if (!me)
> -		return ERR_PTR(-ENODEV);
> -
> -	return media_entity_to_video_device(me);
> -}
> -EXPORT_SYMBOL_GPL(imx_media_pipeline_video_device);
> -
>  /*
>   * Find a fwnode endpoint that maps to the given subdevice's pad.
>   * If there are multiple endpoints that map to the pad, only the
> diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> index 5e794f291da6..5a1436dbb12d 100644
> --- a/drivers/staging/media/imx/imx-media.h
> +++ b/drivers/staging/media/imx/imx-media.h
> @@ -201,24 +201,14 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
>  				  const struct imx_media_pixfmt *cc);
>  void imx_media_grp_id_to_sd_name(char *sd_name, int sz,
>  				 u32 grp_id, int ipu_id);
> -struct v4l2_subdev *
> -imx_media_find_subdev_by_fwnode(struct imx_media_dev *imxmd,
> -				struct fwnode_handle *fwnode);
> -struct v4l2_subdev *
> -imx_media_find_subdev_by_devname(struct imx_media_dev *imxmd,
> -				 const char *devname);
>  void imx_media_add_video_device(struct imx_media_dev *imxmd,
>  				struct imx_media_video_dev *vdev);
> -int imx_media_pipeline_csi2_channel(struct media_entity *start_entity);
>  struct media_pad *
>  imx_media_pipeline_pad(struct media_entity *start_entity, u32 grp_id,
>  		       enum v4l2_buf_type buftype, bool upstream);
>  struct v4l2_subdev *
>  imx_media_pipeline_subdev(struct media_entity *start_entity, u32 grp_id,
>  			  bool upstream);
> -struct video_device *
> -imx_media_pipeline_video_device(struct media_entity *start_entity,
> -				enum v4l2_buf_type buftype, bool upstream);
>  struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad);
>  
>  struct imx_media_dma_buf {

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static
  2022-09-07 20:04 ` [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static Laurent Pinchart
@ 2022-09-08  4:16   ` paul.elder
  0 siblings, 0 replies; 20+ messages in thread
From: paul.elder @ 2022-09-08  4:16 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Jacopo Mondi, kernel, linux-imx

On Wed, Sep 07, 2022 at 11:04:24PM +0300, Laurent Pinchart wrote:
> The imx_media_of_add_csi() function is only called in its compilation
> unit. Make it static and don't export it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/imx-media-of.c | 5 ++---
>  drivers/staging/media/imx/imx-media.h    | 2 --
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
> index 59f1eb7b62bc..92a99010c150 100644
> --- a/drivers/staging/media/imx/imx-media-of.c
> +++ b/drivers/staging/media/imx/imx-media-of.c
> @@ -16,8 +16,8 @@
>  #include <video/imx-ipu-v3.h>
>  #include "imx-media.h"
>  
> -int imx_media_of_add_csi(struct imx_media_dev *imxmd,
> -			 struct device_node *csi_np)
> +static int imx_media_of_add_csi(struct imx_media_dev *imxmd,
> +				struct device_node *csi_np)
>  {
>  	struct v4l2_async_subdev *asd;
>  	int ret = 0;
> @@ -41,7 +41,6 @@ int imx_media_of_add_csi(struct imx_media_dev *imxmd,
>  
>  	return ret;
>  }
> -EXPORT_SYMBOL_GPL(imx_media_of_add_csi);
>  
>  int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,
>  			     struct device_node *np)
> diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> index 5a1436dbb12d..c12ecaf378fe 100644
> --- a/drivers/staging/media/imx/imx-media.h
> +++ b/drivers/staging/media/imx/imx-media.h
> @@ -252,8 +252,6 @@ void imx_media_unregister_ipu_internal_subdevs(struct imx_media_dev *imxmd);
>  /* imx-media-of.c */
>  int imx_media_add_of_subdevs(struct imx_media_dev *dev,
>  			     struct device_node *np);
> -int imx_media_of_add_csi(struct imx_media_dev *imxmd,
> -			 struct device_node *csi_np);
>  
>  /* imx-media-vdic.c */
>  struct v4l2_subdev *imx_media_vdic_register(struct v4l2_device *v4l2_dev,

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver
  2022-09-07 20:04 ` [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver Laurent Pinchart
  2022-09-08  4:04   ` paul.elder
@ 2022-09-08 15:06   ` Rui Miguel Silva
  2022-09-08 15:18     ` Laurent Pinchart
  1 sibling, 1 reply; 20+ messages in thread
From: Rui Miguel Silva @ 2022-09-08 15:06 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

Hi Laurent,
Thanks for doing this work.

On Wed, Sep 07, 2022 at 11:04:20PM +0300, Laurent Pinchart wrote:
> The imx7-media-csi driver, currently in staging, is ready for
> prime-time. The staging TODO file lists a few items specific to that
> driver, that are already addressed (the "all of the above" part) or can
> be addressed later:
> 
> - The frame interval monitoring support is a software mechanism to
>   monitor the device for unexpected stalls, and should be part of the
>   V4L2 core if desired.
> 
> - Restricting the support media bus formats based on the SoC integration
>   only aims at reducing userspace confusion by not enumerating options
>   that are known not to be possible, it won't cause regressions if
>   handled later.
> 
> Move the description of the media bus format restriction TODO item to
> the driver, drop the other TODO items, and move the driver out of
> staging.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

For this imx7 work everything looks ok, with one exception:
Need to update file entry in MAINTAINERS file. (also I noticed that
there isn't an entry for the imx8 csi2 in that file also, but that is
a different story).

With that fixed:

Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>

Cheers,
   Rui

> ---
>  MAINTAINERS                                   |  2 +-
>  drivers/media/platform/nxp/Kconfig            | 13 +++++++++
>  drivers/media/platform/nxp/Makefile           |  1 +
>  .../platform/nxp}/imx7-media-csi.c            | 24 +++++++++++++++
>  drivers/staging/media/imx/Kconfig             |  7 -----
>  drivers/staging/media/imx/Makefile            |  1 -
>  drivers/staging/media/imx/TODO                | 29 -------------------
>  7 files changed, 39 insertions(+), 38 deletions(-)
>  rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 338c155f60ef..1dfa1d51955c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12595,7 +12595,7 @@ F:	Documentation/admin-guide/media/imx7.rst
>  F:	Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
>  F:	Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
>  F:	drivers/media/platform/nxp/imx-mipi-csis.c
> -F:	drivers/staging/media/imx/imx7-media-csi.c
> +F:	drivers/media/platform/nxp/imx7-media-csi.c
>  
>  MEDIA DRIVERS FOR HELENE
>  M:	Abylay Ospan <aospan@netup.ru>
> diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig
> index 1ac0a6e91111..3aa4207bcd41 100644
> --- a/drivers/media/platform/nxp/Kconfig
> +++ b/drivers/media/platform/nxp/Kconfig
> @@ -4,6 +4,19 @@
>  
>  comment "NXP media platform drivers"
>  
> +config VIDEO_IMX7_CSI
> +	tristate "NXP CSI Bridge driver"
> +	depends on ARCH_MXC || COMPILE_TEST
> +	depends on HAS_DMA
> +	depends on VIDEO_DEV
> +	select MEDIA_CONTROLLER
> +	select V4L2_FWNODE
> +	select VIDEOBUF2_DMA_CONTIG
> +	select VIDEO_V4L2_SUBDEV_API
> +	help
> +	  Driver for the NXP Camera Sensor Interface (CSI) Bridge. This device
> +	  is found in the i.MX6UL/L, i.MX7 and i.MX8M[MQ] SoCs.
> +
>  config VIDEO_IMX_MIPI_CSIS
>  	tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models"
>  	depends on ARCH_MXC || COMPILE_TEST
> diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile
> index efc38c6578ce..92cb8f4c215e 100644
> --- a/drivers/media/platform/nxp/Makefile
> +++ b/drivers/media/platform/nxp/Makefile
> @@ -2,6 +2,7 @@
>  
>  obj-y += imx-jpeg/
>  
> +obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
>  obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
>  obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> similarity index 97%
> rename from drivers/staging/media/imx/imx7-media-csi.c
> rename to drivers/media/platform/nxp/imx7-media-csi.c
> index 21d6e56ffcd4..72de9fc9862a 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -807,6 +807,30 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)
>   * List of supported pixel formats for the subdevs. Keep V4L2_PIX_FMT_UYVY and
>   * MEDIA_BUS_FMT_UYVY8_2X8 first to match IMX7_CSI_DEF_PIX_FORMAT and
>   * IMX7_CSI_DEF_MBUS_CODE.
> + *
> + * TODO: Restrict the supported formats list based on the SoC integration.
> + *
> + * The CSI bridge can be configured to sample pixel components from the Rx queue
> + * in single (8bpp) or double (16bpp) component modes. Image format variants
> + * with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the pixel
> + * components sampling size per each clock cycle and their packing mode (see
> + * imx7_csi_configure() for details).
> + *
> + * As the CSI bridge can be interfaced with different IP blocks depending on the
> + * SoC model it is integrated on, the Rx queue sampling size should match the
> + * size of the samples transferred by the transmitting IP block. To avoid
> + * misconfigurations of the capture pipeline, the enumeration of the supported
> + * formats should be restricted to match the pixel source transmitting mode.
> + *
> + * Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> + * receiver which operates in dual pixel sampling mode. The CSI bridge should
> + * only expose the 1X16 formats variant which instructs it to operate in dual
> + * pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> + * which supports both serial and parallel input, it should expose both
> + * variants.
> + *
> + * This currently only applies to YUYV formats, but other formats might need to
> + * be handled in the same way.
>   */
>  static const struct imx7_csi_pixfmt pixel_formats[] = {
>  	/*** YUV formats start here ***/
> diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> index bfb849701489..21fd79515042 100644
> --- a/drivers/staging/media/imx/Kconfig
> +++ b/drivers/staging/media/imx/Kconfig
> @@ -23,13 +23,6 @@ config VIDEO_IMX_CSI
>  	default y
>  	help
>  	  A video4linux camera sensor interface driver for i.MX5/6.
> -
> -config VIDEO_IMX7_CSI
> -	tristate "i.MX6UL/L / i.MX7 / i.MX8M Camera Sensor Interface driver"
> -	default y
> -	help
> -	  Enable support for video4linux camera sensor interface driver for
> -	  i.MX6UL/L, i.MX7 or i.MX8M.
>  endmenu
>  endif
>  
> diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> index cef9f30eb401..906a422aa656 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -14,5 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
>  
> -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
> index 5d3a337c8702..afee26870af7 100644
> --- a/drivers/staging/media/imx/TODO
> +++ b/drivers/staging/media/imx/TODO
> @@ -23,32 +23,3 @@
>  - 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.
> -
> -- i.MX7: all of the above, since it uses the imx media core
> -
> -- i.MX7: use Frame Interval Monitor
> -
> -- imx7-media-csi: Restrict the supported formats list to the SoC version.
> -
> -  The imx7 CSI bridge can be configured to sample pixel components from the Rx
> -  queue in single (8bpp) or double (16bpp) component modes. Image format
> -  variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the
> -  pixel components sampling size per each clock cycle and their packing mode
> -  (see imx7_csi_configure() for details).
> -
> -  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
> -  the SoC model it is integrated on, the Rx queue sampling size should match
> -  the size of the samples transferred by the transmitting IP block.
> -
> -  To avoid mis-configurations of the capture pipeline, the enumeration of the
> -  supported formats should be restricted to match the pixel source transmitting
> -  mode.
> -
> -  Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> -  receiver which operates in dual pixel sampling mode. The CSI bridge should
> -  only expose the 1X16 formats variant which instructs it to operate in dual
> -  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> -  which supports both serial and parallel input, it should expose both variants.
> -
> -  This currently only applies to YUYV formats, but other formats might need
> -  to be handled in the same way.
> -- 
> Regards,
> 
> Laurent Pinchart
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver
  2022-09-08 15:06   ` Rui Miguel Silva
@ 2022-09-08 15:18     ` Laurent Pinchart
  2022-09-08 15:46       ` Rui Miguel Silva
  0 siblings, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-08 15:18 UTC (permalink / raw)
  To: Rui Miguel Silva
  Cc: linux-media, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

Hi Rui,

On Thu, Sep 08, 2022 at 04:06:27PM +0100, Rui Miguel Silva wrote:
> Hi Laurent,
> Thanks for doing this work.
> 
> On Wed, Sep 07, 2022 at 11:04:20PM +0300, Laurent Pinchart wrote:
> > The imx7-media-csi driver, currently in staging, is ready for
> > prime-time. The staging TODO file lists a few items specific to that
> > driver, that are already addressed (the "all of the above" part) or can
> > be addressed later:
> > 
> > - The frame interval monitoring support is a software mechanism to
> >   monitor the device for unexpected stalls, and should be part of the
> >   V4L2 core if desired.
> > 
> > - Restricting the support media bus formats based on the SoC integration
> >   only aims at reducing userspace confusion by not enumerating options
> >   that are known not to be possible, it won't cause regressions if
> >   handled later.
> > 
> > Move the description of the media bus format restriction TODO item to
> > the driver, drop the other TODO items, and move the driver out of
> > staging.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> For this imx7 work everything looks ok, with one exception:
> Need to update file entry in MAINTAINERS file.

Isn't it done below ?

> (also I noticed that
> there isn't an entry for the imx8 csi2 in that file also, but that is
> a different story).
> 
> With that fixed:
> 
> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
> 
> Cheers,
>    Rui
> 
> > ---
> >  MAINTAINERS                                   |  2 +-
> >  drivers/media/platform/nxp/Kconfig            | 13 +++++++++
> >  drivers/media/platform/nxp/Makefile           |  1 +
> >  .../platform/nxp}/imx7-media-csi.c            | 24 +++++++++++++++
> >  drivers/staging/media/imx/Kconfig             |  7 -----
> >  drivers/staging/media/imx/Makefile            |  1 -
> >  drivers/staging/media/imx/TODO                | 29 -------------------
> >  7 files changed, 39 insertions(+), 38 deletions(-)
> >  rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 338c155f60ef..1dfa1d51955c 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -12595,7 +12595,7 @@ F:	Documentation/admin-guide/media/imx7.rst
> >  F:	Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
> >  F:	Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
> >  F:	drivers/media/platform/nxp/imx-mipi-csis.c
> > -F:	drivers/staging/media/imx/imx7-media-csi.c
> > +F:	drivers/media/platform/nxp/imx7-media-csi.c

Right here ?

> >  MEDIA DRIVERS FOR HELENE
> >  M:	Abylay Ospan <aospan@netup.ru>
> > diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig
> > index 1ac0a6e91111..3aa4207bcd41 100644
> > --- a/drivers/media/platform/nxp/Kconfig
> > +++ b/drivers/media/platform/nxp/Kconfig
> > @@ -4,6 +4,19 @@
> >  
> >  comment "NXP media platform drivers"
> >  
> > +config VIDEO_IMX7_CSI
> > +	tristate "NXP CSI Bridge driver"
> > +	depends on ARCH_MXC || COMPILE_TEST
> > +	depends on HAS_DMA
> > +	depends on VIDEO_DEV
> > +	select MEDIA_CONTROLLER
> > +	select V4L2_FWNODE
> > +	select VIDEOBUF2_DMA_CONTIG
> > +	select VIDEO_V4L2_SUBDEV_API
> > +	help
> > +	  Driver for the NXP Camera Sensor Interface (CSI) Bridge. This device
> > +	  is found in the i.MX6UL/L, i.MX7 and i.MX8M[MQ] SoCs.
> > +
> >  config VIDEO_IMX_MIPI_CSIS
> >  	tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models"
> >  	depends on ARCH_MXC || COMPILE_TEST
> > diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile
> > index efc38c6578ce..92cb8f4c215e 100644
> > --- a/drivers/media/platform/nxp/Makefile
> > +++ b/drivers/media/platform/nxp/Makefile
> > @@ -2,6 +2,7 @@
> >  
> >  obj-y += imx-jpeg/
> >  
> > +obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> >  obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
> >  obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
> >  obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o
> > diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> > similarity index 97%
> > rename from drivers/staging/media/imx/imx7-media-csi.c
> > rename to drivers/media/platform/nxp/imx7-media-csi.c
> > index 21d6e56ffcd4..72de9fc9862a 100644
> > --- a/drivers/staging/media/imx/imx7-media-csi.c
> > +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> > @@ -807,6 +807,30 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)
> >   * List of supported pixel formats for the subdevs. Keep V4L2_PIX_FMT_UYVY and
> >   * MEDIA_BUS_FMT_UYVY8_2X8 first to match IMX7_CSI_DEF_PIX_FORMAT and
> >   * IMX7_CSI_DEF_MBUS_CODE.
> > + *
> > + * TODO: Restrict the supported formats list based on the SoC integration.
> > + *
> > + * The CSI bridge can be configured to sample pixel components from the Rx queue
> > + * in single (8bpp) or double (16bpp) component modes. Image format variants
> > + * with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the pixel
> > + * components sampling size per each clock cycle and their packing mode (see
> > + * imx7_csi_configure() for details).
> > + *
> > + * As the CSI bridge can be interfaced with different IP blocks depending on the
> > + * SoC model it is integrated on, the Rx queue sampling size should match the
> > + * size of the samples transferred by the transmitting IP block. To avoid
> > + * misconfigurations of the capture pipeline, the enumeration of the supported
> > + * formats should be restricted to match the pixel source transmitting mode.
> > + *
> > + * Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> > + * receiver which operates in dual pixel sampling mode. The CSI bridge should
> > + * only expose the 1X16 formats variant which instructs it to operate in dual
> > + * pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> > + * which supports both serial and parallel input, it should expose both
> > + * variants.
> > + *
> > + * This currently only applies to YUYV formats, but other formats might need to
> > + * be handled in the same way.
> >   */
> >  static const struct imx7_csi_pixfmt pixel_formats[] = {
> >  	/*** YUV formats start here ***/
> > diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> > index bfb849701489..21fd79515042 100644
> > --- a/drivers/staging/media/imx/Kconfig
> > +++ b/drivers/staging/media/imx/Kconfig
> > @@ -23,13 +23,6 @@ config VIDEO_IMX_CSI
> >  	default y
> >  	help
> >  	  A video4linux camera sensor interface driver for i.MX5/6.
> > -
> > -config VIDEO_IMX7_CSI
> > -	tristate "i.MX6UL/L / i.MX7 / i.MX8M Camera Sensor Interface driver"
> > -	default y
> > -	help
> > -	  Enable support for video4linux camera sensor interface driver for
> > -	  i.MX6UL/L, i.MX7 or i.MX8M.
> >  endmenu
> >  endif
> >  
> > diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> > index cef9f30eb401..906a422aa656 100644
> > --- a/drivers/staging/media/imx/Makefile
> > +++ b/drivers/staging/media/imx/Makefile
> > @@ -14,5 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media.o
> >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
> >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
> >  
> > -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> >  obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> > diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
> > index 5d3a337c8702..afee26870af7 100644
> > --- a/drivers/staging/media/imx/TODO
> > +++ b/drivers/staging/media/imx/TODO
> > @@ -23,32 +23,3 @@
> >  - 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.
> > -
> > -- i.MX7: all of the above, since it uses the imx media core
> > -
> > -- i.MX7: use Frame Interval Monitor
> > -
> > -- imx7-media-csi: Restrict the supported formats list to the SoC version.
> > -
> > -  The imx7 CSI bridge can be configured to sample pixel components from the Rx
> > -  queue in single (8bpp) or double (16bpp) component modes. Image format
> > -  variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the
> > -  pixel components sampling size per each clock cycle and their packing mode
> > -  (see imx7_csi_configure() for details).
> > -
> > -  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
> > -  the SoC model it is integrated on, the Rx queue sampling size should match
> > -  the size of the samples transferred by the transmitting IP block.
> > -
> > -  To avoid mis-configurations of the capture pipeline, the enumeration of the
> > -  supported formats should be restricted to match the pixel source transmitting
> > -  mode.
> > -
> > -  Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> > -  receiver which operates in dual pixel sampling mode. The CSI bridge should
> > -  only expose the 1X16 formats variant which instructs it to operate in dual
> > -  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> > -  which supports both serial and parallel input, it should expose both variants.
> > -
> > -  This currently only applies to YUYV formats, but other formats might need
> > -  to be handled in the same way.
> > -- 
> > Regards,
> > 
> > Laurent Pinchart
> > 

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver
  2022-09-08 15:18     ` Laurent Pinchart
@ 2022-09-08 15:46       ` Rui Miguel Silva
  0 siblings, 0 replies; 20+ messages in thread
From: Rui Miguel Silva @ 2022-09-08 15:46 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Steve Longerbeam, Philipp Zabel, Paul Elder,
	Jacopo Mondi, kernel, linux-imx

Hi Laurent,
On Thu, Sep 08, 2022 at 06:18:04PM +0300, Laurent Pinchart wrote:
> Hi Rui,
> 
> On Thu, Sep 08, 2022 at 04:06:27PM +0100, Rui Miguel Silva wrote:
> > Hi Laurent,
> > Thanks for doing this work.
> > 
> > On Wed, Sep 07, 2022 at 11:04:20PM +0300, Laurent Pinchart wrote:
> > > The imx7-media-csi driver, currently in staging, is ready for
> > > prime-time. The staging TODO file lists a few items specific to that
> > > driver, that are already addressed (the "all of the above" part) or can
> > > be addressed later:
> > > 
> > > - The frame interval monitoring support is a software mechanism to
> > >   monitor the device for unexpected stalls, and should be part of the
> > >   V4L2 core if desired.
> > > 
> > > - Restricting the support media bus formats based on the SoC integration
> > >   only aims at reducing userspace confusion by not enumerating options
> > >   that are known not to be possible, it won't cause regressions if
> > >   handled later.
> > > 
> > > Move the description of the media bus format restriction TODO item to
> > > the driver, drop the other TODO items, and move the driver out of
> > > staging.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > For this imx7 work everything looks ok, with one exception:
> > Need to update file entry in MAINTAINERS file.
> 
> Isn't it done below ?
> 
> > (also I noticed that
> > there isn't an entry for the imx8 csi2 in that file also, but that is
> > a different story).
> > 
> > With that fixed:
> > 
> > Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
> > 
> > Cheers,
> >    Rui
> > 
> > > ---
> > >  MAINTAINERS                                   |  2 +-
> > >  drivers/media/platform/nxp/Kconfig            | 13 +++++++++
> > >  drivers/media/platform/nxp/Makefile           |  1 +
> > >  .../platform/nxp}/imx7-media-csi.c            | 24 +++++++++++++++
> > >  drivers/staging/media/imx/Kconfig             |  7 -----
> > >  drivers/staging/media/imx/Makefile            |  1 -
> > >  drivers/staging/media/imx/TODO                | 29 -------------------
> > >  7 files changed, 39 insertions(+), 38 deletions(-)
> > >  rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c (97%)
> > > 
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index 338c155f60ef..1dfa1d51955c 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -12595,7 +12595,7 @@ F:	Documentation/admin-guide/media/imx7.rst
> > >  F:	Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
> > >  F:	Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
> > >  F:	drivers/media/platform/nxp/imx-mipi-csis.c
> > > -F:	drivers/staging/media/imx/imx7-media-csi.c
> > > +F:	drivers/media/platform/nxp/imx7-media-csi.c
> 
> Right here ?

yeah, sorry, I completely missed this, sorry for the noise.

------
Cheers,
     Rui
> 
> > >  MEDIA DRIVERS FOR HELENE
> > >  M:	Abylay Ospan <aospan@netup.ru>
> > > diff --git a/drivers/media/platform/nxp/Kconfig b/drivers/media/platform/nxp/Kconfig
> > > index 1ac0a6e91111..3aa4207bcd41 100644
> > > --- a/drivers/media/platform/nxp/Kconfig
> > > +++ b/drivers/media/platform/nxp/Kconfig
> > > @@ -4,6 +4,19 @@
> > >  
> > >  comment "NXP media platform drivers"
> > >  
> > > +config VIDEO_IMX7_CSI
> > > +	tristate "NXP CSI Bridge driver"
> > > +	depends on ARCH_MXC || COMPILE_TEST
> > > +	depends on HAS_DMA
> > > +	depends on VIDEO_DEV
> > > +	select MEDIA_CONTROLLER
> > > +	select V4L2_FWNODE
> > > +	select VIDEOBUF2_DMA_CONTIG
> > > +	select VIDEO_V4L2_SUBDEV_API
> > > +	help
> > > +	  Driver for the NXP Camera Sensor Interface (CSI) Bridge. This device
> > > +	  is found in the i.MX6UL/L, i.MX7 and i.MX8M[MQ] SoCs.
> > > +
> > >  config VIDEO_IMX_MIPI_CSIS
> > >  	tristate "NXP MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models"
> > >  	depends on ARCH_MXC || COMPILE_TEST
> > > diff --git a/drivers/media/platform/nxp/Makefile b/drivers/media/platform/nxp/Makefile
> > > index efc38c6578ce..92cb8f4c215e 100644
> > > --- a/drivers/media/platform/nxp/Makefile
> > > +++ b/drivers/media/platform/nxp/Makefile
> > > @@ -2,6 +2,7 @@
> > >  
> > >  obj-y += imx-jpeg/
> > >  
> > > +obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> > >  obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
> > >  obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o
> > >  obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o
> > > diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> > > similarity index 97%
> > > rename from drivers/staging/media/imx/imx7-media-csi.c
> > > rename to drivers/media/platform/nxp/imx7-media-csi.c
> > > index 21d6e56ffcd4..72de9fc9862a 100644
> > > --- a/drivers/staging/media/imx/imx7-media-csi.c
> > > +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> > > @@ -807,6 +807,30 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)
> > >   * List of supported pixel formats for the subdevs. Keep V4L2_PIX_FMT_UYVY and
> > >   * MEDIA_BUS_FMT_UYVY8_2X8 first to match IMX7_CSI_DEF_PIX_FORMAT and
> > >   * IMX7_CSI_DEF_MBUS_CODE.
> > > + *
> > > + * TODO: Restrict the supported formats list based on the SoC integration.
> > > + *
> > > + * The CSI bridge can be configured to sample pixel components from the Rx queue
> > > + * in single (8bpp) or double (16bpp) component modes. Image format variants
> > > + * with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the pixel
> > > + * components sampling size per each clock cycle and their packing mode (see
> > > + * imx7_csi_configure() for details).
> > > + *
> > > + * As the CSI bridge can be interfaced with different IP blocks depending on the
> > > + * SoC model it is integrated on, the Rx queue sampling size should match the
> > > + * size of the samples transferred by the transmitting IP block. To avoid
> > > + * misconfigurations of the capture pipeline, the enumeration of the supported
> > > + * formats should be restricted to match the pixel source transmitting mode.
> > > + *
> > > + * Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> > > + * receiver which operates in dual pixel sampling mode. The CSI bridge should
> > > + * only expose the 1X16 formats variant which instructs it to operate in dual
> > > + * pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> > > + * which supports both serial and parallel input, it should expose both
> > > + * variants.
> > > + *
> > > + * This currently only applies to YUYV formats, but other formats might need to
> > > + * be handled in the same way.
> > >   */
> > >  static const struct imx7_csi_pixfmt pixel_formats[] = {
> > >  	/*** YUV formats start here ***/
> > > diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> > > index bfb849701489..21fd79515042 100644
> > > --- a/drivers/staging/media/imx/Kconfig
> > > +++ b/drivers/staging/media/imx/Kconfig
> > > @@ -23,13 +23,6 @@ config VIDEO_IMX_CSI
> > >  	default y
> > >  	help
> > >  	  A video4linux camera sensor interface driver for i.MX5/6.
> > > -
> > > -config VIDEO_IMX7_CSI
> > > -	tristate "i.MX6UL/L / i.MX7 / i.MX8M Camera Sensor Interface driver"
> > > -	default y
> > > -	help
> > > -	  Enable support for video4linux camera sensor interface driver for
> > > -	  i.MX6UL/L, i.MX7 or i.MX8M.
> > >  endmenu
> > >  endif
> > >  
> > > diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> > > index cef9f30eb401..906a422aa656 100644
> > > --- a/drivers/staging/media/imx/Makefile
> > > +++ b/drivers/staging/media/imx/Makefile
> > > @@ -14,5 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media.o
> > >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
> > >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
> > >  
> > > -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> > >  obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> > > diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
> > > index 5d3a337c8702..afee26870af7 100644
> > > --- a/drivers/staging/media/imx/TODO
> > > +++ b/drivers/staging/media/imx/TODO
> > > @@ -23,32 +23,3 @@
> > >  - 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.
> > > -
> > > -- i.MX7: all of the above, since it uses the imx media core
> > > -
> > > -- i.MX7: use Frame Interval Monitor
> > > -
> > > -- imx7-media-csi: Restrict the supported formats list to the SoC version.
> > > -
> > > -  The imx7 CSI bridge can be configured to sample pixel components from the Rx
> > > -  queue in single (8bpp) or double (16bpp) component modes. Image format
> > > -  variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the
> > > -  pixel components sampling size per each clock cycle and their packing mode
> > > -  (see imx7_csi_configure() for details).
> > > -
> > > -  As the imx7 CSI bridge can be interfaced with different IP blocks depending on
> > > -  the SoC model it is integrated on, the Rx queue sampling size should match
> > > -  the size of the samples transferred by the transmitting IP block.
> > > -
> > > -  To avoid mis-configurations of the capture pipeline, the enumeration of the
> > > -  supported formats should be restricted to match the pixel source transmitting
> > > -  mode.
> > > -
> > > -  Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2
> > > -  receiver which operates in dual pixel sampling mode. The CSI bridge should
> > > -  only expose the 1X16 formats variant which instructs it to operate in dual
> > > -  pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7,
> > > -  which supports both serial and parallel input, it should expose both variants.
> > > -
> > > -  This currently only applies to YUYV formats, but other formats might need
> > > -  to be handled in the same way.
> > > -- 
> > > Regards,
> > > 
> > > Laurent Pinchart
> > > 
> 
> -- 
> Regards,
> 
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
  2022-09-08  3:58   ` paul.elder
@ 2022-09-09 18:22   ` Laurent Pinchart
  2022-09-13 15:10     ` Martin Kepplinger
  1 sibling, 1 reply; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-09 18:22 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Paul Elder, Jacopo Mondi, kernel, linux-imx

Hi Martin,

It seems I forgot to CC you on this patch, sorry about that. Could you
give it a look ? I'd like to send a pull request for the series next
week.

On Wed, Sep 07, 2022 at 11:04:19PM +0300, Laurent Pinchart wrote:
> The imx8mq-mipi-csi2 driver targets SoCs that also run the
> imx7-media-csi driver, but they are distinct. Decouple them in Kconfig
> to prepare for destaging of the imx7-media-csi driver.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/staging/media/imx/Kconfig  | 10 ++++++++++
>  drivers/staging/media/imx/Makefile |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig
> index 0bacac302d7e..bfb849701489 100644
> --- a/drivers/staging/media/imx/Kconfig
> +++ b/drivers/staging/media/imx/Kconfig
> @@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI
>  	  i.MX6UL/L, i.MX7 or i.MX8M.
>  endmenu
>  endif
> +
> +config VIDEO_IMX8MQ_MIPI_CSI2
> +	tristate "NXP i.MX8MQ MIPI CSI-2 receiver"
> +	depends on ARCH_MXC || COMPILE_TEST
> +	depends on VIDEO_DEV
> +	select MEDIA_CONTROLLER
> +	select V4L2_FWNODE
> +	select VIDEO_V4L2_SUBDEV_API
> +	help
> +	  V4L2 driver for the MIPI CSI-2 receiver found in the i.MX8MQ SoC.
> diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile
> index d82be898145b..cef9f30eb401 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -15,4 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
>  
>  obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
> +obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/6] media: imx: imx7-media-csi: Destage driver
  2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
                   ` (5 preceding siblings ...)
  2022-09-07 20:04 ` [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static Laurent Pinchart
@ 2022-09-13  9:48 ` Alexander Stein
  6 siblings, 0 replies; 20+ messages in thread
From: Alexander Stein @ 2022-09-13  9:48 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Paul Elder, Jacopo Mondi, kernel, linux-imx

Hello Laurent,

thanks for the patch and putting in some progress.

Am Mittwoch, 7. September 2022, 22:04:18 CEST schrieb Laurent Pinchart:
> Hello,
> 
> This patch series is the last step of the imx7-media-csi driver
> destaging journey. Patch 1/6 starts by decoupling the imx7-media-csi and
> imx8mq-mipi-csi2 drivers in Kconfig, and patch 2/6 performs the
> destaging. Patches 3/6 to 6/6 then handle the low-hanging fruits of the
> staging imx cleanup by dropping features that were only used by the
> imx7-media-csi driver.
> 
> The patches apply on top of [1].
> 
> https://lore.kernel.org/linux-media/20220907191547.19255-1-laurent.pinchart@
> ideasonboard.com
> 
> Laurent Pinchart (6):
>   media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
>   media: imx: Unstage the imx7-media-csi driver
>   staging: media: imx: Drop imx_media_subdev_bound()
>   staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI
>   staging: media: imx: Drop unused helper functions
>   staging: media: imx: Make imx_media_of_add_csi() static
> 
>  MAINTAINERS                                   |  2 +-
>  drivers/media/platform/nxp/Kconfig            | 13 ++++
>  drivers/media/platform/nxp/Makefile           |  1 +
>  .../platform/nxp}/imx7-media-csi.c            | 24 +++++++
>  drivers/staging/media/imx/Kconfig             | 17 +++--
>  drivers/staging/media/imx/Makefile            |  3 +-
>  drivers/staging/media/imx/TODO                | 29 --------
>  .../staging/media/imx/imx-media-dev-common.c  | 14 ----
>  drivers/staging/media/imx/imx-media-of.c      |  5 +-
>  drivers/staging/media/imx/imx-media-utils.c   | 68 -------------------
>  drivers/staging/media/imx/imx-media.h         | 13 ----
>  11 files changed, 52 insertions(+), 137 deletions(-)
>  rename drivers/{staging/media/imx => media/platform/nxp}/imx7-media-csi.c
> (97%)

I could test this on TQMa8MQ (imx8mq) based platform with an OV9281 gray 
camera. I had a lot of frame drops when showing on wayland, but a 
fpsdisplaysink combined with testsink showed ~36 FPS. This is the same as 
before this series.

So I guess, you can add
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  2022-09-09 18:22   ` Laurent Pinchart
@ 2022-09-13 15:10     ` Martin Kepplinger
  2022-09-13 15:26       ` Laurent Pinchart
  0 siblings, 1 reply; 20+ messages in thread
From: Martin Kepplinger @ 2022-09-13 15:10 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Paul Elder, Jacopo Mondi, kernel, linux-imx

Am Freitag, dem 09.09.2022 um 21:22 +0300 schrieb Laurent Pinchart:
> Hi Martin,
> 
> It seems I forgot to CC you on this patch, sorry about that. Could
> you
> give it a look ? I'd like to send a pull request for the series next
> week.
> 

hi Laurent,

this change should be ok. thanks for the config-change warning. I'm
very much looking forward to seeing some of these drivers moved to
drivers/media.

Depeding on how that goes I'll follow with the imx8mq-mipi-csi2 driver
(if you don't want to do it).

thanks again,
                          martin


> On Wed, Sep 07, 2022 at 11:04:19PM +0300, Laurent Pinchart wrote:
> > The imx8mq-mipi-csi2 driver targets SoCs that also run the
> > imx7-media-csi driver, but they are distinct. Decouple them in
> > Kconfig
> > to prepare for destaging of the imx7-media-csi driver.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  drivers/staging/media/imx/Kconfig  | 10 ++++++++++
> >  drivers/staging/media/imx/Makefile |  2 +-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/media/imx/Kconfig
> > b/drivers/staging/media/imx/Kconfig
> > index 0bacac302d7e..bfb849701489 100644
> > --- a/drivers/staging/media/imx/Kconfig
> > +++ b/drivers/staging/media/imx/Kconfig
> > @@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI
> >           i.MX6UL/L, i.MX7 or i.MX8M.
> >  endmenu
> >  endif
> > +
> > +config VIDEO_IMX8MQ_MIPI_CSI2
> > +       tristate "NXP i.MX8MQ MIPI CSI-2 receiver"
> > +       depends on ARCH_MXC || COMPILE_TEST
> > +       depends on VIDEO_DEV
> > +       select MEDIA_CONTROLLER
> > +       select V4L2_FWNODE
> > +       select VIDEO_V4L2_SUBDEV_API
> > +       help
> > +         V4L2 driver for the MIPI CSI-2 receiver found in the
> > i.MX8MQ SoC.
> > diff --git a/drivers/staging/media/imx/Makefile
> > b/drivers/staging/media/imx/Makefile
> > index d82be898145b..cef9f30eb401 100644
> > --- a/drivers/staging/media/imx/Makefile
> > +++ b/drivers/staging/media/imx/Makefile
> > @@ -15,4 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
> >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
> >  
> >  obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> > -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
> > +obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
> 



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi
  2022-09-13 15:10     ` Martin Kepplinger
@ 2022-09-13 15:26       ` Laurent Pinchart
  0 siblings, 0 replies; 20+ messages in thread
From: Laurent Pinchart @ 2022-09-13 15:26 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: linux-media, Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Paul Elder, Jacopo Mondi, kernel, linux-imx

Hi Martin,

On Tue, Sep 13, 2022 at 05:10:12PM +0200, Martin Kepplinger wrote:
> Am Freitag, dem 09.09.2022 um 21:22 +0300 schrieb Laurent Pinchart:
> > Hi Martin,
> > 
> > It seems I forgot to CC you on this patch, sorry about that. Could you
> > give it a look ? I'd like to send a pull request for the series next week.
> 
> hi Laurent,
> 
> this change should be ok. thanks for the config-change warning. I'm
> very much looking forward to seeing some of these drivers moved to
> drivers/media.
> 
> Depeding on how that goes I'll follow with the imx8mq-mipi-csi2 driver
> (if you don't want to do it).

I don't have plans to address that driver, so I'll be happy to let you
handle it :-)

> thanks again,
>                           martin
> 
> > On Wed, Sep 07, 2022 at 11:04:19PM +0300, Laurent Pinchart wrote:
> > > The imx8mq-mipi-csi2 driver targets SoCs that also run the
> > > imx7-media-csi driver, but they are distinct. Decouple them in
> > > Kconfig
> > > to prepare for destaging of the imx7-media-csi driver.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >  drivers/staging/media/imx/Kconfig  | 10 ++++++++++
> > >  drivers/staging/media/imx/Makefile |  2 +-
> > >  2 files changed, 11 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/media/imx/Kconfig
> > > b/drivers/staging/media/imx/Kconfig
> > > index 0bacac302d7e..bfb849701489 100644
> > > --- a/drivers/staging/media/imx/Kconfig
> > > +++ b/drivers/staging/media/imx/Kconfig
> > > @@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI
> > >           i.MX6UL/L, i.MX7 or i.MX8M.
> > >  endmenu
> > >  endif
> > > +
> > > +config VIDEO_IMX8MQ_MIPI_CSI2
> > > +       tristate "NXP i.MX8MQ MIPI CSI-2 receiver"
> > > +       depends on ARCH_MXC || COMPILE_TEST
> > > +       depends on VIDEO_DEV
> > > +       select MEDIA_CONTROLLER
> > > +       select V4L2_FWNODE
> > > +       select VIDEO_V4L2_SUBDEV_API
> > > +       help
> > > +         V4L2 driver for the MIPI CSI-2 receiver found in the
> > > i.MX8MQ SoC.
> > > diff --git a/drivers/staging/media/imx/Makefile
> > > b/drivers/staging/media/imx/Makefile
> > > index d82be898145b..cef9f30eb401 100644
> > > --- a/drivers/staging/media/imx/Makefile
> > > +++ b/drivers/staging/media/imx/Makefile
> > > @@ -15,4 +15,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-media-csi.o
> > >  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
> > >  
> > >  obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> > > -obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
> > > +obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-09-13 16:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 20:04 [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Laurent Pinchart
2022-09-07 20:04 ` [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi Laurent Pinchart
2022-09-08  3:58   ` paul.elder
2022-09-09 18:22   ` Laurent Pinchart
2022-09-13 15:10     ` Martin Kepplinger
2022-09-13 15:26       ` Laurent Pinchart
2022-09-07 20:04 ` [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver Laurent Pinchart
2022-09-08  4:04   ` paul.elder
2022-09-08 15:06   ` Rui Miguel Silva
2022-09-08 15:18     ` Laurent Pinchart
2022-09-08 15:46       ` Rui Miguel Silva
2022-09-07 20:04 ` [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound() Laurent Pinchart
2022-09-08  4:08   ` paul.elder
2022-09-07 20:04 ` [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI Laurent Pinchart
2022-09-08  4:10   ` paul.elder
2022-09-07 20:04 ` [PATCH 5/6] staging: media: imx: Drop unused helper functions Laurent Pinchart
2022-09-08  4:12   ` paul.elder
2022-09-07 20:04 ` [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static Laurent Pinchart
2022-09-08  4:16   ` paul.elder
2022-09-13  9:48 ` [PATCH 0/6] media: imx: imx7-media-csi: Destage driver Alexander Stein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.