Skip to contentSkip to conversation

media: imx: imx7-media-csi: Destage driver

PATCH In review Laurent Pinchart 5 participants 20 messages Sep 7, 2022 – Sep 13, 2022

Subsystems (5)
lore
Share & tools
lore

Laurent Pinchart

author maintainer
#0 lore raw

cover media: imx: imx7-media-csi: Destage driver

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/[email protected]

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%)
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#1 lore raw

PATCH 1/6 media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi

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.

---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++
 drivers/staging/media/imx/Makefile |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/imx/Kconfig +10 -0
index 0bacac302d7e..bfb849701489 100644
@@ -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.
drivers/staging/media/imx/Makefile +1 -1
index d82be898145b..cef9f30eb401 100644
@@ -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
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi

Quoted 5 lines · Laurent Pinchart

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.

Quoted 33 lines
---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++
 drivers/staging/media/imx/Makefile |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/imx/Kconfig +10 -0
index 0bacac302d7e..bfb849701489 100644
@@ -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.
drivers/staging/media/imx/Makefile +1 -1
index d82be898145b..cef9f30eb401 100644
@@ -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
author maintainer
#3 lore raw

Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi

In reply to 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.

Quoted 38 lines · Laurent Pinchart

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.

---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++
 drivers/staging/media/imx/Makefile |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/imx/Kconfig +10 -0
index 0bacac302d7e..bfb849701489 100644
@@ -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.
drivers/staging/media/imx/Makefile +1 -1
index d82be898145b..cef9f30eb401 100644
@@ -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
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi

Am Freitag, dem 09.09.2022 um 21:22 +0300 schrieb Laurent Pinchart:

Quoted 7 lines

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

Quoted 44 lines · Laurent Pinchart
Quoted 42 lines

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.

---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++ drivers/staging/media/imx/Makefile |  2 +-

 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/imx/Kconfig +0 -0
index 0bacac302d7e..bfb849701489 100644
@@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI

          i.MX6UL/L, i.MX7 or i.MX8M.
 endmenu
 endif

drivers/staging/media/imx/Kconfig +10 -0
+
+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.

drivers/staging/media/imx/Makefile +0 -0
index d82be898145b..cef9f30eb401 100644
@@ -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

drivers/staging/media/imx/Makefile +1 -1
-obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
+obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
author maintainer
#5 lore raw

Re: [PATCH 1/6] media: imx: Decouple imx8mq-mipi-csi2 from imx7-media-csi

Hi Martin,

Quoted 6 lines · Martin Kepplinger

Am Freitag, dem 09.09.2022 um 21:22 +0300 schrieb Laurent Pinchart:

Quoted 4 lines

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.

Quoted 8 lines

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 :-)

Quoted 46 lines

thanks again,
martin

Quoted 43 lines · Laurent Pinchart
Quoted 42 lines

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.

---
 drivers/staging/media/imx/Kconfig  | 10 ++++++++++ drivers/staging/media/imx/Makefile |  2 +-

 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/imx/Kconfig +0 -0
index 0bacac302d7e..bfb849701489 100644
@@ -32,3 +32,13 @@ config VIDEO_IMX7_CSI

          i.MX6UL/L, i.MX7 or i.MX8M.
 endmenu
 endif

drivers/staging/media/imx/Kconfig +10 -0
+
+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.

drivers/staging/media/imx/Makefile +0 -0
index d82be898145b..cef9f30eb401 100644
@@ -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

drivers/staging/media/imx/Makefile +1 -1
-obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
+obj-$(CONFIG_VIDEO_IMX8MQ_MIPI_CSI2) += imx8mq-mipi-csi2.o
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#6 lore raw

PATCH 2/6 media: imx: Unstage the imx7-media-csi driver

In reply to Laurent Pinchart

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.

---
 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%)
