Skip to contentSkip to conversation

Add support for DCMIPP camera interface of STMicroelectronics STM32 SoC series

PATCH Superseded Alain Volmat 2 participants 9 messages Nov 20, 2023 – Nov 22, 2023

Subsystems (5)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Alain Volmat

author maintainer
#0 lore raw

v7 cover Add support for DCMIPP camera interface of STMicroelectronics STM32 SoC series

This patchset introduces support for Digital Camera Memory Interface Pixel Processor (DCMIPP) of STMicroelectronics STM32 SoC series.

This initial support implements a single capture pipe allowing RGB565, YUV, Y, RAW8 and JPEG capture with frame skipping, prescaling and cropping.

DCMIPP is exposed through 3 subdevices:
- dcmipp_dump_parallel: parallel interface handling
- dcmipp_dump_postproc: frame skipping, prescaling and cropping control
- dcmipp_dump_capture: video device capture node

v7:
- correct byteproc set_fmt handling and compose/crop/fmt handling
- replace few v4l2_subdev_get_try_* into v4l2_subdev_get_pad_*
- correct ordering within dcmipp_remove

v6:
- correct copyright year in all files
- correct Kconfig (removal of OF addition of select VIDEO_V4L2_SUBDEV_API/MEDIA_CONTROLLER
- add missing mutex_destroy in error handling
- rely on fwnode_graph_get_endpoint_by_id instead of fwnode_graph_get_next_endpoint
- rely on device_get_match_data instead of of_device_get_match_data
- use local variable for pads_flag initialization

v5:
- removal of dcmipp_frame_size & dcmipp_frame_stride and use v4l2_fill_pixfmt
- correct typos & avoid check of available buffer at start_streaming time since this is done by vb2 framework
- avoid set of pad format in dcmipp_par_ent_init and dcmipp_byteproc_ent_init since done via init_cfg
- reorder bound functions
- use v4l2_subdev_get_fmt in parallel and byteproc subdevs
- correct struct dcmipp_ent_device comments
- removal of dcmipp_hdw_pixel_alignment in bytecap subdev since not applicable in this byte mode pipeline

v4:
- rework of mutex / spinlock handling
- addition of dma mask setting
- removal of __maybe_unused, use pm_ptr and new declaration macros
- driver now only generate a single stm32-dcmipp.ko module instead of several as before
- removal of the component framework usage
- various small fixes (function names, lowercase values, indentation, print formats)
- register name removal in register access function, only dev_dbg with address & values are kept
- removal of VB2_READ and CAP_READWRITE
- usage of subdev active state mechanism and removal of locally stored format/compose/crop
- addition of port { } within the stm32mp135.dtsi

v3:
- Have same To & Cc in all patches emails of the serie so that everybody has coherent view of the serie
- bindings: correct wording, clock-names & label removal
- driver: replace of_graph call with fwnode_graph
- driver: use defined bus-type when calling v4l2_fwnode_endpoint_parse
- driver: remove clock name
- dtsi: remove clock-names property

v2:
- removal of pclk-max-frequency from yaml example dts
- codying-style fixes
- correction in enum functions (format, mbus, frame_size ...) handling
- drop of v4l2_pipeline_pm_ calls, and specific open/close handler of vdev
- video dev s_stream handling updated to call s_stream of remote subdev instead of loop until sensor subdev
- code update following media_pipeline & v4l2_async_ api changes since v1
- removal of IP reset call upon error
- removal of link_validate handlers
- addition of V4L2_CAP_IO_MC device_caps
- removal of the frame skip control for the time being, will be added back in another commit once control method will be agreed
- change byteproc entity type to MEDIA_ENT_F_PROC_VIDEO_SCALER
- various fixes from Dan & Sakari remarks

Alain Volmat (2):
dt-bindings: media: add bindings for stm32 dcmipp
media: MAINTAINERS: add entry for STM32 DCMIPP driver

Hugues Fruchet (3):
media: stm32-dcmipp: STM32 DCMIPP camera interface driver
ARM: dts: stm32: add dcmipp support to stm32mp135
ARM: multi_v7_defconfig: enable STM32 DCMIPP media support

 .../bindings/media/st,stm32-dcmipp.yaml       |  89 ++
 MAINTAINERS                                   |   5 +-
 arch/arm/boot/dts/st/stm32mp135.dtsi          |  11 +
 arch/arm/configs/multi_v7_defconfig           |   1 +
 drivers/media/platform/st/stm32/Kconfig       |  16 +
 drivers/media/platform/st/stm32/Makefile      |   1 +
 .../platform/st/stm32/stm32-dcmipp/Makefile   |   4 +
 .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c    | 914 ++++++++++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c   | 565 +++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-common.c     | 106 ++
 .../st/stm32/stm32-dcmipp/dcmipp-common.h     | 216 +++++
 .../st/stm32/stm32-dcmipp/dcmipp-core.c       | 604 ++++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-parallel.c   | 440 +++++++++
 13 files changed, 2971 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/Makefile
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-parallel.c
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v7 1/5 dt-bindings: media: add bindings for stm32 dcmipp

Add the yaml binding for the ST Microelectronics STM32 DCMIPP (Digital Camera Memory Interface Pixel Processor)

---
 .../bindings/media/st,stm32-dcmipp.yaml       | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml
Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml new file +89 -0
new file mode 100644
index 000000000000..87731f3ce7bd
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/st,stm32-dcmipp.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32 DCMIPP Digital Camera Memory Interface Pixel Processor
+
+maintainers:
+  - Hugues Fruchet <[email protected]>
+  - Alain Volmat <[email protected]>
+
+properties:
+  compatible:
+    const: st,stm32mp13-dcmipp
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    unevaluatedProperties: false
+    description:
+      DCMIPP supports a single port node with parallel bus.
+
+    properties:
+      endpoint:
+        $ref: video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          bus-type:
+            enum: [5, 6]
+            default: 5
+
+          bus-width:
+            enum: [8, 10, 12, 14]
+            default: 8
+
+          pclk-sample: true
+          hsync-active: true
+          vsync-active: true
+
+        required:
+          - pclk-sample
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/stm32mp13-clks.h>
+    #include <dt-bindings/reset/stm32mp13-resets.h>
+    dcmipp@5a000000 {
+        compatible = "st,stm32mp13-dcmipp";
+        reg = <0x5a000000 0x400>;
+        interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+        resets = <&rcc DCMIPP_R>;
+        clocks = <&rcc DCMIPP_K>;
+
+        port {
+             endpoint {
+                   remote-endpoint = <&mipid02_2>;
+                   bus-width = <8>;
+                   hsync-active = <0>;
+                   vsync-active = <0>;
+                   pclk-sample = <0>;
+             };
+        };
+    };
+
+...
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v7 2/5 media: MAINTAINERS: add entry for STM32 DCMIPP driver

In reply to Alain Volmat

Add the entry related to the STM32 MEDIA DCMIPP driver within the MAINTAINERS file.
Add myself as maintainer of the DCMI driver as well.

---
 MAINTAINERS | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
MAINTAINERS +4 -1
index c3390662f66a..9c72fa65b8ca 100644
@@ -13299,13 +13299,16 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/dvb-frontends/stv6111*
 
-MEDIA DRIVERS FOR STM32 - DCMI
+MEDIA DRIVERS FOR STM32 - DCMI / DCMIPP
 M:	Hugues Fruchet <[email protected]>
+M:	Alain Volmat <[email protected]>
 L:	[email protected]
 S:	Supported
 T:	git git://linuxtv.org/media_tree.git
 F:	Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
 F:	drivers/media/platform/st/stm32/stm32-dcmi.c
+F:	Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml
+F:	drivers/media/platform/st/stm32/stm32-dcmipp/*
 
 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 M:	Mauro Carvalho Chehab <[email protected]>
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v7 3/5 media: stm32-dcmipp: STM32 DCMIPP camera interface driver

In reply to Alain Volmat

From: Hugues Fruchet <[email protected]>

This V4L2 subdev driver enables Digital Camera Memory Interface Pixel Processor(DCMIPP) of STMicroelectronics STM32 SoC series.

---
 drivers/media/platform/st/stm32/Kconfig       |  16 +
 drivers/media/platform/st/stm32/Makefile      |   1 +
 .../platform/st/stm32/stm32-dcmipp/Makefile   |   4 +
 .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c    | 914 ++++++++++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c   | 565 +++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-common.c     | 106 ++
 .../st/stm32/stm32-dcmipp/dcmipp-common.h     | 216 +++++
 .../st/stm32/stm32-dcmipp/dcmipp-core.c       | 604 ++++++++++++
 .../st/stm32/stm32-dcmipp/dcmipp-parallel.c   | 440 +++++++++
 9 files changed, 2866 insertions(+)
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/Makefile
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
 create mode 100644 drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-parallel.c
drivers/media/platform/st/stm32/Kconfig +16 -0
index b22dd4753496..9df9a2a17728 100644
@@ -16,6 +16,22 @@ config VIDEO_STM32_DCMI
 	  To compile this driver as a module, choose M here: the module
 	  will be called stm32-dcmi.
 
+config VIDEO_STM32_DCMIPP
+	tristate "STM32 Digital Camera Memory Interface Pixel Processor (DCMIPP) support"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV
+	depends on ARCH_STM32 || COMPILE_TEST
+	select MEDIA_CONTROLLER
+	select VIDEOBUF2_DMA_CONTIG
+	select VIDEO_V4L2_SUBDEV_API
+	select V4L2_FWNODE
+	help
+	  This module makes the STM32 Digital Camera Memory Interface
+	  Pixel Processor (DCMIPP) available as a v4l2 device.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called stm32-dcmipp.
+
 # Mem2mem drivers
 config VIDEO_STM32_DMA2D
 	tristate "STM32 Chrom-Art Accelerator (DMA2D)"
drivers/media/platform/st/stm32/Makefile +1 -0
index 896ef98a73ab..7ed8297b9b19 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STM32_DCMI) += stm32-dcmi.o
+obj-$(CONFIG_VIDEO_STM32_DCMIPP) += stm32-dcmipp/
 stm32-dma2d-objs := dma2d/dma2d.o dma2d/dma2d-hw.o
 obj-$(CONFIG_VIDEO_STM32_DMA2D) += stm32-dma2d.o
drivers/media/platform/st/stm32/stm32-dcmipp/Makefile new file +4 -0
new file mode 100644
index 000000000000..8920d9388a21
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+stm32-dcmipp-y := dcmipp-core.o dcmipp-common.o dcmipp-parallel.o dcmipp-byteproc.o dcmipp-bytecap.o
+
+obj-$(CONFIG_VIDEO_STM32_DCMIPP) += stm32-dcmipp.o
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c new file +914 -0

914 lines not on this page · raw message

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c new file +565 -0

565 lines not on this page · raw message

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c new file +106 -0

106 lines not on this page · raw message

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h new file +216 -0

216 lines not on this page · raw message

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c new file +604 -0

604 lines not on this page · raw message

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-parallel.c new file +440 -0

440 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH v7 4/5 ARM: dts: stm32: add dcmipp support to stm32mp135

In reply to Alain Volmat

From: Hugues Fruchet <[email protected]>

Add dcmipp support to STM32MP135.

---
 arch/arm/boot/dts/st/stm32mp135.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/st/stm32mp135.dtsi +11 -0
index abf2acd37b4e..68d32f9f5314 100644
@@ -8,5 +8,16 @@
 
 / {
 	soc {
+		dcmipp: dcmipp@5a000000 {
+			compatible = "st,stm32mp13-dcmipp";
+			reg = <0x5a000000 0x400>;
+			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&rcc DCMIPP_R>;
+			clocks = <&rcc DCMIPP_K>;
+			status = "disabled";
+
+			port {
+			};
+		};
 	};
 };
Signature · 1 line
2.25.1
author maintainer
#5 lore raw

PATCH v7 5/5 ARM: multi_v7_defconfig: enable STM32 DCMIPP media support

In reply to Alain Volmat

From: Hugues Fruchet <[email protected]>

Enables support of STM32 DCMIPP V4L2 media driver.

---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
index f08f39a3ed2b..86120e1c1503 100644
@@ -690,6 +690,7 @@ CONFIG_VIDEO_STI_BDISP=m
 CONFIG_VIDEO_STI_DELTA=m
 CONFIG_VIDEO_STI_HVA=m
 CONFIG_VIDEO_STM32_DCMI=m
+CONFIG_VIDEO_STM32_DCMIPP=m
 CONFIG_V4L_TEST_DRIVERS=y
 CONFIG_VIDEO_VIVID=m
 CONFIG_VIDEO_ADV7180=m
Signature · 1 line
2.25.1
#6 lore raw
In reply to Alain Volmat

Hi Alain,

Quoted 7 lines · Alain Volmat

This patchset introduces support for Digital Camera Memory Interface Pixel Processor (DCMIPP) of STMicroelectronics STM32 SoC series.

This initial support implements a single capture pipe allowing RGB565, YUV, Y, RAW8 and JPEG capture with frame skipping, prescaling and cropping.

Quoted 8 lines

DCMIPP is exposed through 3 subdevices:
- dcmipp_dump_parallel: parallel interface handling
- dcmipp_dump_postproc: frame skipping, prescaling and cropping control
- dcmipp_dump_capture: video device capture node

v7:
- correct byteproc set_fmt handling and compose/crop/fmt handling
- replace few v4l2_subdev_get_try_* into v4l2_subdev_get_pad_*

Can you rebase this on my my linuxtv.org tree master branch <URL:https://git.linuxtv.org/sailus/media_tree.git/log/>?

These will be called v4l2_subdev_state_get_* now.

Thanks.

Signature · 3 lines
Regards,

Sakari Ailus
author maintainer
#7 lore raw

Hi Sakari,

Quoted 15 lines · Sakari Ailus

Hi Alain,

Quoted 12 lines · Alain Volmat

This patchset introduces support for Digital Camera Memory Interface Pixel Processor (DCMIPP) of STMicroelectronics STM32 SoC series.

This initial support implements a single capture pipe allowing RGB565, YUV, Y, RAW8 and JPEG capture with frame skipping, prescaling and cropping.

DCMIPP is exposed through 3 subdevices:
- dcmipp_dump_parallel: parallel interface handling
- dcmipp_dump_postproc: frame skipping, prescaling and cropping control
- dcmipp_dump_capture: video device capture node

Quoted 8 lines
Quoted 3 lines

v7:
- correct byteproc set_fmt handling and compose/crop/fmt handling
- replace few v4l2_subdev_get_try_* into v4l2_subdev_get_pad_*

Can you rebase this on my my linuxtv.org tree master branch <URL:https://git.linuxtv.org/sailus/media_tree.git/log/>?

These will be called v4l2_subdev_state_get_* now.

Ok, serie v8 is now rebased on top of the master branch of your tree. I'm going to push the rebased gc2145 sensor driver as well in a moment.

Thanks.
Alain

Quoted 7 lines

Thanks.

Signature · 3 lines
Regards,

Sakari Ailus
#8 lore raw

Hi Alain,

Quoted 22 lines · Alain Volmat

Hi Sakari,

Quoted 19 lines · Sakari Ailus

Hi Alain,

Quoted 15 lines · Alain Volmat

This patchset introduces support for Digital Camera Memory Interface Pixel Processor (DCMIPP) of STMicroelectronics STM32 SoC series.

This initial support implements a single capture pipe allowing RGB565, YUV, Y, RAW8 and JPEG capture with frame skipping, prescaling and cropping.

DCMIPP is exposed through 3 subdevices:
- dcmipp_dump_parallel: parallel interface handling
- dcmipp_dump_postproc: frame skipping, prescaling and cropping control
- dcmipp_dump_capture: video device capture node

v7:
- correct byteproc set_fmt handling and compose/crop/fmt handling
- replace few v4l2_subdev_get_try_* into v4l2_subdev_get_pad_*

Quoted 7 lines
Quoted 4 lines

Can you rebase this on my my linuxtv.org tree master branch <URL:https://git.linuxtv.org/sailus/media_tree.git/log/>?

These will be called v4l2_subdev_state_get_* now.

Ok, serie v8 is now rebased on top of the master branch of your tree. I'm going to push the rebased gc2145 sensor driver as well in a moment.

Thanks. Hans said he's going to merge the API change later this week (Mauro might do that earlier), I'll take these then.

Signature · 3 lines
Regards,

Sakari Ailus