Skip to contentSkip to conversation

Support Nuvoton NPCM Video Capture/Encode Engine

PATCH Superseded Marvin Lin 2 participants 12 messages Dec 14, 2022 – Dec 16, 2022

Subsystems (4)

v8 of 16 Superseded Latest is v16 →

lore
Share & tools
lore

Marvin Lin

author
#0 lore raw

v8 cover Support Nuvoton NPCM Video Capture/Encode Engine

This patch series add DTS node, dt-bindings document and drivers for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.

VCD can capture/differentiate video data from digital or analog sources, then the ECE will compress the data into HEXTILE format which is defined in Remote Framebuffer Protocol (RFC 6143, chapter 7.7.4. Hextile Encoding).

The output of v4l2-compliance:
v4l2-compliance 1.23.0-4965, 64 bits, 64-bit time_t v4l2-compliance SHA: d0964d133053 2022-11-06 14:46:45

Compliance test for npcm-video device /dev/video0:

Driver Info:

        Driver name      : npcm-video
        Card type        : NPCM Video Engine
        Bus info         : platform:npcm-video
        Driver version   : 5.15.50
        Capabilities     : 0x85200001

Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format

Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video0 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
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 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 test VIDIOC_DV_TIMINGS_CAP: OK
test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
warn: /usr/src/debug/v4l-utils/1.22.1-r0/utils/v4l2-compliance/v4l2-test-controls.cpp(1070): V4L2_CID_DV_RX_POWER_PRESENT not found for input 0
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 1 Private Controls: 2

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
warn: /usr/src/debug/v4l-utils/1.22.1-r0/utils/v4l2-compliance/v4l2-test-formats.cpp(1411): S_PARM is supported for buftype 1, but not for ENUM_FRAMEINTERVALS
test VIDIOC_G/S_PARM: OK
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 (Not Supported)

Codec ioctls (Input 0):
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 (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Total for npcm-video device /dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 2

Changes in v8:
- Let VCD/ECE to be 2 separate nodes and update dt-binding documents.
- Move register definitions out to a local header file.
- Driver refinements (add error handling for memory allocation, remove unnecessary condition check and introduce "goto"s to handle similar error recovery paths).
- Correct properties and typo in GFXI dt-binding document.

Changes in v7:
- Add uapi documents for driver-specific controls.
- Implement driver-specific controls for switching capture mode and getting the count of compressed HEXTILE rectangles.
- Drop unnecessary "enum_framesizes" and "enum_frameintervals" functions.
- Include the output of v4l2-compliance in cover letter.

Changes in v6:
- Support NPCM845 and add compatible "nuvoton,npcm845-video".
- Correct pixel format to V4L2_PIX_FMT_HEXTILE which is newly added in this patch series.

Changes in v5:
- Simplify function prefix "nuvoton_" to "npcm_".
- Increase VCD_BUSY_TIMEOUT_US and ECE_POLL_TIMEOUT_US to 300ms to prevent polling timeout when ECC is enabled or system is busy.

Changes in v4:
- Fix compile warning reported by kernel test robot.

Changes in v3:
- Add video driver entry in MAINTAINERS.
- Change config name to CONFIG_VIDEO_NPCM_VCD_ECE.
- Reduce the waiting time after resetting the VCD/ECE module.
- Correct data types of some variables.

Changes in v2:
- Add Hextile document and locate with vendor formats.

Marvin Lin (7):
ARM: dts: nuvoton: Add node for NPCM VCD and ECE engine
media: dt-binding: nuvoton: Add bindings for NPCM VCD and ECE engine
dt-bindings: arm: nuvoton: Add bindings for NPCM GFXI
media: v4l: Add HEXTILE compressed format
media: v4l2-ctrls: Reserve user control base for NPCM video controls
media: uapi: Add controls for NPCM video driver
media: nuvoton: Add driver for NPCM video capture and encode engine

 .../bindings/arm/npcm/nuvoton,gfxi.yaml       |   40 +
 .../bindings/media/nuvoton,npcm-ece.yaml      |   44 +
 .../bindings/media/nuvoton,npcm-vcd.yaml      |   72 +
 .../userspace-api/media/drivers/index.rst     |    1 +
 .../media/drivers/npcm-video.rst              |   67 +
 .../media/v4l/pixfmt-reserved.rst             |    7 +
 MAINTAINERS                                   |   12 +
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi |   23 +
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/nuvoton/Kconfig        |   15 +
 drivers/media/platform/nuvoton/Makefile       |    2 +
 drivers/media/platform/nuvoton/npcm-regs.h    |  171 ++
 drivers/media/platform/nuvoton/npcm-video.c   | 1924 +++++++++++++++++
 drivers/media/v4l2-core/v4l2-ioctl.c          |    1 +
 include/uapi/linux/npcm-video.h               |   41 +
 include/uapi/linux/v4l2-controls.h            |    6 +
 include/uapi/linux/videodev2.h                |    1 +
 18 files changed, 2429 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml
 create mode 100644 Documentation/userspace-api/media/drivers/npcm-video.rst
 create mode 100644 drivers/media/platform/nuvoton/Kconfig
 create mode 100644 drivers/media/platform/nuvoton/Makefile
 create mode 100644 drivers/media/platform/nuvoton/npcm-regs.h
 create mode 100644 drivers/media/platform/nuvoton/npcm-video.c
 create mode 100644 include/uapi/linux/npcm-video.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v8 1/7 ARM: dts: nuvoton: Add node for NPCM VCD and ECE engine

Add node for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. Tested with Nuvoton NPCM750 evaluation board.

---
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi +23 -0
index c7b5ef15b716..78a309a56cd5 100644
@@ -179,6 +179,24 @@ fiux: spi@fb001000 {
 			status = "disabled";
 		};
 
+		vcd: vcd@f0810000 {
+			compatible = "nuvoton,npcm750-vcd";
+			reg = <0xf0810000 0x10000>;
+			interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_VCD>;
+			nuvoton,sysgcr = <&gcr>;
+			nuvoton,sysgfxi = <&gfxi>;
+			nuvoton,ece = <&ece>;
+			status = "disabled";
+		};
+
+		ece: ece@f0820000 {
+			compatible = "nuvoton,npcm750-ece";
+			reg = <0xf0820000 0x2000>;
+			resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>;
+			status = "disabled";
+		};
+
 		apb {
 			#address-cells = <1>;
 			#size-cells = <1>;
@@ -554,6 +572,11 @@ i2c15: i2c@8f000 {
 				pinctrl-0 = <&smb15_pins>;
 				status = "disabled";
 			};
+
+			gfxi: gfxi@e000 {
+				compatible = "nuvoton,npcm750-gfxi", "syscon";
+				reg = <0xe000 0x100>;
+			};
 		};
 	};
 
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v8 2/7 media: dt-binding: nuvoton: Add bindings for NPCM VCD and ECE engine