MAINTAINERS +1 -1
index 338c155f60ef..1dfa1d51955c 100644
@@ -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 <[email protected]>
drivers/media/platform/nxp/Kconfig +13 -0
index 1ac0a6e91111..3aa4207bcd41 100644
@@ -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
drivers/media/platform/nxp/Makefile +1 -0
index efc38c6578ce..92cb8f4c215e 100644
@@ -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
drivers/media/platform/nxp/imx7-media-csi.c renamed from drivers/staging/media/imx/imx7-media-csi.c +24 -0
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
@@ -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 ***/
drivers/staging/media/imx/Kconfig +0 -7
index bfb849701489..21fd79515042 100644
@@ -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
 
drivers/staging/media/imx/Makefile +0 -1
index cef9f30eb401..906a422aa656 100644
@@ -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
drivers/staging/media/imx/TODO +0 -29
index 5d3a337c8702..afee26870af7 100644
@@ -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.
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 2/6
#7 lore raw

Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver

Quoted 14 lines · Laurent Pinchart

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.

Quoted 5 lines

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.

Quoted 163 lines
---
 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%)
MAINTAINERS +1 -1
index 338c155f60ef..1dfa1d51955c 100644
@@ -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 <[email protected]>
drivers/media/platform/nxp/Kconfig +13 -0
index 1ac0a6e91111..3aa4207bcd41 100644
@@ -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
drivers/media/platform/nxp/Makefile +1 -0
index efc38c6578ce..92cb8f4c215e 100644
@@ -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
drivers/media/platform/nxp/imx7-media-csi.c renamed from drivers/staging/media/imx/imx7-media-csi.c +24 -0
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
@@ -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 ***/
drivers/staging/media/imx/Kconfig +0 -7
index bfb849701489..21fd79515042 100644
@@ -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
 
drivers/staging/media/imx/Makefile +0 -1
index cef9f30eb401..906a422aa656 100644
@@ -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
drivers/staging/media/imx/TODO +0 -29
index 5d3a337c8702..afee26870af7 100644
@@ -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.
reviewer Acked-by on v1 2/6
#8 lore raw

Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver

In reply to Laurent Pinchart

Hi Laurent,
Thanks for doing this work.

Quoted 14 lines · Laurent Pinchart

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.

Quoted 5 lines

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.

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:

Cheers,
Rui

Quoted 168 lines
---
 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%)
MAINTAINERS +1 -1
index 338c155f60ef..1dfa1d51955c 100644
@@ -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 <[email protected]>
drivers/media/platform/nxp/Kconfig +13 -0
index 1ac0a6e91111..3aa4207bcd41 100644
@@ -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
drivers/media/platform/nxp/Makefile +1 -0
index efc38c6578ce..92cb8f4c215e 100644
@@ -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
drivers/media/platform/nxp/imx7-media-csi.c renamed from drivers/staging/media/imx/imx7-media-csi.c +24 -0
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
@@ -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 ***/
drivers/staging/media/imx/Kconfig +0 -7
index bfb849701489..21fd79515042 100644
@@ -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
 
drivers/staging/media/imx/Makefile +0 -1
index cef9f30eb401..906a422aa656 100644
@@ -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
drivers/staging/media/imx/TODO +0 -29
index 5d3a337c8702..afee26870af7 100644
@@ -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.
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#9 lore raw

Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver

Hi Rui,

Quoted 18 lines · Rui Miguel Silva

Hi Laurent,
Thanks for doing this work.

Quoted 14 lines · Laurent Pinchart

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.

Quoted 8 lines
Quoted 5 lines

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.

For this imx7 work everything looks ok, with one exception:
Need to update file entry in MAINTAINERS file.

Isn't it done below ?

Quoted 22 lines

(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:

Cheers,
Rui

Quoted 11 lines
---
 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%)
Quoted 10 lines

MAINTAINERS F: Documentation/admin-guide/media/imx7.rst · line 12598

Quoted 10 lines
MAINTAINERS +1 -1
index 338c155f60ef..1dfa1d51955c 100644
@@ -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 ?

