Skip to contentSkip to conversation

Add StarFive Camera Subsystem driver

PATCH Superseded Jack Zhu 5 participants 21 messages Aug 24, 2023 – Aug 30, 2023

Subsystems (3)

v8 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Jack Zhu

author
#0 lore raw

v8 cover Add StarFive Camera Subsystem driver

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

The following are the media graph for the device and the v4l2-compliance output.

===========================================================================
[the media graph]:

digraph board {
	rankdir=TB
	n00000001 [label="{{<port0> 0} | stf_isp\n/dev/v4l-subdev0 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000001:port1 -> n00000008 [style=dashed]
	n00000004 [label="capture_raw\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
	n00000008 [label="capture_yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
	n0000000e [label="{{<port0> 0} | cdns_csi2rx.19800000.csi-bridge\n | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
	n0000000e:port1 -> n00000001:port0 [style=dashed]
	n0000000e:port1 -> n00000004 [style=dashed]
	n00000018 [label="{{} | imx219 6-0010\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000018:port0 -> n0000000e:port0 [style=bold]
}

[the device topology]:

Media controller API version 6.5.0

Media device information
------------------------
driver starfive-camss
model Starfive Camera Subsystem
serial

bus info        platform:19840000.camss
hw revision     0x0
driver version  6.5.0

Device topology
- entity 1: stf_isp (2 pads, 2 links)

            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		[fmt:SRGGB10_1X10/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		<- "cdns_csi2rx.19800000.csi-bridge":1 []
	pad1: Source
		[fmt:YUYV8_1_5X8/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		-> "capture_yuv":0 []

- entity 4: capture_raw (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "cdns_csi2rx.19800000.csi-bridge":1 []

- entity 8: capture_yuv (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "stf_isp":1 []

- entity 14: cdns_csi2rx.19800000.csi-bridge (5 pads, 3 links)

             type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
		<- "imx219 6-0010":0 [ENABLED,IMMUTABLE]
	pad1: Source
		-> "stf_isp":0 []
		-> "capture_raw":0 []
	pad2: Source
	pad3: Source
	pad4: Source

- entity 24: imx219 6-0010 (1 pad, 1 link)

             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev1
	pad0: Source
		[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range
		 crop.bounds:(8,8)/3280x2464
		 crop:(8,8)/3280x2464]
		-> "cdns_csi2rx.19800000.csi-bridge":0 [ENABLED,IMMUTABLE]

===========================================================================
[the v4l2-compliance output]:

v4l2-compliance 1.24.1, 64 bits, 64-bit time_t

Compliance test for stf camss device /dev/video1:

Driver Info:

	Driver name      : stf camss
	Card type        : Starfive Camera Subsystem
	Bus info         : platform:19840000.camss
	Driver version   : 6.5.0
	Capabilities     : 0x84200001

Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.5.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.5.0
Interface Info:
	ID               : 0x0300000a
	Type             : V4L Video
Entity Info:
	ID               : 0x00000008 (8)
	Name             : capture_yuv
	Function         : V4L2 I/O
	Pad 0x01000009   : 0: Sink
	  Link 0x0200000c: from remote pad 0x1000003 of entity 'stf_isp' (Unknown Function (00004009)): Data, Enabled

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Test input 0:

Streaming ioctls:
test read/write: OK (Not Supported)
test blocking wait: OK
test MMAP (no poll): OK
test MMAP (select): OK
test MMAP (epoll): OK
test USERPTR (no poll): OK (Not Supported) test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Total for stf camss device /dev/video1: 53, Succeeded: 53, Failed: 0, Warnings: 0

===========================================================================

Changes in v8:
- Rebased on v6.5-rc7.
- Dropped VIN subdev.
- Created two new video devices: capture_raw and capture_yuv, to replace the previous video devices.
- Dropped VB2_READ io methods.
- Recursively called .s_stream() on subdevs.

v7 link: https://lore.kernel.org/all/[email protected]/

Changes in v7:
- HAS_DMA is used instead of DMA_CMA in Kconfig.
- Dropped some non-essential member variables.
- Used v4l2_async_nf_add_fwnode_remote() to simplify the relevant code.
- Modified some Local variable types in the function.
- Used v4l2_create_fwnode_links_to_pad() to simplify the relevant code.
- Added error handling for clk_prepare_enable().
- Simplified stfcamss_format_info struct and modified the relevant code.
- Dropped enum_input, g_input and s_input.
- Unified v4l2_ioctl_ops struct.
- Used v4l2_fh_open()/vb2_fop_release to replace deprecated APIs.
- Added a camss directory under the starfive directory and modified the patch title.

v6 link: https://lore.kernel.org/all/[email protected]/

Changes in v6:
- Added 'bus-type' in bindings example.
- Corrected spelling errors.
- As reviewed by Bryan, used 'nclks' and 'nrsts' variables.
- Added lccf config for ISP.

v5 link: https://lore.kernel.org/all/[email protected]/

Changes in v5:
- Rebased on v6.4-rc1.
- Added new patch.
- Modified ISP driver.

v4 link: https://lore.kernel.org/all/[email protected]/

Previous cover letter from v4:

This patch series adds support for the StarFive Camera Subsystem found on StarFive JH7110 SoC.

The driver implements V4L2, Media controller and V4L2 subdev interfaces. Camera sensor using V4L2 subdev interface in the kernel is supported.

The driver is tested on VisionFive V2 board with IMX219 camera sensor. GStreamer 1.18.5 with v4l2src plugin is supported.

Previous version link, missing v1 version:

v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/

Jack Zhu (8):
media: dt-bindings: Add JH7110 Camera Subsystem
media: admin-guide: Add starfive_camss.rst for Starfive Camera
Subsystem
media: staging: media: starfive: camss: Add core driver
media: staging: media: starfive: camss: Add video driver
media: staging: media: starfive: camss: Add ISP driver
media: staging: media: starfive: camss: Add capture driver
media: staging: media: starfive: camss: Add interrupt handling
media: staging: media: starfive: camss: Register devices

 .../admin-guide/media/starfive_camss.rst      |  72 +++
 .../media/starfive_camss_graph.dot            |  12 +
 .../admin-guide/media/v4l-drivers.rst         |   1 +
 .../bindings/media/starfive,jh7110-camss.yaml | 180 ++++++
 MAINTAINERS                                   |   9 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |  13 +
 .../staging/media/starfive/camss/stf_camss.c  | 432 +++++++++++++
 .../staging/media/starfive/camss/stf_camss.h  | 134 ++++
 .../media/starfive/camss/stf_capture.c        | 603 ++++++++++++++++++
 .../media/starfive/camss/stf_capture.h        |  87 +++
 .../staging/media/starfive/camss/stf_isp.c    | 407 ++++++++++++
 .../staging/media/starfive/camss/stf_isp.h    | 428 +++++++++++++
 .../media/starfive/camss/stf_isp_hw_ops.c     | 445 +++++++++++++
 .../staging/media/starfive/camss/stf_video.c  | 557 ++++++++++++++++
 .../staging/media/starfive/camss/stf_video.h  | 100 +++
 20 files changed, 3507 insertions(+)
 create mode 100644 Documentation/admin-guide/media/starfive_camss.rst
 create mode 100644 Documentation/admin-guide/media/starfive_camss_graph.dot
 create mode 100644 Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp_hw_ops.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v8 1/8 media: dt-bindings: Add JH7110 Camera Subsystem

Add the bindings documentation for Starfive JH7110 Camera Subsystem which is used for handing image sensor data.

---
 .../bindings/media/starfive,jh7110-camss.yaml | 180 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 2 files changed, 187 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml new file +180 -0
new file mode 100644
index 000000000000..c66586d90fa2
@@ -0,0 +1,180 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/starfive,jh7110-camss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Starfive SoC CAMSS ISP
+
+maintainers:
+  - Jack Zhu <[email protected]>
+  - Changhuang Liang <[email protected]>
+
+description:
+  The Starfive CAMSS ISP is a Camera interface for Starfive JH7110 SoC. It
+  consists of a VIN controller (Video In Controller, a top-level control unit)
+  and an ISP.
+
+properties:
+  compatible:
+    const: starfive,jh7110-camss
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: syscon
+      - const: isp
+
+  clocks:
+    maxItems: 7
+
+  clock-names:
+    items:
+      - const: apb_func
+      - const: wrapper_clk_c
+      - const: dvp_inv
+      - const: axiwr
+      - const: mipi_rx0_pxl
+      - const: ispcore_2x
+      - const: isp_axi
+
+  resets:
+    maxItems: 6
+
+  reset-names:
+    items:
+      - const: wrapper_p
+      - const: wrapper_c
+      - const: axird
+      - const: axiwr
+      - const: isp_top_n
+      - const: isp_top_axi
+
+  power-domains:
+    items:
+      - description: JH7110 ISP Power Domain Switch Controller.
+
+  interrupts:
+    maxItems: 4
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description: Input port for receiving DVP data.
+
+        properties:
+          endpoint:
+            $ref: video-interfaces.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              bus-type:
+                enum: [5, 6]
+
+              bus-width:
+                enum: [8, 10, 12]
+
+              data-shift:
+                enum: [0, 2]
+                default: 0
+
+              hsync-active:
+                enum: [0, 1]
+                default: 1
+
+              vsync-active:
+                enum: [0, 1]
+                default: 1
+
+            required:
+              - bus-type
+              - bus-width
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input port for receiving CSI data.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - power-domains
+  - interrupts
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    isp@19840000 {
+        compatible = "starfive,jh7110-camss";
+        reg = <0x19840000 0x10000>,
+              <0x19870000 0x30000>;
+        reg-names = "syscon", "isp";
+        clocks = <&ispcrg 0>,
+                 <&ispcrg 13>,
+                 <&ispcrg 2>,
+                 <&ispcrg 12>,
+                 <&ispcrg 1>,
+                 <&syscrg 51>,
+                 <&syscrg 52>;
+        clock-names = "apb_func",
+                      "wrapper_clk_c",
+                      "dvp_inv",
+                      "axiwr",
+                      "mipi_rx0_pxl",
+                      "ispcore_2x",
+                      "isp_axi";
+        resets = <&ispcrg 0>,
+                 <&ispcrg 1>,
+                 <&ispcrg 10>,
+                 <&ispcrg 11>,
+                 <&syscrg 41>,
+                 <&syscrg 42>;
+        reset-names = "wrapper_p",
+                      "wrapper_c",
+                      "axird",
+                      "axiwr",
+                      "isp_top_n",
+                      "isp_top_axi";
+        power-domains = <&pwrc 5>;
+        interrupts = <92>, <87>, <88>, <90>;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            port@0 {
+                reg = <0>;
+                vin_from_sc2235: endpoint {
+                    remote-endpoint = <&sc2235_to_vin>;
+                    bus-type = <5>;
+                    bus-width = <8>;
+                    data-shift = <2>;
+                    hsync-active = <1>;
+                    vsync-active = <0>;
+                    pclk-sample = <1>;
+                };
+            };
+
+            port@1 {
+                reg = <1>;
+                vin_from_csi2rx: endpoint {
+                    remote-endpoint = <&csi2rx_to_vin>;
+                };
+            };
+        };
+    };
MAINTAINERS +7 -0
index 3626d52d30cc..a2263f9bbead 100644
@@ -20251,6 +20251,13 @@ M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
 F:	drivers/net/ethernet/adaptec/starfire*
 
+STARFIVE CAMERA SUBSYSTEM DRIVER
+M:	Jack Zhu <[email protected]>
+M:	Changhuang Liang <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
 M:	William Qiu <[email protected]>
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v8 2/8 media: admin-guide: Add starfive_camss.rst for Starfive Camera Subsystem

In reply to Jack Zhu

Add starfive_camss.rst file that documents the Starfive Camera Subsystem driver which is used for handing image sensor data.

---
 .../admin-guide/media/starfive_camss.rst      | 72 +++++++++++++++++++
 .../media/starfive_camss_graph.dot            | 12 ++++
 .../admin-guide/media/v4l-drivers.rst         |  1 +
 MAINTAINERS                                   |  1 +
 4 files changed, 86 insertions(+)
 create mode 100644 Documentation/admin-guide/media/starfive_camss.rst
 create mode 100644 Documentation/admin-guide/media/starfive_camss_graph.dot
Documentation/admin-guide/media/starfive_camss.rst new file +72 -0
new file mode 100644
index 000000000000..ca42e9447c47
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: <isonum.txt>
+
+================================
+Starfive Camera Subsystem driver
+================================
+
+Introduction
+------------
+
+This file documents the driver for the Starfive Camera Subsystem found on
+Starfive JH7110 SoC. The driver is located under drivers/staging/media/starfive/
+camss.
+
+The driver implements V4L2, Media controller and v4l2_subdev interfaces. Camera
+sensor using V4L2 subdev interface in the kernel is supported.
+
+The driver has been successfully used on the Gstreamer 1.18.5 with v4l2src
+plugin.
+
+
+Starfive Camera Subsystem hardware
+----------------------------------
+
+The Starfive Camera Subsystem hardware consists of::
+
+                    |\         +---------------+      +-----------+
+  +----------+      |  \       |               |      |           |
+  |          |      |   |      |               |      |           |
+  |   MIPI   |----->|   |----->|      ISP      |----->|           |
+  |          |      |   |      |               |      |           |
+  +----------+      |   |      |               |      |  Memory   |
+                    |MUX|      +---------------+      | Interface |
+  +----------+      |   |                             |           |
+  |          |      |   |---------------------------->|           |
+  | Parallel |----->|   |                             |           |
+  |          |      |   |                             |           |
+  +----------+      |  /                              |           |
+                    |/                                +-----------+
+
+- MIPI: The MIPI interface, receiving data from a MIPI CSI-2 camera sensor.
+
+- Parallel: The parallel interface,  receiving data from a parallel sensor.
+
+- ISP: The ISP, processing raw Bayer data from an image sensor and producing
+  YUV frames.
+
+
+Topology
+--------
+
+The media controller pipeline graph is as follows:
+
+.. _starfive_camss_graph:
+
+.. kernel-figure:: starfive_camss_graph.dot
+    :alt:   starfive_camss_graph.dot
+    :align: center
+
+The driver has 2 video devices:
+
+- capture_raw: The capture device, capturing image data directly from a sensor.
+- capture_yuv: The capture device, capturing YUV frame data processed by the
+  ISP module
+
+The driver has 3 subdevices:
+
+- stf_isp: is responsible for all the isp operations, outputs YUV frames.
+- cdns_csi2rx: a CSI-2 bridge supporting up to 4 CSI lanes in input, and 4
+  different pixel streams in output.
+- imx219: an image sensor, image data is sent through MIPI CSI-2.
Documentation/admin-guide/media/starfive_camss_graph.dot new file +12 -0
new file mode 100644
index 000000000000..8eff1f161ac7
@@ -0,0 +1,12 @@
+digraph board {
+	rankdir=TB
+	n00000001 [label="{{<port0> 0} | stf_isp\n/dev/v4l-subdev0 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000001:port1 -> n00000008 [style=dashed]
+	n00000004 [label="capture_raw\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
+	n00000008 [label="capture_yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
+	n0000000e [label="{{<port0> 0} | cdns_csi2rx.19800000.csi-bridge\n | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
+	n0000000e:port1 -> n00000001:port0 [style=dashed]
+	n0000000e:port1 -> n00000004 [style=dashed]
+	n00000018 [label="{{} | imx219 6-0010\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000018:port0 -> n0000000e:port0 [style=bold]
+}
Documentation/admin-guide/media/v4l-drivers.rst +1 -0
index 1c41f87c3917..2274fd29c1d7 100644
@@ -27,6 +27,7 @@ Video4Linux (V4L) driver-specific documentation
 	si470x
 	si4713
 	si476x
+	starfive_camss
 	vimc
 	visl
 	vivid
MAINTAINERS +1 -0
index a2263f9bbead..4c63c0a85301 100644
@@ -20256,6 +20256,7 @@ M:	Jack Zhu <[email protected]>
 M:	Changhuang Liang <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
 
 STARFIVE CRYPTO DRIVER
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v8 3/8 media: staging: media: starfive: camss: Add core driver

In reply to Jack Zhu

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---
 MAINTAINERS                                   |   1 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |   9 +
 .../staging/media/starfive/camss/stf_camss.c  | 316 ++++++++++++++++++
 .../staging/media/starfive/camss/stf_camss.h  | 129 +++++++
 9 files changed, 482 insertions(+)
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.h
MAINTAINERS +1 -0
index 4c63c0a85301..97d3054416ed 100644
@@ -20258,6 +20258,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+F:	drivers/staging/media/starfive/camss
 
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
drivers/staging/media/Kconfig +2 -0
index bc6c7b248f86..554c2e475ce3 100644
@@ -36,6 +36,8 @@ source "drivers/staging/media/omap4iss/Kconfig"
 
 source "drivers/staging/media/rkvdec/Kconfig"
 
+source "drivers/staging/media/starfive/Kconfig"
+
 source "drivers/staging/media/sunxi/Kconfig"
 
 source "drivers/staging/media/tegra-video/Kconfig"
drivers/staging/media/Makefile +1 -0
index 1a4c3a062e3d..dcaeeca0ee6d 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_VIDEO_MAX96712)	+= max96712/
 obj-$(CONFIG_VIDEO_MESON_VDEC)	+= meson/vdec/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
 obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC)	+= rkvdec/
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS)	+= starfive/
 obj-$(CONFIG_VIDEO_SUNXI)	+= sunxi/
 obj-$(CONFIG_VIDEO_TEGRA)	+= tegra-video/
 obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
drivers/staging/media/starfive/Kconfig new file +5 -0
new file mode 100644
index 000000000000..34727cf56072
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+comment "StarFive media platform drivers"
+
+source "drivers/staging/media/starfive/camss/Kconfig"
drivers/staging/media/starfive/Makefile new file +2 -0
new file mode 100644
index 000000000000..4639fa1bca32
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += camss/
drivers/staging/media/starfive/camss/Kconfig new file +17 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+	tristate "Starfive Camera Subsystem driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV && OF
+	depends on HAS_DMA
+	depends on PM
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	help
+	   Enable this to support for the Starfive Camera subsystem
+	   found on Starfive JH7110 SoC.
+
+	   To compile this driver as a module, choose M here: the
+	   module will be called stf-camss.
drivers/staging/media/starfive/camss/Makefile new file +9 -0
new file mode 100644
index 000000000000..f53c5cbe958f
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for StarFive Camera Subsystem driver
+#
+
+starfive-camss-objs += \
+		stf_camss.o
+
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf_camss.c new file +316 -0

316 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf_camss.h new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v8 3/8] media: staging: media: starfive: camss: Add core driver

Le 24/08/2023 à 10:01, Jack Zhu a écrit :

Quoted 6 lines

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---

...

Quoted 13 lines
drivers/staging/media/starfive/camss/Kconfig new file +7 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+	tristate "Starfive Camera Subsystem driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV && OF
+	depends on HAS_DMA
+	depends on PM

drivers/staging/media/starfive/camss/Kconfig line 17

Quoted 10 lines
drivers/staging/media/starfive/camss/Kconfig new file +10 -0
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	help
+	   Enable this to support for the Starfive Camera subsystem
+	   found on Starfive JH7110 SoC.
+
+	   To compile this driver as a module, choose M here: the
+	   module will be called stf-camss.

stf_camss? (s/-/_)

Quoted 6 lines
drivers/staging/media/starfive/camss/Makefile new file +0 -0
new file mode 100644
index 000000000000..f53c5cbe958f

drivers/staging/media/starfive/camss/Makefile line 9

Quoted 9 lines
drivers/staging/media/starfive/camss/Makefile new file +9 -0
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for StarFive Camera Subsystem driver
+#
+
+starfive-camss-objs += \
+		stf_camss.o
+
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o

I'm not an expert in Makefile files, but this stf_camss.o and starfive-camss.o look strange to me.

Quoted 5 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +0 -0
new file mode 100644
index 000000000000..75ebc3a35218

...

Quoted 8 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +8 -0
+static int stfcamss_of_parse_ports(struct stfcamss *stfcamss)
+{
+	struct device_node *node = NULL;
+	int ret, num_subdevs = 0;
+
+	for_each_endpoint_of_node(stfcamss->dev->of_node, node) {
+		struct stfcamss_async_subdev *csd;
+

drivers/staging/media/starfive/camss/stf_camss.c line 103

Quoted 10 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +10 -0
+		if (!of_device_is_available(node))
+			continue;
+
+		csd = v4l2_async_nf_add_fwnode_remote(&stfcamss->notifier,
+						      of_fwnode_handle(node),
+						      struct stfcamss_async_subdev);
+		if (IS_ERR(csd)) {
+			ret = PTR_ERR(csd);
+			dev_err(stfcamss->dev, "failed to add async notifier\n");
+			v4l2_async_nf_cleanup(&stfcamss->notifier);

having it here, looks strange to me.
It is already called in the error handling path of the probe.

Should there be a "of_node_put(node);" if we return here?

Quoted 12 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +12 -0
+			return ret;
+		}
+
+		ret = stfcamss_of_parse_endpoint_node(stfcamss, node, csd);
+		if (ret)
+			return ret;
+
+		num_subdevs++;
+	}
+
+	return num_subdevs;
+}

...

drivers/staging/media/starfive/camss/stf_camss.c line 245

Quoted 6 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +6 -0
+static int stfcamss_remove(struct platform_device *pdev)
+{
+	struct stfcamss *stfcamss = platform_get_drvdata(pdev);
+
+	v4l2_device_unregister(&stfcamss->v4l2_dev);
+	media_device_cleanup(&stfcamss->media_dev);

Is a "v4l2_async_nf_cleanup(&stfcamss->notifier);" missing to match the error handling path of the probe?

Quoted 5 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +5 -0
+	pm_runtime_disable(&pdev->dev);
+
+	return 0;
+}
+

...

author
#5 lore raw

Re: [PATCH v8 3/8] media: staging: media: starfive: camss: Add core driver

Hi Christophe,

Thank you for your comment!

Quoted 27 lines · Christophe JAILLET

Le 24/08/2023 à 10:01, Jack Zhu a écrit :

Quoted 6 lines

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---

...

Quoted 17 lines
drivers/staging/media/starfive/camss/Kconfig new file +11 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+    tristate "Starfive Camera Subsystem driver"
+    depends on V4L_PLATFORM_DRIVERS
+    depends on VIDEO_DEV && OF
+    depends on HAS_DMA
+    depends on PM
+    select MEDIA_CONTROLLER
+    select VIDEO_V4L2_SUBDEV_API
+    select VIDEOBUF2_DMA_CONTIG
+    select V4L2_FWNODE
Quoted 9 lines

drivers/staging/media/starfive/camss/Kconfig line 17

Quoted 6 lines
drivers/staging/media/starfive/camss/Kconfig new file +6 -0
+    help
+       Enable this to support for the Starfive Camera subsystem
+       found on Starfive JH7110 SoC.
+
+       To compile this driver as a module, choose M here: the
+       module will be called stf-camss.

stf_camss? (s/-/_)

Refer to the writing method of other media drivers, most of them use hyphen. It may be better to use ‘starfive-camss'?

Quoted 9 lines
Quoted 9 lines
drivers/staging/media/starfive/camss/Makefile new file +3 -0
new file mode 100644
index 000000000000..f53c5cbe958f
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for StarFive Camera Subsystem driver
Quoted 9 lines

drivers/staging/media/starfive/camss/Makefile line 9

Quoted 6 lines
drivers/staging/media/starfive/camss/Makefile new file +6 -0
+#
+
+starfive-camss-objs += \
+        stf_camss.o
+
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o

I'm not an expert in Makefile files, but this stf_camss.o and starfive-camss.o look strange to me.

Is it better to replace 'stf_camss.o' with 'stf-camss.o', which is consistent with the driving style of other media drivers?

Quoted 30 lines
Quoted 5 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +0 -0
new file mode 100644
index 000000000000..75ebc3a35218

...

Quoted 8 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +8 -0
+static int stfcamss_of_parse_ports(struct stfcamss *stfcamss)
+{
+    struct device_node *node = NULL;
+    int ret, num_subdevs = 0;
+
+    for_each_endpoint_of_node(stfcamss->dev->of_node, node) {
+        struct stfcamss_async_subdev *csd;
+

drivers/staging/media/starfive/camss/stf_camss.c line 103

Quoted 10 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +10 -0
+        if (!of_device_is_available(node))
+            continue;
+
+        csd = v4l2_async_nf_add_fwnode_remote(&stfcamss->notifier,
+                              of_fwnode_handle(node),
+                              struct stfcamss_async_subdev);
+        if (IS_ERR(csd)) {
+            ret = PTR_ERR(csd);
+            dev_err(stfcamss->dev, "failed to add async notifier\n");
+            v4l2_async_nf_cleanup(&stfcamss->notifier);

having it here, looks strange to me.
It is already called in the error handling path of the probe.

Quoted 2 lines

Should there be a "of_node_put(node);" if we return here?

We do not call a 'get' interface, is it necessary to use the 'put' interface?

Quoted 31 lines
Quoted 12 lines

+            return ret;
+        }

drivers/staging/media/starfive/camss/stf_camss.c new file +10 -0
+
+        ret = stfcamss_of_parse_endpoint_node(stfcamss, node, csd);
+        if (ret)
+            return ret;
+
+        num_subdevs++;
+    }
+
+    return num_subdevs;
+}

...

drivers/staging/media/starfive/camss/stf_camss.c line 245

Quoted 6 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +6 -0
+static int stfcamss_remove(struct platform_device *pdev)
+{
+    struct stfcamss *stfcamss = platform_get_drvdata(pdev);
+
+    v4l2_device_unregister(&stfcamss->v4l2_dev);
+    media_device_cleanup(&stfcamss->media_dev);

Is a "v4l2_async_nf_cleanup(&stfcamss->notifier);" missing to match the error handling path of the probe?

Quoted 5 lines

+    pm_runtime_disable(&pdev->dev);

drivers/staging/media/starfive/camss/stf_camss.c new file +4 -0
+
+    return 0;
+}
+

...

#6 lore raw

Re: [PATCH v8 3/8] media: staging: media: starfive: camss: Add core driver

Le 25/08/2023 à 12:44, Jack Zhu a écrit :

Quoted 42 lines

Hi Christophe,

Thank you for your comment!

Quoted 27 lines · Christophe JAILLET

Le 24/08/2023 à 10:01, Jack Zhu a écrit :

Quoted 6 lines

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---

...

Quoted 17 lines
drivers/staging/media/starfive/camss/Kconfig new file +11 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+    tristate "Starfive Camera Subsystem driver"
+    depends on V4L_PLATFORM_DRIVERS
+    depends on VIDEO_DEV && OF
+    depends on HAS_DMA
+    depends on PM
+    select MEDIA_CONTROLLER
+    select VIDEO_V4L2_SUBDEV_API
+    select VIDEOBUF2_DMA_CONTIG
+    select V4L2_FWNODE
Quoted 9 lines

drivers/staging/media/starfive/camss/Kconfig

Quoted 6 lines
drivers/staging/media/starfive/camss/Kconfig new file +6 -0
+    help
+       Enable this to support for the Starfive Camera subsystem
+       found on Starfive JH7110 SoC.
+
+       To compile this driver as a module, choose M here: the
+       module will be called msstf-cas.

stf_camss? (s/-/_)

Quoted 1 line

Refer to the writing method of other media drivers, most of them use hyphen.

Forget about my comment. I have been puzzled by "msstf-cas" here, vs "stf_camss" below.

Quoted 1 line

it may be better to use ‘starfive-camss'?

Yes, I think so.

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
drivers/staging/media/starfive/camss/Makefile new file +3 -0
new file mode 100644
index 000000000000..f53c5cbe958f
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for StarFive Camera Subsystem driver
Quoted 9 lines

drivers/staging/media/starfive/camss/Makefile line 9

Quoted 6 lines
drivers/staging/media/starfive/camss/Makefile new file +6 -0
+#
+
+starfive-camss-objs += \
+        stf_camss.o
+
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o

I'm not an expert in Makefile files, but this stf_camss.o and starfive-camss.o look strange to me.

Quoted 2 lines

Is it better to replace 'stf_camss.o' with 'stf-camss.o', which is consistent with the driving style of other media drivers?

No strong opinion on it.
Consistency is always good.

Quoted 31 lines
Quoted 31 lines
Quoted 6 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +0 -0
new file mode 100644
index 000000000000..75ebc3a35218

...

Quoted 8 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +8 -0
+static int stfcamss_of_parse_ports(struct stfcamss *stfcamss)
+{
+    struct device_node *node = NULL;
+    int ret, num_subdevs = 0;
+
+    for_each_endpoint_of_node(stfcamss->dev->of_node, node) {
+        struct stfcamss_async_subdev *csd;
+

drivers/staging/media/starfive/camss/stf_camss.c line 103

Quoted 10 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +10 -0
+        if (!of_device_is_available(node))
+            continue;
+
+        csd = v4l2_async_nf_add_fwnode_remote(&stfcamss->notifier,
+                              of_fwnode_handle(node),
+                              struct stfcamss_async_subdev);
+        if (IS_ERR(csd)) {
+            ret = PTR_ERR(csd);
+            dev_err(stfcamss->dev, "failed to add async notifier\n");
+            v4l2_async_nf_cleanup(&stfcamss->notifier);

having it here, looks strange to me.
It is already called in the error handling path of the probe.

Quoted 4 lines
Quoted 2 lines

Should there be a "of_node_put(node);" if we return here?

We do not call a 'get' interface, is it necessary to use the 'put' interface?

for_each_endpoint_of_node() does.

See [1] for doc, and [2] for an example.

[1]: https://elixir.bootlin.com/linux/v6.5-rc7/source/include/linux/of_graph.h#L30

[2]: https://elixir.bootlin.com/linux/v6.5-rc7/source/drivers/gpu/drm/bridge/tc358767.c#L2196

Also, at least because of the recent b8ec754ae4c5 in -next, your patch does not compile as-is on -next.

CJ

Quoted 33 lines
Quoted 32 lines
Quoted 13 lines

+            return ret;
+        }

drivers/staging/media/starfive/camss/stf_camss.c new file +10 -0
+
+        ret = stfcamss_of_parse_endpoint_node(stfcamss, node, csd);
+        if (ret)
+            return ret;
+
+        num_subdevs++;
+    }
+
+    return num_subdevs;
+}

...

drivers/staging/media/starfive/camss/stf_camss.c line 245

Quoted 6 lines
drivers/staging/media/starfive/camss/stf_camss.c new file +6 -0
+static int stfcamss_remove(struct platform_device *pdev)
+{
+    struct stfcamss *stfcamss = platform_get_drvdata(pdev);
+
+    v4l2_device_unregister(&stfcamss->v4l2_dev);
+    media_device_cleanup(&stfcamss->media_dev);

Is a "v4l2_async_nf_cleanup(&stfcamss->notifier);" missing to match the error handling path of the probe?

Quoted 5 lines

+    pm_runtime_disable(&pdev->dev);

drivers/staging/media/starfive/camss/stf_camss.c new file +4 -0
+
+    return 0;
+}
+

...

#7 lore raw

Re: [PATCH v8 3/8] media: staging: media: starfive: camss: Add core driver

In reply to Jack Zhu
Quoted 92 lines · Jack Zhu

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---
 MAINTAINERS                                   |   1 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |   9 +
 .../staging/media/starfive/camss/stf_camss.c  | 316 ++++++++++++++++++
 .../staging/media/starfive/camss/stf_camss.h  | 129 +++++++
 9 files changed, 482 insertions(+)
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.h
MAINTAINERS +1 -0
index 4c63c0a85301..97d3054416ed 100644
@@ -20258,6 +20258,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+F:	drivers/staging/media/starfive/camss
 
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
drivers/staging/media/Kconfig +2 -0
index bc6c7b248f86..554c2e475ce3 100644
@@ -36,6 +36,8 @@ source "drivers/staging/media/omap4iss/Kconfig"
 
 source "drivers/staging/media/rkvdec/Kconfig"
 
+source "drivers/staging/media/starfive/Kconfig"
+
 source "drivers/staging/media/sunxi/Kconfig"
 
 source "drivers/staging/media/tegra-video/Kconfig"
drivers/staging/media/Makefile +1 -0
index 1a4c3a062e3d..dcaeeca0ee6d 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_VIDEO_MAX96712)	+= max96712/
 obj-$(CONFIG_VIDEO_MESON_VDEC)	+= meson/vdec/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
 obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC)	+= rkvdec/
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS)	+= starfive/
 obj-$(CONFIG_VIDEO_SUNXI)	+= sunxi/
 obj-$(CONFIG_VIDEO_TEGRA)	+= tegra-video/
 obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
drivers/staging/media/starfive/Kconfig new file +5 -0
new file mode 100644
index 000000000000..34727cf56072
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+comment "StarFive media platform drivers"
+
+source "drivers/staging/media/starfive/camss/Kconfig"
drivers/staging/media/starfive/Makefile new file +2 -0
new file mode 100644
index 000000000000..4639fa1bca32
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += camss/
drivers/staging/media/starfive/camss/Kconfig new file +7 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+	tristate "Starfive Camera Subsystem driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV && OF
+	depends on HAS_DMA
+	depends on PM

drivers/staging/media/starfive/camss/Kconfig line 17

Quoted 10 lines
drivers/staging/media/starfive/camss/Kconfig new file +10 -0
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	help
+	   Enable this to support for the Starfive Camera subsystem
+	   found on Starfive JH7110 SoC.
+
+	   To compile this driver as a module, choose M here: the
+	   module will be called stf-camss.

Erm, isn't it called starfive-camss.ko?

Regards,

Hans

#8 lore raw

Re: [PATCH v8 3/8] media: staging: media: starfive: camss: Add core driver

In reply to Jack Zhu
Quoted 92 lines · Jack Zhu

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---
 MAINTAINERS                                   |   1 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |   9 +
 .../staging/media/starfive/camss/stf_camss.c  | 316 ++++++++++++++++++
 .../staging/media/starfive/camss/stf_camss.h  | 129 +++++++
 9 files changed, 482 insertions(+)
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.h
MAINTAINERS +1 -0
index 4c63c0a85301..97d3054416ed 100644
@@ -20258,6 +20258,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+F:	drivers/staging/media/starfive/camss
 
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
drivers/staging/media/Kconfig +2 -0
index bc6c7b248f86..554c2e475ce3 100644
@@ -36,6 +36,8 @@ source "drivers/staging/media/omap4iss/Kconfig"
 
 source "drivers/staging/media/rkvdec/Kconfig"
 
+source "drivers/staging/media/starfive/Kconfig"
+
 source "drivers/staging/media/sunxi/Kconfig"
 
 source "drivers/staging/media/tegra-video/Kconfig"
drivers/staging/media/Makefile +1 -0
index 1a4c3a062e3d..dcaeeca0ee6d 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_VIDEO_MAX96712)	+= max96712/
 obj-$(CONFIG_VIDEO_MESON_VDEC)	+= meson/vdec/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
 obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC)	+= rkvdec/
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS)	+= starfive/
 obj-$(CONFIG_VIDEO_SUNXI)	+= sunxi/
 obj-$(CONFIG_VIDEO_TEGRA)	+= tegra-video/
 obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
drivers/staging/media/starfive/Kconfig new file +5 -0
new file mode 100644
index 000000000000..34727cf56072
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+comment "StarFive media platform drivers"
+
+source "drivers/staging/media/starfive/camss/Kconfig"
drivers/staging/media/starfive/Makefile new file +2 -0
new file mode 100644
index 000000000000..4639fa1bca32
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += camss/
drivers/staging/media/starfive/camss/Kconfig new file +7 -0
new file mode 100644
index 000000000000..8d20e2bd2559
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+	tristate "Starfive Camera Subsystem driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV && OF
+	depends on HAS_DMA
+	depends on PM

drivers/staging/media/starfive/camss/Kconfig line 17

Quoted 10 lines
drivers/staging/media/starfive/camss/Kconfig new file +10 -0
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	help
+	   Enable this to support for the Starfive Camera subsystem
+	   found on Starfive JH7110 SoC.
+
+	   To compile this driver as a module, choose M here: the
+	   module will be called stf-camss.

This is actually called starfive-camss.ko!

Regards,

Hans

author
#9 lore raw

PATCH v8 4/8 media: staging: media: starfive: camss: Add video driver

In reply to Jack Zhu

Add video driver for StarFive Camera Subsystem.

---
 drivers/staging/media/starfive/camss/Makefile |   3 +-
 .../staging/media/starfive/camss/stf_video.c  | 557 ++++++++++++++++++
 .../staging/media/starfive/camss/stf_video.h  | 100 ++++
 3 files changed, 659 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.h
drivers/staging/media/starfive/camss/Makefile +2 -1
index f53c5cbe958f..eb457917a914 100644
@@ -4,6 +4,7 @@
 #
 
 starfive-camss-objs += \
-		stf_camss.o
+		stf_camss.o \
+		stf_video.o
 
 obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf_video.c new file +557 -0

557 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf_video.h new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#10 lore raw

PATCH v8 5/8 media: staging: media: starfive: camss: Add ISP driver

In reply to Jack Zhu

Add ISP driver for StarFive Camera Subsystem.

---
 drivers/staging/media/starfive/camss/Makefile |   2 +
 .../staging/media/starfive/camss/stf_camss.h  |   3 +
 .../staging/media/starfive/camss/stf_isp.c    | 407 ++++++++++++++++
 .../staging/media/starfive/camss/stf_isp.h    | 428 +++++++++++++++++
 .../media/starfive/camss/stf_isp_hw_ops.c     | 445 ++++++++++++++++++
 5 files changed, 1285 insertions(+)
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp_hw_ops.c
drivers/staging/media/starfive/camss/Makefile +2 -0
index eb457917a914..cdf57e8c9546 100644
@@ -5,6 +5,8 @@
 
 starfive-camss-objs += \
 		stf_camss.o \
+		stf_isp.o \
+		stf_isp_hw_ops.o \
 		stf_video.o
 
 obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf_camss.h +3 -0
index 6110433e59f7..e0f7ee9f2583 100644
@@ -18,6 +18,8 @@
 #include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 
+#include "stf_isp.h"
+
 enum stf_port_num {
 	STF_PORT_DVP = 0,
 	STF_PORT_CSI2RX
@@ -49,6 +51,7 @@ struct stfcamss {
 	struct media_device media_dev;
 	struct media_pipeline pipe;
 	struct device *dev;
+	struct stf_isp_dev isp_dev;
 	struct v4l2_async_notifier notifier;
 	void __iomem *syscon_base;
 	void __iomem *isp_base;
drivers/staging/media/starfive/camss/stf_isp.c new file +407 -0

407 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf_isp.h new file +428 -0

428 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf_isp_hw_ops.c new file +445 -0

445 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#11 lore raw

PATCH v8 6/8 media: staging: media: starfive: camss: Add capture driver

In reply to Jack Zhu

Add capture driver for StarFive Camera Subsystem. It contains two video
devices: capture_yuv and capture_raw.

---
 drivers/staging/media/starfive/camss/Makefile |   1 +
 .../staging/media/starfive/camss/stf_camss.h  |   2 +
 .../media/starfive/camss/stf_capture.c        | 603 ++++++++++++++++++
 .../media/starfive/camss/stf_capture.h        |  87 +++
 4 files changed, 693 insertions(+)
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.h
drivers/staging/media/starfive/camss/Makefile +1 -0
index cdf57e8c9546..685f9f16acba 100644
@@ -5,6 +5,7 @@
 
 starfive-camss-objs += \
 		stf_camss.o \
+		stf_capture.o \
 		stf_isp.o \
 		stf_isp_hw_ops.o \
 		stf_video.o
drivers/staging/media/starfive/camss/stf_camss.h +2 -0
index e0f7ee9f2583..5e026a4c0528 100644
@@ -19,6 +19,7 @@
 #include <media/v4l2-device.h>
 
 #include "stf_isp.h"
+#include "stf_capture.h"
 
 enum stf_port_num {
 	STF_PORT_DVP = 0,
@@ -52,6 +53,7 @@ struct stfcamss {
 	struct media_pipeline pipe;
 	struct device *dev;
 	struct stf_isp_dev isp_dev;
+	struct stf_capture captures[STF_CAPTURE_NUM];
 	struct v4l2_async_notifier notifier;
 	void __iomem *syscon_base;
 	void __iomem *isp_base;
drivers/staging/media/starfive/camss/stf_capture.c new file +603 -0

603 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf_capture.h new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#12 lore raw

PATCH v8 7/8 media: staging: media: starfive: camss: Add interrupt handling

In reply to Jack Zhu

Parse interrupt resources and register interrupt handlers.

---
 .../staging/media/starfive/camss/stf_camss.c  | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/staging/media/starfive/camss/stf_camss.c +21 -0
index 75ebc3a35218..918b8b2a7713 100644
@@ -35,6 +35,12 @@ static const char * const stfcamss_resets[] = {
 	"rst_isp_top_axi",
 };
 
+static const struct stf_isr_data stf_isrs[] = {
+	{"wr_irq", stf_wr_irq_handler},
+	{"isp_irq", stf_isp_irq_handler},
+	{"line_irq", stf_line_irq_handler},
+};
+
 static int stfcamss_get_mem_res(struct stfcamss *stfcamss)
 {
 	struct platform_device *pdev = to_platform_device(stfcamss->dev);
@@ -157,6 +163,21 @@ static int stfcamss_probe(struct platform_device *pdev)
 
 	stfcamss->dev = dev;
 
+	for (i = 0; i < ARRAY_SIZE(stf_isrs); ++i) {
+		int irq;
+
+		irq = platform_get_irq(pdev, i);
+		if (irq < 0)
+			return irq;
+
+		ret = devm_request_irq(stfcamss->dev, irq, stf_isrs[i].isr, 0,
+				       stf_isrs[i].name, stfcamss);
+		if (ret) {
+			dev_err(dev, "request irq failed: %d\n", ret);
+			return ret;
+		}
+	}
+
 	stfcamss->nclks = ARRAY_SIZE(stfcamss->sys_clk);
 	for (i = 0; i < stfcamss->nclks; ++i)
 		stfcamss->sys_clk[i].id = stfcamss_clocks[i];
Signature · 1 line
2.34.1
author
#13 lore raw

PATCH v8 8/8 media: staging: media: starfive: camss: Register devices

In reply to Jack Zhu

Register ISP sub-device and video devices for StarFive Camera Subsystem.

---
 .../staging/media/starfive/camss/stf_camss.c  | 97 ++++++++++++++++++-
 1 file changed, 96 insertions(+), 1 deletion(-)
drivers/staging/media/starfive/camss/stf_camss.c +96 -1
index 918b8b2a7713..ab8d700d3016 100644
@@ -120,6 +120,85 @@ static int stfcamss_of_parse_ports(struct stfcamss *stfcamss)
 	return num_subdevs;
 }
 
+static int stfcamss_register_devs(struct stfcamss *stfcamss)
+{
+	struct stf_capture *cap_yuv = &stfcamss->captures[STF_CAPTURE_YUV];
+	struct stf_isp_dev *isp_dev = &stfcamss->isp_dev;
+	int ret;
+
+	ret = stf_isp_register(isp_dev, &stfcamss->v4l2_dev);
+	if (ret < 0) {
+		dev_err(stfcamss->dev,
+			"failed to register stf isp%d entity: %d\n", 0, ret);
+		return ret;
+	}
+
+	ret = stf_capture_register(stfcamss, &stfcamss->v4l2_dev);
+	if (ret < 0) {
+		dev_err(stfcamss->dev,
+			"failed to register capture: %d\n", ret);
+		goto err_isp_unregister;
+	}
+
+	ret = media_create_pad_link(&isp_dev->subdev.entity, STF_ISP_PAD_SRC,
+				    &cap_yuv->video.vdev.entity, 0, 0);
+	if (ret)
+		goto err_cap_unregister;
+
+	cap_yuv->video.source_subdev = &isp_dev->subdev;
+
+	return ret;
+
+err_cap_unregister:
+	stf_capture_unregister(stfcamss);
+err_isp_unregister:
+	stf_isp_unregister(&stfcamss->isp_dev);
+
+	return ret;
+}
+
+static void stfcamss_unregister_devs(struct stfcamss *stfcamss)
+{
+	stf_isp_unregister(&stfcamss->isp_dev);
+	stf_capture_unregister(stfcamss);
+}
+
+static int stfcamss_subdev_notifier_bound(struct v4l2_async_notifier *async,
+					  struct v4l2_subdev *subdev,
+					  struct v4l2_async_subdev *asd)
+{
+	struct stfcamss *stfcamss =
+		container_of(async, struct stfcamss, notifier);
+	struct stfcamss_async_subdev *csd =
+		container_of(asd, struct stfcamss_async_subdev, asd);
+	enum stf_port_num port = csd->port;
+	struct stf_isp_dev *isp_dev = &stfcamss->isp_dev;
+	struct stf_capture *cap_raw = &stfcamss->captures[STF_CAPTURE_RAW];
+	struct media_pad *pad;
+	int ret;
+
+	if (port == STF_PORT_CSI2RX) {
+		pad = &isp_dev->pads[STF_ISP_PAD_SINK];
+	} else {
+		dev_err(stfcamss->dev, "not support port %d\n", port);
+		return -EPERM;
+	}
+
+	ret = v4l2_create_fwnode_links_to_pad(subdev, pad, 0);
+	if (ret)
+		return ret;
+
+	ret = media_create_pad_link(&subdev->entity, 1,
+				    &cap_raw->video.vdev.entity, 0, 0);
+	if (ret)
+		return ret;
+
+	isp_dev->source_subdev = subdev;
+	cap_raw->video.source_subdev = subdev;
+
+	return 0;
+}
+
 static int stfcamss_subdev_notifier_complete(struct v4l2_async_notifier *ntf)
 {
 	struct stfcamss *stfcamss =
@@ -130,6 +209,7 @@ static int stfcamss_subdev_notifier_complete(struct v4l2_async_notifier *ntf)
 
 static const struct v4l2_async_notifier_operations
 stfcamss_subdev_notifier_ops = {
+	.bound = stfcamss_subdev_notifier_bound,
 	.complete = stfcamss_subdev_notifier_complete,
 };
 
@@ -214,6 +294,12 @@ static int stfcamss_probe(struct platform_device *pdev)
 		goto err_cleanup_notifier;
 	}
 
+	ret = stf_isp_init(stfcamss);
+	if (ret < 0) {
+		dev_err(dev, "Failed to init isp: %d\n", ret);
+		goto err_cleanup_notifier;
+	}
+
 	stfcamss_mc_init(pdev, stfcamss);
 
 	ret = v4l2_device_register(stfcamss->dev, &stfcamss->v4l2_dev);
@@ -228,6 +314,12 @@ static int stfcamss_probe(struct platform_device *pdev)
 		goto err_unregister_device;
 	}
 
+	ret = stfcamss_register_devs(stfcamss);
+	if (ret < 0) {
+		dev_err(dev, "Failed to register subdevice: %d\n", ret);
+		goto err_unregister_media_dev;
+	}
+
 	pm_runtime_enable(dev);
 
 	stfcamss->notifier.ops = &stfcamss_subdev_notifier_ops;
@@ -236,11 +328,13 @@ static int stfcamss_probe(struct platform_device *pdev)
 		dev_err(dev, "Failed to register async subdev nodes: %d\n",
 			ret);
 		pm_runtime_disable(dev);
-		goto err_unregister_media_dev;
+		goto err_unregister_subdevs;
 	}
 
 	return 0;
 
+err_unregister_subdevs:
+	stfcamss_unregister_devs(stfcamss);
 err_unregister_media_dev:
 	media_device_unregister(&stfcamss->media_dev);
 err_unregister_device:
@@ -262,6 +356,7 @@ static int stfcamss_remove(struct platform_device *pdev)
 {
 	struct stfcamss *stfcamss = platform_get_drvdata(pdev);
 
+	stfcamss_unregister_devs(stfcamss);
 	v4l2_device_unregister(&stfcamss->v4l2_dev);
 	media_device_cleanup(&stfcamss->media_dev);
 	pm_runtime_disable(&pdev->dev);
Signature · 1 line
2.34.1
#14 lore raw
In reply to Jack Zhu
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

thanks,

greg k-h

author
#15 lore raw

Hi Greg,

Quoted 12 lines · Greg Kroah-Hartman
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

The series does not contain 3A interface. According to Laurent's suggestion, we put the driver in the staging directory first. In the next stage, we will continue to submit the 3A interface in the way of incremental development, and finally expect the code to be placed in the drivers/media/.

Quoted 3 lines

thanks,

greg k-h

Signature · 3 lines
Regards,

Jack Zhu
#16 lore raw
Quoted 16 lines · Jack Zhu

Hi Greg,

Quoted 12 lines · Greg Kroah-Hartman
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

Quoted 4 lines

The series does not contain 3A interface. According to Laurent's suggestion, we put the driver in the staging directory first. In the next stage, we will continue to submit the 3A interface in the way of incremental development, and finally expect the code to be placed in the drivers/media/.

Can you please say that in the changelog text for when you are adding the driver so that we know this?

thanks,

greg k-h

#17 lore raw
Quoted 14 lines · Greg Kroah-Hartman
Quoted 13 lines · Jack Zhu
Quoted 11 lines · Greg Kroah-Hartman
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

Quoted 7 lines
Quoted 4 lines

The series does not contain 3A interface. According to Laurent's suggestion, we put the driver in the staging directory first. In the next stage, we will continue to submit the 3A interface in the way of incremental development, and finally expect the code to be placed in the drivers/media/.

Can you please say that in the changelog text for when you are adding the driver so that we know this?

It's also customary to add a TODO file in the driver directory to list the work needed before moving the code to drivers/media/. Jack, could you please do so ?

Signature · 3 lines
Regards,

Laurent Pinchart
author
#18 lore raw
Quoted 20 lines · Laurent Pinchart
Quoted 19 lines · Greg Kroah-Hartman
Quoted 17 lines · Jack Zhu
Quoted 11 lines · Greg Kroah-Hartman
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

The series does not contain 3A interface. According to Laurent's suggestion, we put the driver in the staging directory first. In the next stage, we will continue to submit the 3A interface in the way of incremental development, and finally expect the code to be placed in the drivers/media/.

Quoted 7 lines
Quoted 2 lines

Can you please say that in the changelog text for when you are adding the driver so that we know this?

It's also customary to add a TODO file in the driver directory to list the work needed before moving the code to drivers/media/. Jack, could you please do so ?

Yes, thank you for your reminder.

Quoted 1 line
Signature · 3 lines
Regards,

Jack Zhu
author
#19 lore raw
In reply to Greg Kroah-Hartman
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Jack Zhu

Hi Greg,

Quoted 12 lines · Greg Kroah-Hartman
Quoted 4 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

I don't see anything here about why this is in drivers/staging/media/ now and not just in drivers/media/. What is preventing this to be put into the correct place to start with? What needs to be done to the code to get it out of drivers/staging/media/ and who is going to do that work?

Quoted 8 lines
Quoted 4 lines

The series does not contain 3A interface. According to Laurent's suggestion, we put the driver in the staging directory first. In the next stage, we will continue to submit the 3A interface in the way of incremental development, and finally expect the code to be placed in the drivers/media/.

Can you please say that in the changelog text for when you are adding the driver so that we know this?

Yes, will do it. Thank you for your suggestion!

Quoted 3 lines

thanks,

greg k-h

#20 lore raw
In reply to Jack Zhu

Hi Jack,

Quoted 7 lines · Jack Zhu

Hi,

This series is the v8 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

The following are the media graph for the device and the v4l2-compliance output.

Please note that this driver no longer compiles after v4l2-async changes were merged to our media_stage tree.

Make sure you base your v9 on top of the master branch of
https://git.linuxtv.org/media_stage.git/

Regards,

Hans

Quoted 307 lines

===========================================================================
[the media graph]:

digraph board {
	rankdir=TB
	n00000001 [label="{{<port0> 0} | stf_isp\n/dev/v4l-subdev0 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000001:port1 -> n00000008 [style=dashed]
	n00000004 [label="capture_raw\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
	n00000008 [label="capture_yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
	n0000000e [label="{{<port0> 0} | cdns_csi2rx.19800000.csi-bridge\n | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
	n0000000e:port1 -> n00000001:port0 [style=dashed]
	n0000000e:port1 -> n00000004 [style=dashed]
	n00000018 [label="{{} | imx219 6-0010\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000018:port0 -> n0000000e:port0 [style=bold]
}

[the device topology]:

Media controller API version 6.5.0

Media device information
------------------------
driver starfive-camss
model Starfive Camera Subsystem
serial

bus info        platform:19840000.camss
hw revision     0x0
driver version  6.5.0

Device topology
- entity 1: stf_isp (2 pads, 2 links)

            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		[fmt:SRGGB10_1X10/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		<- "cdns_csi2rx.19800000.csi-bridge":1 []
	pad1: Source
		[fmt:YUYV8_1_5X8/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		-> "capture_yuv":0 []

- entity 4: capture_raw (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "cdns_csi2rx.19800000.csi-bridge":1 []

- entity 8: capture_yuv (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "stf_isp":1 []

- entity 14: cdns_csi2rx.19800000.csi-bridge (5 pads, 3 links)

             type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
		<- "imx219 6-0010":0 [ENABLED,IMMUTABLE]
	pad1: Source
		-> "stf_isp":0 []
		-> "capture_raw":0 []
	pad2: Source
	pad3: Source
	pad4: Source

- entity 24: imx219 6-0010 (1 pad, 1 link)

             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev1
	pad0: Source
		[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range
		 crop.bounds:(8,8)/3280x2464
		 crop:(8,8)/3280x2464]
		-> "cdns_csi2rx.19800000.csi-bridge":0 [ENABLED,IMMUTABLE]

===========================================================================
[the v4l2-compliance output]:

v4l2-compliance 1.24.1, 64 bits, 64-bit time_t

Compliance test for stf camss device /dev/video1:

Driver Info:

	Driver name      : stf camss
	Card type        : Starfive Camera Subsystem
	Bus info         : platform:19840000.camss
	Driver version   : 6.5.0
	Capabilities     : 0x84200001

Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.5.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.5.0
Interface Info:
	ID               : 0x0300000a
	Type             : V4L Video
Entity Info:
	ID               : 0x00000008 (8)
	Name             : capture_yuv
	Function         : V4L2 I/O
	Pad 0x01000009   : 0: Sink
	  Link 0x0200000c: from remote pad 0x1000003 of entity 'stf_isp' (Unknown Function (00004009)): Data, Enabled

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Test input 0:

Streaming ioctls:
test read/write: OK (Not Supported)
test blocking wait: OK
test MMAP (no poll): OK
test MMAP (select): OK
test MMAP (epoll): OK
test USERPTR (no poll): OK (Not Supported) test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Total for stf camss device /dev/video1: 53, Succeeded: 53, Failed: 0, Warnings: 0

===========================================================================

Changes in v8:
- Rebased on v6.5-rc7.
- Dropped VIN subdev.
- Created two new video devices: capture_raw and capture_yuv, to replace the previous video devices.
- Dropped VB2_READ io methods.
- Recursively called .s_stream() on subdevs.

v7 link: https://lore.kernel.org/all/[email protected]/

Changes in v7:
- HAS_DMA is used instead of DMA_CMA in Kconfig.
- Dropped some non-essential member variables.
- Used v4l2_async_nf_add_fwnode_remote() to simplify the relevant code.
- Modified some Local variable types in the function.
- Used v4l2_create_fwnode_links_to_pad() to simplify the relevant code.
- Added error handling for clk_prepare_enable().
- Simplified stfcamss_format_info struct and modified the relevant code.
- Dropped enum_input, g_input and s_input.
- Unified v4l2_ioctl_ops struct.
- Used v4l2_fh_open()/vb2_fop_release to replace deprecated APIs.
- Added a camss directory under the starfive directory and modified the patch title.

v6 link: https://lore.kernel.org/all/[email protected]/

Changes in v6:
- Added 'bus-type' in bindings example.
- Corrected spelling errors.
- As reviewed by Bryan, used 'nclks' and 'nrsts' variables.
- Added lccf config for ISP.

v5 link: https://lore.kernel.org/all/[email protected]/

Changes in v5:
- Rebased on v6.4-rc1.
- Added new patch.
- Modified ISP driver.

v4 link: https://lore.kernel.org/all/[email protected]/

Previous cover letter from v4:

This patch series adds support for the StarFive Camera Subsystem found on StarFive JH7110 SoC.

The driver implements V4L2, Media controller and V4L2 subdev interfaces. Camera sensor using V4L2 subdev interface in the kernel is supported.

The driver is tested on VisionFive V2 board with IMX219 camera sensor. GStreamer 1.18.5 with v4l2src plugin is supported.

Previous version link, missing v1 version:

v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/

Jack Zhu (8):
media: dt-bindings: Add JH7110 Camera Subsystem
media: admin-guide: Add starfive_camss.rst for Starfive Camera
Subsystem
media: staging: media: starfive: camss: Add core driver
media: staging: media: starfive: camss: Add video driver
media: staging: media: starfive: camss: Add ISP driver
media: staging: media: starfive: camss: Add capture driver
media: staging: media: starfive: camss: Add interrupt handling
media: staging: media: starfive: camss: Register devices

 .../admin-guide/media/starfive_camss.rst      |  72 +++
 .../media/starfive_camss_graph.dot            |  12 +
 .../admin-guide/media/v4l-drivers.rst         |   1 +
 .../bindings/media/starfive,jh7110-camss.yaml | 180 ++++++
 MAINTAINERS                                   |   9 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |  13 +
 .../staging/media/starfive/camss/stf_camss.c  | 432 +++++++++++++
 .../staging/media/starfive/camss/stf_camss.h  | 134 ++++
 .../media/starfive/camss/stf_capture.c        | 603 ++++++++++++++++++
 .../media/starfive/camss/stf_capture.h        |  87 +++
 .../staging/media/starfive/camss/stf_isp.c    | 407 ++++++++++++
 .../staging/media/starfive/camss/stf_isp.h    | 428 +++++++++++++
 .../media/starfive/camss/stf_isp_hw_ops.c     | 445 +++++++++++++
 .../staging/media/starfive/camss/stf_video.c  | 557 ++++++++++++++++
 .../staging/media/starfive/camss/stf_video.h  | 100 +++
 20 files changed, 3507 insertions(+)
 create mode 100644 Documentation/admin-guide/media/starfive_camss.rst
 create mode 100644 Documentation/admin-guide/media/starfive_camss_graph.dot
 create mode 100644 Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_camss.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_capture.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp.h
 create mode 100644 drivers/staging/media/starfive/camss/stf_isp_hw_ops.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.c
 create mode 100644 drivers/staging/media/starfive/camss/stf_video.h