In reply to Marvin Lin

Add dt-binding document for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.

---
 .../bindings/media/nuvoton,npcm-ece.yaml      | 44 ++++++++++++
 .../bindings/media/nuvoton,npcm-vcd.yaml      | 72 +++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +44 -0
new file mode 100644
index 000000000000..d12b76d137d9
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/nuvoton,npcm-ece.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton NPCM Encoding Compression Engine
+
+maintainers:
+  - Joseph Liu <[email protected]>
+  - Marvin Lin <[email protected]>
+
+description: |
+  Video Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-ece
+      - nuvoton,npcm845-ece
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/reset/nuvoton,npcm7xx-reset.h>
+
+    ece: ece@f0820000 {
+        compatible = "nuvoton,npcm750-ece";
+        reg = <0xf0820000 0x2000>;
+        resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>;
+    };
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v8 2/7] media: dt-binding: nuvoton: Add bindings for NPCM VCD and ECE engine

Quoted 2 lines · Marvin Lin

Add dt-binding document for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.

Subject: drop second, redundant "bindings for".

Quoted 15 lines
---
 .../bindings/media/nuvoton,npcm-ece.yaml      | 44 ++++++++++++
 .../bindings/media/nuvoton,npcm-vcd.yaml      | 72 +++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml
 create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +0 -0
new file mode 100644
index 000000000000..d12b76d137d9

Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml line 2

Quoted 2 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +2 -0
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+

Drop blank line.

Quoted 28 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +28 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/nuvoton,npcm-ece.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton NPCM Encoding Compression Engine
+
+maintainers:
+  - Joseph Liu <[email protected]>
+  - Marvin Lin <[email protected]>
+
+description: |
+  Video Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-ece
+      - nuvoton,npcm845-ece
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible

Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml line 40

