Support Nuvoton NPCM Video Capture/Encode Engine
Subsystems (4)
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 ECE will compress the data into HEXTILE format.
HEXTILE compressed format is defined in Remote Framebuffer Protocol (RFC 6143) and is used by VNC features, so we also add a patch to support it.
Marvin Lin (5):
arm: dts: Add node for NPCM Video Capture/Encode Engine
dt-bindings: media: Add dt-bindings for NPCM Video Capture/Encode
Engine
dt-bindings: arm/npcm: Add dt-bindings for Graphics Core Information
media: Add HEXTILE compressed format
drivers: media: platform: Add NPCM Video Capture/Encode Engine driver
.../bindings/arm/npcm/nuvoton,gfxi.yaml | 41 + .../bindings/media/nuvoton,npcm-video.yaml | 87 + MAINTAINERS | 1 + arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 19 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/nuvoton/Kconfig | 12 + drivers/media/platform/nuvoton/Makefile | 2 + drivers/media/platform/nuvoton/npcm-video.c | 2074 +++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 11 files changed, 2240 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml create mode 100644 drivers/media/platform/nuvoton/Kconfig create mode 100644 drivers/media/platform/nuvoton/Makefile create mode 100644 drivers/media/platform/nuvoton/npcm-video.c
Signature · 1 line
2.17.1
PATCH 1/5 arm: dts: Add node for NPCM Video Capture/Encode Engine
Add node for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.
--- arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi +19 -0
@@ -178,6 +178,19 @@ status = "disabled"; }; + video: video@f0810000 { + compatible = "nuvoton,npcm750-video"; + reg = <0xf0810000 0x10000>, <0xf0820000 0x2000>; + reg-names = "vcd", "ece"; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_VCD>, + <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>; + reset-names = "vcd", "ece"; + nuvoton,syscon-gcr = <&gcr>; + nuvoton,syscon-gfxi = <&gfxi>; + status = "disabled"; + }; + apb { #address-cells = <1>; #size-cells = <1>;
@@ -553,6 +566,12 @@ pinctrl-0 = <&smb15_pins>; status = "disabled"; }; + + gfxi: gfxi@e000 { + compatible = "nuvoton,npcm750-gfxi", "syscon", + "simple-mfd"; + reg = <0xe000 0x100>; + }; }; };
Signature · 1 line
2.17.1
PATCH 2/5 dt-bindings: media: Add dt-bindings for NPCM Video Capture/Encode Engine
In reply to Marvin LinAdd dt-bindings document for NPCM Video Capture/Encode Engine.
--- .../bindings/media/nuvoton,npcm-video.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml
Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml new file +87 -0
@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/nuvoton,npcm-video.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton NPCM Video Capture/Encode Engine Device Tree Bindings + +maintainers: + - Joseph Liu <[email protected]> + - Marvin Lin <[email protected]> + +description: | + Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine + (ECE) present on Nuvoton NPCM SoCs. + +properties: + compatible: + enum: + - nuvoton,npcm750-video + - nuvoton,npcm845-video + + reg: + items: + - description: VCD registers + - description: ECE registers + + reg-names: + items: + - const: vcd + - const: ece + + interrupts: + maxItems: 1 + + resets: + items: + - description: VCD reset control + - description: ECE reset control + + reset-names: + items: + - const: vcd + - const: ece + + nuvoton,syscon-gcr: + $ref: /schemas/types.yaml#definitions/phandle + description: Phandle to the Global Control Register DT node + + nuvoton,syscon-gfxi: + $ref: /schemas/types.yaml#definitions/phandle + description: Phandle to the Graphics Core Information DT node + + memory-region: + description: + CMA pool to use for buffers allocation instead of the default CMA pool. + +required: + - compatible + - reg + - reg-names + - interrupts + - resets + - reset-names + - nuvoton,syscon-gcr + - nuvoton,syscon-gfxi + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/reset/nuvoton,npcm7xx-reset.h> + + video: video@f0810000 { + compatible = "nuvoton,npcm750-video"; + reg = <0xf0810000 0x10000>, + <0xf0820000 0x2000>; + reg-names = "vcd", "ece"; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_VCD>, + <&rstc NPCM7XX_RESET_IPSRST2 NPCM7XX_RESET_ECE>; + reset-names = "vcd", "ece"; + nuvoton,syscon-gcr = <&gcr>; + nuvoton,syscon-gfxi = <&gfxi>; + };
Signature · 1 line
2.17.1
Re: [PATCH v1 2/5] dt-bindings: media: Add dt-bindings for NPCM Video Capture/Encode Engine
Hi,
since the WPCM450 also includes a VCD block, I'd be interested in reusing the same bindings and driver there.
Quoted 31 lines · Marvin Lin
Add dt-bindings document for NPCM Video Capture/Encode Engine.
Signed-off-by Marvin Lin <[email protected]>--- .../bindings/media/nuvoton,npcm-video.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/nuvoton,npcm-video.yamlDocumentation/devicetree/bindings/media/nuvoton,npcm-video.yaml new file +17
-0@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/nuvoton,npcm-video.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton NPCM Video Capture/Encode Engine Device Tree Bindings + +maintainers: + - Joseph Liu <[email protected]> + - Marvin Lin <[email protected]> + +description: | + Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine + (ECE) present on Nuvoton NPCM SoCs. +
Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml line 27
Quoted 10 lines
Documentation/devicetree/bindings/media/nuvoton,npcm-video.yaml new file +10
-0+properties: + compatible: + enum: + - nuvoton,npcm750-video + - nuvoton,npcm845-video + + reg: + items: + - description: VCD registers + - description: ECE registers
I'd somewhat prefer if these were actually two separate devicetree nodes, since there are two hardware blocks and two register ranges.
This would make reuse of the VCD binding easier on WPCM450, because it doesn't have an ECE block.
Best regards,
Jonathan
PATCH 3/5 dt-bindings: arm/npcm: Add dt-bindings for Graphics Core Information
In reply to Marvin LinAdd dt-bindings document for Graphics Core Information (GFXI) node. It is necessary for the NPCM Video Capture/Encode Engine driver to retrieve Graphics core information.
--- .../bindings/arm/npcm/nuvoton,gfxi.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml
Documentation/devicetree/bindings/arm/npcm/nuvoton,gfxi.yaml new file +41 -0
@@ -0,0 +1,41 @@ +# 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 inforomation in registers. + +properties: + compatible: + items: + - enum: + - nuvoton,npcm750-gfxi + - nuvoton,npcm845-gfxi + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + gfxi: gfxi@e000 { + compatible = "nuvoton,npcm750-gfxi", "syscon", "simple-mfd"; + reg = <0xe000 0x100>; + };
Signature · 1 line
2.17.1
PATCH 4/5 media: Add HEXTILE compressed format
In reply to Marvin LinAdd HEXTILE compressed format. This format is defined in Remote Framebuffer Protocol (RFC 6143) and is used by VNC features.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 2 files changed, 2 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1441,6 +1441,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_SE401 : descr ="GSPCA SE401" ;break ;case V4L2_PIX_FMT_S5C_UYVY_JPG : descr ="S5C73MX interleaved UYVY/JPEG" ;break ;case V4L2_PIX_FMT_MT21C : descr ="Mediatek Compressed Format" ;break ; +case V4L2_PIX_FMT_HEXTILE : descr ="Hextile Compressed Format" ;break ;default :if (fmt->description[0 ])return ;
include/uapi/linux/videodev2.h +1 -0
@@ -710,6 +710,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')/* Fast Walsh Hadamard Transform (vicodec) */ #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')/* Stateless FWHT (vicodec) */ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')/* H264 parsed slices */ +#define V4L2_PIX_FMT_HEXTILE v4l2_fourcc('H', 'X', 'T', 'L')/* Hextile */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')/* cpia1 YUV */
Signature · 1 line
2.17.1
Re: [PATCH v1 4/5] media: Add HEXTILE compressed format
Hello Marvin,
Le jeudi 12 mai 2022 à 15:27 +0800, Marvin Lin a écrit :
Quoted 26 lines
Add HEXTILE compressed format. This format is defined in Remote Framebuffer Protocol (RFC 6143) and is used by VNC features.
Signed-off-by Marvin Lin <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 2 files changed, 2 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1441,6 +1441,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_SE401 : descr ="GSPCA SE401" ;break ;case V4L2_PIX_FMT_S5C_UYVY_JPG : descr ="S5C73MX interleaved UYVY/JPEG" ;break ;case V4L2_PIX_FMT_MT21C : descr ="Mediatek Compressed Format" ;break ; +case V4L2_PIX_FMT_HEXTILE : descr ="Hextile Compressed Format" ;break ;default :if (fmt->description[0 ])return ;include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 713
Quoted 4 lines
include/uapi/linux/videodev2.h +1
-0@@ -710,6 +710,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')/* Fast Walsh Hadamard Transform (vicodec) */ #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')/* Stateless FWHT (vicodec) */ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')/* H264 parsed slices */ +#define V4L2_PIX_FMT_HEXTILE v4l2_fourcc('H', 'X', 'T', 'L')/* Hextile */
New formats also need to be documented in one of Documentation/userspace-api/media/v4l/pixfmt*.rst file. Consider that formats, specially vendor formats disappears over time, so documentation should be written as if you are to read that in 10+ years.
I'm also wondering if that should be better located with the "vendor" formats. Specially that this does not look like a open standard like the other in this section. A quick search of that format simply gives no results for me. It seems pretty clear that this is unique to this HW vendor and unlikely to grow withing other HW or even ever get a software implementation.
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')/* cpia1 YUV */
Re: [PATCH v1 4/5] media: Add HEXTILE compressed format
Hi Nicolas,
Thanks for your comment.
I have sent v2 patch to add Hextile document and locate with vendor formats.
Nicolas Dufresne <[email protected]> 於 2022年5月12日 週四 下午9:18寫道:
Quoted 66 lines
Hello Marvin,
Review
Quoted 10 lines · Marvin Lin
Add HEXTILE compressed format. This format is defined in Remote Framebuffer Protocol (RFC 6143) and is used by VNC features.
Signed-off-by Marvin Lin <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 2 files changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/media/v4l2-core/v4l2-ioctl.cdrivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
Quoted 4 lines
index
96e307fe3aab..9365519d65bb100644drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1441,6 +1441,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc*fmt)
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1441
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_SE401 : descr ="GSPCA SE401" ;break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1442
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MXinterleaved UYVY/JPEG"; break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1443
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_MT21C: descr = "MediatekCompressed Format"; break;
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc · line 1444
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+ case V4L2_PIX_FMT_HEXTILE: descr = "HextileCompressed Format"; break;
Review
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :if (fmt->description[0 ])return ;(quoted diff) +0
-0
b/include/uapi/linux/videodev2.hinclude/uapi/linux/videodev2.h struct v4l2_pix_format { · line 710
Quoted 5 lines
index
3768a0a80830..e0e69f71d700100644include/uapi/linux/videodev2.h +0
-0@@ -710,6 +710,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')/* Fast Walsh Hadamard Transform (vicodec) */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 711
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')/* Stateless FWHT (vicodec) */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 712
Quoted 1 line
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')/* H264 parsed slices */
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 713
Quoted 1 line
include/uapi/linux/videodev2.h +1
-0+#define V4L2_PIX_FMT_HEXTILE v4l2_fourcc('H', 'X', 'T', 'L')/* Hextile */
New formats also need to be documented in one of
Documentation/userspace-api/media/v4l/pixfmt*.rstfile. Consider that formats,
specially vendor formats disappears over time, so documentation should be written as if you are to read that in 10+ years.I'm also wondering if that should be better located with the "vendor" formats.
Specially that this does not look like a open standard like the other in this
section. A quick search of that format simply gives no results for me. It seems
pretty clear that this is unique to this HW vendor and unlikely to grow withing
other HW or even ever get a software implementation.include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 715
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')/* cpia1 YUV */
PATCH 5/5 drivers: media: platform: Add NPCM Video Capture/Encode Engine driver
In reply to Marvin LinAdd driver for Video Capture/Differentiation Engine (VCD) and Encoding Compression Engine (ECE) present on Nuvoton NPCM SoCs.
--- MAINTAINERS | 1 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/nuvoton/Kconfig | 12 + drivers/media/platform/nuvoton/Makefile | 2 + drivers/media/platform/nuvoton/npcm-video.c | 2074 +++++++++++++++++++ 6 files changed, 2091 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-video.c
MAINTAINERS +1 -0
@@ -2433,6 +2433,7 @@ F: arch/arm/boot/dts/nuvoton-npcm* F: arch/arm/mach-npcm/ F: drivers/*/*npcm* F: drivers/*/*/*npcm* +F: drivers/media/platform/nuvoton/ F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h ARM/NUVOTON WPCM450 ARCHITECTURE
drivers/media/platform/Kconfig +1 -0
@@ -72,6 +72,7 @@ source "drivers/media/platform/chips-media/Kconfig" source "drivers/media/platform/intel/Kconfig" source "drivers/media/platform/marvell/Kconfig" source "drivers/media/platform/mediatek/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
@@ -15,6 +15,7 @@ obj-y += chips-media/ obj-y += intel/ obj-y += marvell/ obj-y += mediatek/ +obj-y += nuvoton/ obj-y += nvidia/ obj-y += nxp/ obj-y += qcom/
drivers/media/platform/nuvoton/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only + +comment "Nuvoton media platform drivers" + +config VIDEO_NUVOTON + 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.
drivers/media/platform/nuvoton/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_VIDEO_NUVOTON) += npcm-video.o
drivers/media/platform/nuvoton/npcm-video.c new file +2074 -0
2,074 lines not on this page · raw message
Signature · 1 line
2.17.1