Quoted 146 lines
Quoted 146 lines
MAINTAINERS +0 -0
 MEDIA DRIVERS FOR HELENE
 M:	Abylay Ospan <[email protected]>
drivers/media/platform/nxp/Kconfig +13 -0
index 1ac0a6e91111..3aa4207bcd41 100644
@@ -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
drivers/media/platform/nxp/Makefile +1 -0
index efc38c6578ce..92cb8f4c215e 100644
@@ -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
drivers/media/platform/nxp/imx7-media-csi.c renamed from drivers/staging/media/imx/imx7-media-csi.c +24 -0
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
@@ -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 ***/
drivers/staging/media/imx/Kconfig +0 -7
index bfb849701489..21fd79515042 100644
@@ -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
 
drivers/staging/media/imx/Makefile +0 -1
index cef9f30eb401..906a422aa656 100644
@@ -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
drivers/staging/media/imx/TODO +0 -29
index 5d3a337c8702..afee26870af7 100644
@@ -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.
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

Re: [PATCH 2/6] media: imx: Unstage the imx7-media-csi driver

Hi Laurent,

Quoted 54 lines · Laurent Pinchart

Hi Rui,

Quoted 18 lines · Rui Miguel Silva

Hi Laurent,
Thanks for doing this work.

Quoted 14 lines · Laurent Pinchart

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.

Quoted 8 lines
Quoted 5 lines

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.

For this imx7 work everything looks ok, with one exception:
Need to update file entry in MAINTAINERS file.

Isn't it done below ?

Quoted 22 lines

(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:

Cheers,
Rui

Quoted 11 lines
---
 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%)
Quoted 12 lines
Quoted 10 lines

MAINTAINERS F: Documentation/admin-guide/media/imx7.rst · line 12598

Quoted 10 lines
MAINTAINERS +1 -1
index 338c155f60ef..1dfa1d51955c 100644
@@ -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

Quoted 152 lines
Quoted 147 lines
Quoted 147 lines
MAINTAINERS +0 -0
 MEDIA DRIVERS FOR HELENE
 M:	Abylay Ospan <[email protected]>
drivers/media/platform/nxp/Kconfig +13 -0
index 1ac0a6e91111..3aa4207bcd41 100644
@@ -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
drivers/media/platform/nxp/Makefile +1 -0
index efc38c6578ce..92cb8f4c215e 100644
@@ -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
drivers/media/platform/nxp/imx7-media-csi.c renamed from drivers/staging/media/imx/imx7-media-csi.c +24 -0
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
@@ -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 ***/
drivers/staging/media/imx/Kconfig +0 -7
index bfb849701489..21fd79515042 100644
@@ -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
 
drivers/staging/media/imx/Makefile +0 -1
index cef9f30eb401..906a422aa656 100644
@@ -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
drivers/staging/media/imx/TODO +0 -29
index 5d3a337c8702..afee26870af7 100644
@@ -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.
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#11 lore raw

PATCH 3/6 staging: media: imx: Drop imx_media_subdev_bound()

In reply to Laurent Pinchart

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

---
 drivers/staging/media/imx/imx-media-dev-common.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/media/imx/imx-media-dev-common.c +0 -13
index e6d6ed3b1161..8f7ced3a9cca 100644
@@ -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,
 };
 
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 3/6
#12 lore raw

Re: [PATCH 3/6] staging: media: imx: Drop imx_media_subdev_bound()

Quoted 4 lines · Laurent Pinchart

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

Quoted 35 lines
---
 drivers/staging/media/imx/imx-media-dev-common.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/media/imx/imx-media-dev-common.c +0 -13
index e6d6ed3b1161..8f7ced3a9cca 100644
@@ -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,
 };
 
author maintainer
#13 lore raw

PATCH 4/6 staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI

In reply to Laurent Pinchart

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