Quoted 10 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +10 -0
+  - reg
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/reset/nuvoton,npcm7xx-reset.h>
+
+    ece: ece@f0820000 {

If this is video codec, then generic node name: "video-codec". "ece" is specific, not generic.

Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml line 2

Quoted 12 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +4 -0
+        compatible = "nuvoton,npcm750-ece";
+        reg = <0xf0820000 0x2000>;
+        resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>;
+    };
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +2 -0
new file mode 100644
index 000000000000..2d8da8f36506
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+

Drop blank line.

Quoted 34 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +34 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/nuvoton,npcm-vcd.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton NPCM Video Capture/Differentiation Engine
+
+maintainers:
+  - Joseph Liu <[email protected]>
+  - Marvin Lin <[email protected]>
+
+description: |
+  Video Capture/Differentiation Engine (VCD) present on Nuvoton NPCM SoCs.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-vcd
+      - nuvoton,npcm845-vcd
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  nuvoton,sysgcr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to access GCR (Global Control Register) registers.
+
+  nuvoton,sysgfxi:

Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to access GFXI (Graphics Core Information) registers.
+
+  nuvoton,ece:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to access ECE (Encoding Compression Engine) registers.
+
+  memory-region:
+    description:
+      CMA pool to use for buffers allocation instead of the default CMA pool.

maxItems: 1

Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml line 58

Quoted 13 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +12 -0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - resets
+  - nuvoton,sysgcr
+  - nuvoton,sysgfxi
+  - nuvoton,ece
+
+additionalProperties: false
+

Best regards,
Krzysztof

author
#4 lore raw

Re: [PATCH v8 2/7] media: dt-binding: nuvoton: Add bindings for NPCM VCD and ECE engine

Hi Krzysztof,

Thanks for the review.

Quoted 4 lines
Quoted 2 lines

Add dt-binding document for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.

Subject: drop second, redundant "bindings for".

OK.

Quoted 6 lines

Review line 2

Quoted 4 lines

+++ b/Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml

(quoted diff) +2 -0
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+

Drop blank line.

OK.

Quoted 4 lines

Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml line 40