---
 drivers/staging/media/imx/imx-media-dev-common.c | 1 -
 drivers/staging/media/imx/imx-media.h            | 1 -
 2 files changed, 2 deletions(-)
drivers/staging/media/imx/imx-media-dev-common.c +0 -1
index 8f7ced3a9cca..991820a8500f 100644
@@ -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;
 
drivers/staging/media/imx/imx-media.h +0 -1
index f263fc3adbb9..5e794f291da6 100644
@@ -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)
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 4/6
#14 lore raw

Re: [PATCH 4/6] staging: media: imx: Drop IMX_MEDIA_GRP_ID_CSI

Quoted 3 lines · Laurent Pinchart

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

Quoted 29 lines
---
 drivers/staging/media/imx/imx-media-dev-common.c | 1 -
 drivers/staging/media/imx/imx-media.h            | 1 -
 2 files changed, 2 deletions(-)
drivers/staging/media/imx/imx-media-dev-common.c +0 -1
index 8f7ced3a9cca..991820a8500f 100644
@@ -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;
 
drivers/staging/media/imx/imx-media.h +0 -1
index f263fc3adbb9..5e794f291da6 100644
@@ -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)
author maintainer
#15 lore raw

PATCH 5/6 staging: media: imx: Drop unused helper functions

In reply to Laurent Pinchart

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.

---
 drivers/staging/media/imx/imx-media-utils.c | 68 ---------------------
 drivers/staging/media/imx/imx-media.h       | 10 ---
 2 files changed, 78 deletions(-)
drivers/staging/media/imx/imx-media-utils.c +0 -68
index 294c808b2ebe..07770b47e19b 100644
@@ -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
drivers/staging/media/imx/imx-media.h +0 -10
index 5e794f291da6..5a1436dbb12d 100644
@@ -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 {
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 5/6
#16 lore raw

Re: [PATCH 5/6] staging: media: imx: Drop unused helper functions

Quoted 6 lines · Laurent Pinchart

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.

Quoted 127 lines
---
 drivers/staging/media/imx/imx-media-utils.c | 68 ---------------------
 drivers/staging/media/imx/imx-media.h       | 10 ---
 2 files changed, 78 deletions(-)
drivers/staging/media/imx/imx-media-utils.c +0 -68
index 294c808b2ebe..07770b47e19b 100644
@@ -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
drivers/staging/media/imx/imx-media.h +0 -10
index 5e794f291da6..5a1436dbb12d 100644
@@ -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 {
author maintainer
#17 lore raw

PATCH 6/6 staging: media: imx: Make imx_media_of_add_csi() static

In reply to Laurent Pinchart

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

---
 drivers/staging/media/imx/imx-media-of.c | 5 ++---
 drivers/staging/media/imx/imx-media.h    | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/imx/imx-media-of.c +2 -3
index 59f1eb7b62bc..92a99010c150 100644
@@ -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)
drivers/staging/media/imx/imx-media.h +0 -2
index 5a1436dbb12d..c12ecaf378fe 100644
@@ -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,
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 6/6
#18 lore raw

Re: [PATCH 6/6] staging: media: imx: Make imx_media_of_add_csi() static

Quoted 4 lines · Laurent Pinchart

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

Quoted 41 lines
---
 drivers/staging/media/imx/imx-media-of.c | 5 ++---
 drivers/staging/media/imx/imx-media.h    | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/imx/imx-media-of.c +2 -3
index 59f1eb7b62bc..92a99010c150 100644
@@ -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)
drivers/staging/media/imx/imx-media.h +0 -2
index 5a1436dbb12d..c12ecaf378fe 100644
@@ -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,
Tested-by on the v1 series
#19 lore raw
In reply to Laurent Pinchart

Hello Laurent,

thanks for the patch and putting in some progress.

Am Mittwoch, 7. September 2022, 22:04:18 CEST schrieb Laurent Pinchart:

Quoted 35 lines

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
Quoted 1 line

(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