Quoted 1 line
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml new file +1 -0
+    ece: ece@f0820000 {

If this is video codec, then generic node name: "video-codec". "ece" is specific, not generic.

OK, will change to "ece: video-codec@f0820000".

Quoted 6 lines

Review line 2

Quoted 4 lines
(quoted diff) +3 -0
+++ b/Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+

Drop blank line.

OK.

Quoted 5 lines

Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml line 46

Quoted 3 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml new file +3 -0
+  memory-region:
+    description:
+      CMA pool to use for buffers allocation instead of the default CMA pool.

maxItems: 1

OK.

Regards,
Marvin

author
#5 lore raw

PATCH v8 3/7 dt-bindings: arm: nuvoton: Add bindings for NPCM GFXI

In reply to Marvin Lin

Add dt-bindings document for Graphics Core Information (GFXI) node. It is used by NPCM video driver to retrieve Graphics core information.

---
 .../bindings/arm/npcm/nuvoton,gfxi.yaml       | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml
Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml new file +40 -0
new file mode 100644
index 000000000000..7c8e5f99cc50
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/npcm/nuvoton,gfxi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Graphics Core Information block in Nuvoton SoCs
+
+maintainers:
+  - Joseph Liu <[email protected]>
+  - Marvin Lin <[email protected]>
+
+description:
+  The Graphics Core Information (GFXI) are a block of registers in Nuvoton SoCs
+  that analyzes Graphics core behavior and provides information in registers.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nuvoton,npcm750-gfxi
+          - nuvoton,npcm845-gfxi
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    gfxi: gfxi@e000 {
+      compatible = "nuvoton,npcm750-gfxi", "syscon";
+      reg = <0xe000 0x100>;
+    };
Signature · 1 line
2.34.1
author
#7 lore raw

Re: [PATCH v8 3/7] dt-bindings: arm: nuvoton: Add bindings for NPCM GFXI

Hi Krzysztof,

Krzysztof Kozlowski <[email protected]> 於 2022年12月15日 週四 下午4:58寫道:

Quoted 14 lines · Marvin Lin
Quoted 5 lines

Add dt-bindings document for Graphics Core Information (GFXI) node. It is used by NPCM video driver to retrieve Graphics core information.

---

Best regards,
Krzysztof

Thank you for your review!

Regards,
Marvin

author
#8 lore raw

PATCH v8 4/7 media: v4l: Add HEXTILE compressed format

In reply to Marvin Lin

Add HEXTILE compressed format which is defined in Remote Framebuffer Protocol (RFC 6143, chapter 7.7.4 Hextile Encoding) and is used by Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.

---
 Documentation/userspace-api/media/v4l/pixfmt-reserved.rst | 7 +++++++
 drivers/media/v4l2-core/v4l2-ioctl.c                      | 1 +
 include/uapi/linux/videodev2.h                            | 1 +
 3 files changed, 9 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-reserved.rst +7 -0
index 73cd99828010..e6ee0eebe691 100644
@@ -275,6 +275,13 @@ please make a proposal on the linux-media mailing list.
 
         Decoder's implementation can be found here,
         `aspeed_codec <https://github.com/AspeedTech-BMC/aspeed_codec/>`__
+    * .. _V4L2-PIX-FMT-HEXTILE:
+
+      - ``V4L2_PIX_FMT_HEXTILE``
+      - 'HXTL'
+      - Compressed format used by Nuvoton NPCM video driver. This format is
+        defined in Remote Framebuffer Protocol (RFC 6143, chapter 7.7.4 Hextile
+        Encoding).
 .. raw:: latex
 
     \normalsize
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
index 8e0a0ff62a70..a0e387335139 100644
@@ -1494,6 +1494,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 		case V4L2_PIX_FMT_QC08C:	descr = "QCOM Compressed 8-bit Format"; break;
 		case V4L2_PIX_FMT_QC10C:	descr = "QCOM Compressed 10-bit Format"; break;
 		case V4L2_PIX_FMT_AJPG:		descr = "Aspeed JPEG"; break;
+		case V4L2_PIX_FMT_HEXTILE:	descr = "Hextile Compressed Format"; break;
 		default:
 			if (fmt->description[0])
 				return;
include/uapi/linux/videodev2.h +1 -0
index 1befd181a4cc..1ce21cc4fbf1 100644
@@ -778,6 +778,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_QC08C    v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */
 #define V4L2_PIX_FMT_QC10C    v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */
 #define V4L2_PIX_FMT_AJPG     v4l2_fourcc('A', 'J', 'P', 'G') /* Aspeed JPEG */
+#define V4L2_PIX_FMT_HEXTILE  v4l2_fourcc('H', 'X', 'T', 'L') /* Hextile compressed */
 
 /* 10bit raw packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
 #define V4L2_PIX_FMT_IPU3_SBGGR10	v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
Signature · 1 line
2.34.1
author
#9 lore raw

PATCH v8 5/7 media: v4l2-ctrls: Reserve user control base for NPCM video controls

In reply to Marvin Lin

Add a control base and reserve 16 controls for Nuvoton NPCM video controls.

---
 include/uapi/linux/v4l2-controls.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/v4l2-controls.h +6 -0
index b73a8ba7df6c..aa5c9f64f1d6 100644
@@ -199,6 +199,12 @@ enum v4l2_colorfx {
  */
 #define V4L2_CID_USER_ASPEED_BASE		(V4L2_CID_USER_BASE + 0x11a0)
 
+/*
+ * The base for Nuvoton NPCM driver controls.
+ * We reserve 16 controls for this driver.
+ */
+#define V4L2_CID_USER_NPCM_BASE			(V4L2_CID_USER_BASE + 0x11b0)
+
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
  * and the 'MPEG' part of the define is historical */
Signature · 1 line
2.34.1
author
#10 lore raw

PATCH v8 6/7 media: uapi: Add controls for NPCM video driver

In reply to Marvin Lin

Create controls for Nuvoton NPCM video driver to support setting capture mode of Video Capture/Differentiation (VCD) engine and getting the count of HEXTILE rectangles that is compressed by Encoding Compression Engine (ECE).

---
 .../userspace-api/media/drivers/index.rst     |  1 +
 .../media/drivers/npcm-video.rst              | 67 +++++++++++++++++++
 include/uapi/linux/npcm-video.h               | 41 ++++++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 Documentation/userspace-api/media/drivers/npcm-video.rst
 create mode 100644 include/uapi/linux/npcm-video.h
Documentation/userspace-api/media/drivers/index.rst +1 -0
index 915dbf0f4db5..97d2ce8da6b3 100644
@@ -38,6 +38,7 @@ For more details see the file COPYING in the source distribution of Linux.
 	imx-uapi
 	max2175
 	meye-uapi
+	npcm-video
 	omap3isp-uapi
 	st-vgxy61
 	uvcvideo
Documentation/userspace-api/media/drivers/npcm-video.rst new file +67 -0

67 lines not on this page · raw message

include/uapi/linux/npcm-video.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#11 lore raw

PATCH v8 7/7 media: nuvoton: Add driver for NPCM video capture and encode engine

In reply to Marvin Lin

Add driver for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs. The VCD can capture and differentiate video data from digital or analog sources, then the ECE will compress the data into HEXTILE format. This driver implements V4L2 interfaces and provides user controls to support KVM feature, also tested with VNC Viewer and openbmc/obmc-ikvm.

---
 MAINTAINERS                                 |   12 +
 drivers/media/platform/Kconfig              |    1 +
 drivers/media/platform/Makefile             |    1 +
 drivers/media/platform/nuvoton/Kconfig      |   15 +
 drivers/media/platform/nuvoton/Makefile     |    2 +
 drivers/media/platform/nuvoton/npcm-regs.h  |  171 ++
 drivers/media/platform/nuvoton/npcm-video.c | 1924 +++++++++++++++++++
 7 files changed, 2126 insertions(+)
 create mode 100644 drivers/media/platform/nuvoton/Kconfig
 create mode 100644 drivers/media/platform/nuvoton/Makefile
 create mode 100644 drivers/media/platform/nuvoton/npcm-regs.h
 create mode 100644 drivers/media/platform/nuvoton/npcm-video.c
MAINTAINERS +12 -0
index 5a4526a171d6..d9f842ec141c 100644
@@ -2570,6 +2570,18 @@ F:	drivers/rtc/rtc-nct3018y.c
 F:	include/dt-bindings/clock/nuvoton,npcm7xx-clock.h
 F:	include/dt-bindings/clock/nuvoton,npcm845-clk.h
 
+ARM/NUVOTON NPCM VIDEO ENGINE DRIVER
+M:	Joseph Liu <[email protected]>
+M:	Marvin Lin <[email protected]>
+L:	[email protected]
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml
+F:	Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml
+F:	Documentation/userspace-api/media/drivers/npcm-video.rst
+F:	drivers/media/platform/nuvoton/
+F:	include/uapi/linux/npcm-video.h
+
 ARM/NUVOTON WPCM450 ARCHITECTURE
 M:	Jonathan Neuschäfer <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
drivers/media/platform/Kconfig +1 -0
index ee579916f874..91e54215de3a 100644
@@ -73,6 +73,7 @@ source "drivers/media/platform/intel/Kconfig"
 source "drivers/media/platform/marvell/Kconfig"
 source "drivers/media/platform/mediatek/Kconfig"
 source "drivers/media/platform/microchip/Kconfig"
+source "drivers/media/platform/nuvoton/Kconfig"
 source "drivers/media/platform/nvidia/Kconfig"
 source "drivers/media/platform/nxp/Kconfig"
 source "drivers/media/platform/qcom/Kconfig"
drivers/media/platform/Makefile +1 -0
index 5453bb868e67..3296ec1ebe16 100644
@@ -16,6 +16,7 @@ obj-y += intel/
 obj-y += marvell/
 obj-y += mediatek/
 obj-y += microchip/
+obj-y += nuvoton/
 obj-y += nvidia/
 obj-y += nxp/
 obj-y += qcom/
drivers/media/platform/nuvoton/Kconfig new file +15 -0
new file mode 100644
index 000000000000..5047d1ba3de5
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+comment "Nuvoton media platform drivers"
+
+config VIDEO_NPCM_VCD_ECE
+	tristate "Nuvoton NPCM Video Capture/Encode Engine driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV
+	select VIDEOBUF2_DMA_CONTIG
+	help
+	  Support for the Video Capture/Differentiation Engine (VCD) and
+	  Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.
+	  The VCD can capture and differentiate video data from digital or
+	  analog sources, then the ECE will compress the data into HEXTILE
+	  format.
drivers/media/platform/nuvoton/Makefile new file +2 -0
new file mode 100644
index 000000000000..74a4e3fc8555
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_VIDEO_NPCM_VCD_ECE) += npcm-video.o
drivers/media/platform/nuvoton/npcm-regs.h new file +171 -0

171 lines not on this page · raw message

drivers/media/platform/nuvoton/npcm-video.c new file +1924 -0

1,924 lines not on this page · raw message

Signature · 1 line
2.34.1