Skip to contentSkip to conversation

drm: nuvoton: Add MA35D1 display controller support

PATCH In review Joey Lu 3 participants 17 messages Jan 29 – Mar 8

Subsystems (5)
lore
Share & tools
lore

Joey Lu

author
#0 lore raw

v2 cover drm: nuvoton: Add MA35D1 display controller support

This is v2 of the Nuvoton MA35D1 DCU DRM driver series.

v2:
Driver changes:
- Drop custom CRTC and plane properties and switch to core-supported ones
- Switch to memory-safe DRM-managed allocation helpers
- Fix several minor logic
- Fix W=1 build failure on non-ARM architectures

Device tree / bindings:
- Fix dt_binding_check errors in the YAML schema
- Update DTS/DTSI files to follow proper hierarchy and port modeling

Thanks for the review.

Best regards,
Joey Lu

Joey Lu (3):
dt-bindings: display: nuvoton: add MA35D1 DCU binding
arm64: dts: nuvoton: ma35d1: add display controller support drm/nuvoton: add MA35D1 display controller driver

 .../bindings/display/nuvoton,ma35d1-dcu.yaml  |  73 +++
 .../boot/dts/nuvoton/ma35d1-som-256m.dts      |  56 ++
 arch/arm64/boot/dts/nuvoton/ma35d1.dtsi       |  14 +
 drivers/gpu/drm/Kconfig                       |   1 +
 drivers/gpu/drm/Makefile                      |   1 +
 drivers/gpu/drm/nuvoton/Kconfig               |  21 +
 drivers/gpu/drm/nuvoton/Makefile              |   7 +
 drivers/gpu/drm/nuvoton/ma35_crtc.c           | 372 +++++++++++
 drivers/gpu/drm/nuvoton/ma35_crtc.h           |  67 ++
 drivers/gpu/drm/nuvoton/ma35_drm.c            | 371 +++++++++++
 drivers/gpu/drm/nuvoton/ma35_drm.h            |  48 ++
 drivers/gpu/drm/nuvoton/ma35_interface.c      | 193 ++++++
 drivers/gpu/drm/nuvoton/ma35_interface.h      |  30 +
 drivers/gpu/drm/nuvoton/ma35_plane.c          | 603 ++++++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_plane.h          | 115 ++++
 drivers/gpu/drm/nuvoton/ma35_regs.h           |  88 +++
 16 files changed, 2060 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml
 create mode 100644 drivers/gpu/drm/nuvoton/Kconfig
 create mode 100644 drivers/gpu/drm/nuvoton/Makefile
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_crtc.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_crtc.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_drm.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_drm.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_interface.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_interface.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_plane.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_plane.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_regs.h
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/3 dt-bindings: display: nuvoton: add MA35D1 DCU binding

Add Device Tree binding documentation for the Display Control Unit (DCU) found in Nuvoton MA35D1 SoCs.

The DCU is a DPI-based display controller supporting RGB output with optional external bridges or panels.

---
 .../bindings/display/nuvoton,ma35d1-dcu.yaml  | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml
Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file +73 -0
new file mode 100644
index 000000000000..adfc20117eb7
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/nuvoton,ma35d1-dcu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton MA35D1 Display Controller Unit (DCU)
+
+maintainers:
+  - Joey Lu <[email protected]>
+
+description:
+  The Nuvoton MA35D1 Display Controller Unit (DCU) supports multiple
+  layers of composition, blending, and output to parallel RGB (DPI)
+  interfaces.
+
+properties:
+  compatible:
+    const: nuvoton,ma35d1-dcu
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: DCU Gate clock for register access
+      - description: DCU Pixel clock for display timing
+
+  clock-names:
+    items:
+      - const: dcu_gate
+      - const: dcup_div
+
+  resets:
+    maxItems: 1
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description: Video output port
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/nuvoton,ma35d1-clk.h>
+    #include <dt-bindings/reset/nuvoton,ma35d1-reset.h>
+
+    display@40260000 {
+        compatible = "nuvoton,ma35d1-dcu";
+        reg = <0x40260000 0x2000>;
+        interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk DCU_GATE>, <&clk DCUP_DIV>;
+        clock-names = "dcu_gate", "dcup_div";
+        resets = <&sys MA35D1_RESET_DISP>;
+
+        port {
+            dpi_out: endpoint {
+                remote-endpoint = <&panel_in>;
+            };
+        };
+    };
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: display: nuvoton: add MA35D1 DCU binding

Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml line 34

Quoted 9 lines · Joey Lu
Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file +9 -0
+
+  clocks:
+    items:
+      - description: DCU Gate clock for register access
+      - description: DCU Pixel clock for display timing
+
+  clock-names:
+    items:
+      - const: dcu_gate

That's bus or apb

Quoted 1 line

+ - const: dcup_div

That's pixel

Use descriptive names of functions here. Not your clock controller. It is completely irrelevant whether you provide here gate or div or mux or whatever else. If by any chance in new design you put here mux, not div, then completely new binding?

Best regards,
Krzysztof

author
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: display: nuvoton: add MA35D1 DCU binding

Quoted 15 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml line 34

Quoted 9 lines · Joey Lu
Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file +9 -0
+
+  clocks:
+    items:
+      - description: DCU Gate clock for register access
+      - description: DCU Pixel clock for display timing
+
+  clock-names:
+    items:
+      - const: dcu_gate

That's bus or apb

Quoted 1 line

+ - const: dcup_div

That's pixel

Quoted 8 lines

Use descriptive names of functions here. Not your clock controller. It is completely irrelevant whether you provide here gate or div or mux or whatever else. If by any chance in new design you put here mux, not div, then completely new binding?

Best regards,
Krzysztof

I'll use functional clock names bus & pixel instead.

Joey

author
#4 lore raw

PATCH v2 2/3 arm64: dts: nuvoton: ma35d1: add display controller support

In reply to Joey Lu

Enable the Display Control Unit (DCU) for the Nuvoton MA35D1 SoC.

This patch adds the DCU node to the SoC dtsi and enables it on the MA35D1 SOM board.

---
 .../boot/dts/nuvoton/ma35d1-som-256m.dts      | 56 +++++++++++++++++++
 arch/arm64/boot/dts/nuvoton/ma35d1.dtsi       | 14 +++++
 2 files changed, 70 insertions(+)
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +56 -0
index f6f20a17e501..e596bb452cc9 100644
@@ -98,6 +98,42 @@ pinctrl_uart16: uart16-pins {
 			power-source = <1>;
 		};
 	};
+
+	dcu {
+		pinctrl_display: display-pins {
+			nuvoton,pins =
+					   <6 8 6>,  /* VSYNC */
+					   <6 9 6>,  /* HSYNC */
+					   <6 10 6>, /* CLK */
+					   <10 4 6>, /* DE */
+					   <8 8 6>,  /* D0 - D23 */
+					   <8 9 6>,
+					   <8 10 6>,
+					   <8 11 6>,
+					   <8 12 6>,
+					   <8 13 6>,
+					   <8 14 6>,
+					   <8 15 6>,
+					   <7 0 6>,
+					   <7 1 6>,
+					   <7 2 6>,
+					   <7 3 6>,
+					   <7 4 6>,
+					   <7 5 6>,
+					   <7 6 6>,
+					   <7 7 6>,
+					   <2 12 6>,
+					   <2 13 6>,
+					   <2 14 6>,
+					   <2 15 6>,
+					   <7 12 6>,
+					   <7 13 6>,
+					   <7 14 6>,
+					   <7 15 6>;
+			bias-disable;
+			power-source = <1>;
+		};
+	};
 };
 
 &uart0 {
@@ -129,3 +165,23 @@ &uart16 {
 	pinctrl-0 = <&pinctrl_uart16>;
 	status = "okay";
 };
+
+&panel {
+	port {
+		panel_in: endpoint@0 {
+			remote-endpoint = <&dpi_out>;
+		};
+	};
+};
+
+&display {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_display>;
+	status = "okay";
+
+	port {
+		dpi_out: endpoint@0 {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +14 -0
index e51b98f5bdce..7d9d077f12b2 100644
@@ -379,5 +379,19 @@ uart16: serial@40880000 {
 			clocks = <&clk UART16_GATE>;
 			status = "disabled";
 		};
+
+		panel: panel {
+			compatible = "panel-dpi";
+		};
+
+		display: display@40260000 {
+			compatible = "nuvoton,ma35d1-dcu";
+			reg = <0x0 0x40260000 0x0 0x2000>;
+			interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk DCU_GATE>, <&clk DCUP_DIV>;
+			clock-names = "dcu_gate", "dcup_div";
+			resets = <&sys MA35D1_RESET_DISP>;
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH v2 2/3] arm64: dts: nuvoton: ma35d1: add display controller support

Quoted 5 lines · Joey Lu

&uart0 {

arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +0 -0
@@ -129,3 +165,23 @@ &uart16 {
 	pinctrl-0 = <&pinctrl_uart16>;
 	status = "okay";
 };

arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts &uart16 { · line 177

Quoted 10 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+
+&panel {
+	port {
+		panel_in: endpoint@0 {
+			remote-endpoint = <&dpi_out>;
+		};
+	};
+};
+
+&display {

What sort of ordering rule is followed in Nuvoton? Why is it different than DTS coding style? Why do you choose other style?

Quoted 15 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_display>;
+	status = "okay";
+
+	port {
+		dpi_out: endpoint@0 {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +0 -0
index e51b98f5bdce..7d9d077f12b2 100644

arch/arm64/boot/dts/nuvoton/ma35d1.dtsi uart16: serial@40880000 { · line 383

Quoted 5 lines
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +2 -0
@@ -379,5 +379,19 @@ uart16: serial@40880000 {
 			clocks = <&clk UART16_GATE>;
 			status = "disabled";
 		};
+
+		panel: panel {

No, there is no way your SoC has a panel.

Don't add fake stuff to your DTS.

Best regards,
Krzysztof

author
#6 lore raw

Re: [PATCH v2 2/3] arm64: dts: nuvoton: ma35d1: add display controller support

Quoted 41 lines · Krzysztof Kozlowski
Quoted 5 lines · Joey Lu
  &uart0 {
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +0 -0
@@ -129,3 +165,23 @@ &uart16 {
  	pinctrl-0 = <&pinctrl_uart16>;
  	status = "okay";
  };

arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts &uart16 { · line 177

Quoted 10 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+
+&panel {
+	port {
+		panel_in: endpoint@0 {
+			remote-endpoint = <&dpi_out>;
+		};
+	};
+};
+
+&display {

What sort of ordering rule is followed in Nuvoton? Why is it different than DTS coding style? Why do you choose other style?

Quoted 15 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_display>;
+	status = "okay";
+
+	port {
+		dpi_out: endpoint@0 {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +0 -0
index e51b98f5bdce..7d9d077f12b2 100644

arch/arm64/boot/dts/nuvoton/ma35d1.dtsi uart16: serial@40880000 { · line 383

Quoted 5 lines
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +2 -0
@@ -379,5 +379,19 @@ uart16: serial@40880000 {
  			clocks = <&clk UART16_GATE>;
  			status = "disabled";
  		};
+
+		panel: panel {

No, there is no way your SoC has a panel.

Quoted 4 lines

Don't add fake stuff to your DTS.

Best regards,
Krzysztof

I'll move panel nodes out of dtsi into board dts.

Joey

#7 lore raw

Re: [PATCH v2 2/3] arm64: dts: nuvoton: ma35d1: add display controller support

Quoted 43 lines · Joey Lu
Quoted 41 lines · Krzysztof Kozlowski
Quoted 5 lines · Joey Lu
  &uart0 {
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +0 -0
@@ -129,3 +165,23 @@ &uart16 {
  	pinctrl-0 = <&pinctrl_uart16>;
  	status = "okay";
  };

arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts &uart16 { · line 177

Quoted 10 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+
+&panel {
+	port {
+		panel_in: endpoint@0 {
+			remote-endpoint = <&dpi_out>;
+		};
+	};
+};
+
+&display {

What sort of ordering rule is followed in Nuvoton? Why is it different than DTS coding style? Why do you choose other style?

Quoted 15 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_display>;
+	status = "okay";
+
+	port {
+		dpi_out: endpoint@0 {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +0 -0
index e51b98f5bdce..7d9d077f12b2 100644

arch/arm64/boot/dts/nuvoton/ma35d1.dtsi uart16: serial@40880000 { · line 383

Quoted 5 lines
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +2 -0
@@ -379,5 +379,19 @@ uart16: serial@40880000 {
  			clocks = <&clk UART16_GATE>;
  			status = "disabled";
  		};
+
+		panel: panel {

No, there is no way your SoC has a panel.

Quoted 6 lines
Quoted 4 lines

Don't add fake stuff to your DTS.

Best regards,
Krzysztof

I'll move panel nodes out of dtsi into board dts.

You did not respond to several comments in total, it's fine, but if you just ignored them, then it would not be fine.

Best regards,
Krzysztof

author
#8 lore raw

Re: [PATCH v2 2/3] arm64: dts: nuvoton: ma35d1: add display controller support

Quoted 47 lines · Krzysztof Kozlowski
Quoted 46 lines · Joey Lu
Quoted 45 lines · Krzysztof Kozlowski
Quoted 5 lines · Joey Lu
   &uart0 {
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +0 -0
@@ -129,3 +165,23 @@ &uart16 {
   	pinctrl-0 = <&pinctrl_uart16>;
   	status = "okay";
   };

arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts &uart16 { · line 177

Quoted 10 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+
+&panel {
+	port {
+		panel_in: endpoint@0 {
+			remote-endpoint = <&dpi_out>;
+		};
+	};
+};
+
+&display {

What sort of ordering rule is followed in Nuvoton? Why is it different than DTS coding style? Why do you choose other style?

Quoted 15 lines
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +10 -0
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_display>;
+	status = "okay";
+
+	port {
+		dpi_out: endpoint@0 {
+			remote-endpoint = <&panel_in>;
+		};
+	};
+};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +0 -0
index e51b98f5bdce..7d9d077f12b2 100644

arch/arm64/boot/dts/nuvoton/ma35d1.dtsi uart16: serial@40880000 { · line 383

Quoted 5 lines
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +2 -0
@@ -379,5 +379,19 @@ uart16: serial@40880000 {
   			clocks = <&clk UART16_GATE>;
   			status = "disabled";
   		};
+
+		panel: panel {

No, there is no way your SoC has a panel.

Don't add fake stuff to your DTS.

Best regards,
Krzysztof

Quoted 7 lines
Quoted 1 line

I'll move panel nodes out of dtsi into board dts.

You did not respond to several comments in total, it's fine, but if you just ignored them, then it would not be fine.

Best regards,
Krzysztof

Thanks for the review. I've gone through all comments carefully.

Some points were addressed directly in the next revision,so I grouped a few replies together since the original code will no longer appear after the update.

I will also restructure the DTS so the panel is defined under the root node to follow the standard hierarchy and ordering conventions.

For remaining items that need discussion, I'll reply inline one by one.

Joey

author
#9 lore raw

PATCH v2 3/3 drm/nuvoton: add MA35D1 display controller driver

In reply to Joey Lu

Add DRM driver support for the Display Control Unit (DCU) found in Nuvoton MA35D1 SoCs.

---
 drivers/gpu/drm/Kconfig                  |   1 +
 drivers/gpu/drm/Makefile                 |   1 +
 drivers/gpu/drm/nuvoton/Kconfig          |  21 +
 drivers/gpu/drm/nuvoton/Makefile         |   7 +
 drivers/gpu/drm/nuvoton/ma35_crtc.c      | 372 ++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_crtc.h      |  67 +++
 drivers/gpu/drm/nuvoton/ma35_drm.c       | 371 ++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_drm.h       |  48 ++
 drivers/gpu/drm/nuvoton/ma35_interface.c | 193 ++++++++
 drivers/gpu/drm/nuvoton/ma35_interface.h |  30 ++
 drivers/gpu/drm/nuvoton/ma35_plane.c     | 603 +++++++++++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_plane.h     | 115 +++++
 drivers/gpu/drm/nuvoton/ma35_regs.h      |  88 ++++
 13 files changed, 1917 insertions(+)
 create mode 100644 drivers/gpu/drm/nuvoton/Kconfig
 create mode 100644 drivers/gpu/drm/nuvoton/Makefile
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_crtc.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_crtc.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_drm.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_drm.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_interface.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_interface.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_plane.c
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_plane.h
 create mode 100644 drivers/gpu/drm/nuvoton/ma35_regs.h
drivers/gpu/drm/Kconfig +1 -0
index a33b90251530..3645255bc458 100644
@@ -309,6 +309,7 @@ source "drivers/gpu/drm/msm/Kconfig"
 source "drivers/gpu/drm/mxsfb/Kconfig"
 source "drivers/gpu/drm/nouveau/Kconfig"
 source "drivers/gpu/drm/nova/Kconfig"
+source "drivers/gpu/drm/nuvoton/Kconfig"
 source "drivers/gpu/drm/omapdrm/Kconfig"
 source "drivers/gpu/drm/panel/Kconfig"
 source "drivers/gpu/drm/panfrost/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 0e1c668b46d2..4ded9547d7ff 100644
@@ -235,6 +235,7 @@ obj-y			+= solomon/
 obj-$(CONFIG_DRM_SPRD) += sprd/
 obj-$(CONFIG_DRM_LOONGSON) += loongson/
 obj-$(CONFIG_DRM_POWERVR) += imagination/
+obj-$(CONFIG_DRM_MA35) += nuvoton/
 
 # Ensure drm headers are self-contained and pass kernel-doc
 hdrtest-files := \
drivers/gpu/drm/nuvoton/Kconfig new file +21 -0
new file mode 100644
index 000000000000..6bb970b9890c
@@ -0,0 +1,21 @@
+config DRM_MA35
+	tristate "Nuvoton MA35D1 LCD Display Controller"
+	default ARCH_MA35
+	depends on DRM
+	depends on OF && (ARCH_MA35 || COMPILE_TEST)
+	select DRM_KMS_HELPER
+	select DRM_KMS_DMA_HELPER
+	select DRM_GEM_DMA_HELPER
+	select DRM_BRIDGE
+	select DRM_PANEL_BRIDGE
+	select VIDEOMODE_HELPERS
+	select REGMAP_MMIO
+	help
+	  Choose this option to enable support for the Display Controller Unit (DCU)
+	  found in Nuvoton MA35D1 SoCs.
+
+	  This driver supports the DRM/KMS API for the MA35 display subsystem,
+	  handling display output via hardware composition layers.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called ma35-drm.
\ No newline at end of file
drivers/gpu/drm/nuvoton/Makefile new file +7 -0
new file mode 100644
index 000000000000..aac4113106b2
@@ -0,0 +1,7 @@
+ma35-drm-y += \
+	ma35_drm.o \
+	ma35_plane.o \
+	ma35_crtc.o \
+	ma35_interface.o
+
+obj-$(CONFIG_DRM_MA35)	+= ma35-drm.o
drivers/gpu/drm/nuvoton/ma35_crtc.c new file +372 -0

372 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_crtc.h new file +67 -0

67 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_drm.c new file +371 -0

371 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_drm.h new file +48 -0

48 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_interface.c new file +193 -0

193 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_interface.h new file +30 -0
new file mode 100644
index 000000000000..db7ed41bee45
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_INTERFACE_H_
+#define _MA35_INTERFACE_H_
+
+#include <drm/drm_bridge.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_encoder.h>
+
+struct ma35_drm;
+
+struct ma35_interface {
+	struct drm_encoder drm_encoder;
+	struct drm_connector drm_connector;
+	struct drm_panel *drm_panel;
+	struct drm_bridge *drm_bridge;
+
+	u32 bus_flags;
+};
+
+int ma35_interface_init(struct ma35_drm *priv);
+
+#endif
drivers/gpu/drm/nuvoton/ma35_plane.c new file +603 -0

603 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_plane.h new file +115 -0

115 lines not on this page · raw message

drivers/gpu/drm/nuvoton/ma35_regs.h new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.43.0
#10 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 4 lines · Joey Lu

Add DRM driver support for the Display Control Unit (DCU) found in Nuvoton MA35D1 SoCs.

Quoted 14 lines
---
 drivers/gpu/drm/Kconfig                  |   1 +
 drivers/gpu/drm/Makefile                 |   1 +
 drivers/gpu/drm/nuvoton/Kconfig          |  21 +
 drivers/gpu/drm/nuvoton/Makefile         |   7 +
 drivers/gpu/drm/nuvoton/ma35_crtc.c      | 372 ++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_crtc.h      |  67 +++
 drivers/gpu/drm/nuvoton/ma35_drm.c       | 371 ++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_drm.h       |  48 ++
 drivers/gpu/drm/nuvoton/ma35_interface.c | 193 ++++++++
 drivers/gpu/drm/nuvoton/ma35_interface.h |  30 ++
 drivers/gpu/drm/nuvoton/ma35_plane.c     | 603 +++++++++++++++++++++++
 drivers/gpu/drm/nuvoton/ma35_plane.h     | 115 +++++
 drivers/gpu/drm/nuvoton/ma35_regs.h      |  88 ++++

No maintainers? Why would we want to take unmaintained code?

Quoted 6 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +6 -0
+static void ma35_mode_fini(struct ma35_drm *priv)
+{
+	struct drm_device *drm_dev = &priv->drm_dev;
+
+	drm_kms_helper_poll_fini(drm_dev);
+}

drivers/gpu/drm/nuvoton/ma35_drm.c line 149

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+
+static int ma35_clocks_prepare(struct ma35_drm *priv)
+{
+	struct drm_device *drm_dev = &priv->drm_dev;
+	struct device *dev = drm_dev->dev;
+	int ret;
+
+	priv->dcuclk = devm_clk_get(dev, "dcu_gate");
+	if (IS_ERR(priv->dcuclk)) {
+		dev_err(dev, "Failed to get display core clock\n");

Don't spam logs on defers. Syntax is in entire probe path: return dev_err_probe

drivers/gpu/drm/nuvoton/ma35_drm.c line 153

Quoted 4 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +4 -0
+		return PTR_ERR(priv->dcuclk);
+	}
+
+	ret = clk_prepare_enable(priv->dcuclk);

Why this cannot be devm_clk_get_enabled?

Quoted 24 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +24 -0
+	if (ret) {
+		dev_err(dev, "Failed to enable display core clock\n");
+		return ret;
+	}
+
+	priv->dcupclk = devm_clk_get(dev, "dcup_div");
+	if (IS_ERR(priv->dcupclk)) {
+		dev_err(dev, "Failed to get display pixel clock\n");
+		return PTR_ERR(priv->dcupclk);
+	}
+
+	ret = clk_prepare_enable(priv->dcupclk);
+	if (ret) {
+		dev_err(dev, "Failed to enable display pixel clock\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int ma35_clocks_unprepare(struct ma35_drm *priv)
+{
+	struct clk **clocks[] = {
+		&priv->dcuclk,

drivers/gpu/drm/nuvoton/ma35_drm.c line 187

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+		&priv->dcupclk,
+	};
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(clocks); i++) {
+		if (!*clocks[i])
+			continue;
+
+		clk_disable_unprepare(*clocks[i]);
+		*clocks[i] = NULL;

Huh, pretty complicated and pointless code. This should be devm and bulk API...

Quoted 14 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +14 -0
+	}
+
+	return 0;
+}
+
+static int ma35_drm_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct ma35_drm *priv;
+	struct drm_device *drm_dev;
+	void __iomem *base;
+	struct regmap *regmap = NULL;
+	int irq;
+	int ret;

drivers/gpu/drm/nuvoton/ma35_drm.c line 211

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+
+	ret = of_reserved_mem_device_init(dev);
+	if (ret && ret != -ENODEV) {
+		dev_err(dev, "Failed to get optional reserved memory: %d\n", ret);
+		return ret;
+	}
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		dev_err(dev, "Failed to map I/O base\n");

Why aren't you using dev_err_probe?

Quoted 21 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +21 -0
+		ret = PTR_ERR(base);
+		goto error_reserved_mem;
+	}
+	regmap = devm_regmap_init_mmio(dev, base, &ma35_drm_regmap_config);
+	if (IS_ERR(regmap)) {
+		dev_err(dev, "Failed to create regmap for I/O\n");
+		ret = PTR_ERR(regmap);
+		goto error_reserved_mem;
+	}
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		ret = -ENODEV;
+		goto error_reserved_mem;
+	}
+
+	priv = devm_drm_dev_alloc(dev, &ma35_drm_driver,
+				     struct ma35_drm, drm_dev);
+	if (IS_ERR(priv)) {
+		ret = PTR_ERR(priv);
+		goto error_reserved_mem;

drivers/gpu/drm/nuvoton/ma35_drm.c line 242

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+	}
+
+	platform_set_drvdata(pdev, priv);
+	drm_dev = &priv->drm_dev;
+	priv->regmap = regmap;
+	INIT_LIST_HEAD(&priv->layers_list);
+
+	ret = ma35_clocks_prepare(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to prepare clocks\n");

Why do you print error twice? Once in the function, second time here?

Quoted 39 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +39 -0
+		goto error_reserved_mem;
+	}
+
+	ret = devm_request_irq(dev, irq, ma35_drm_irq_handler, 0,
+			       dev_name(dev), priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to request IRQ\n");
+		goto error_clocks;
+	}
+
+	/* modeset */
+	ret = ma35_mode_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize KMS\n");
+		goto error_clocks;
+	}
+
+	/* plane */
+	ret = ma35_plane_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize layers\n");
+		goto error_clocks;
+	}
+
+	/* crtc */
+	ret = ma35_crtc_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize CRTC\n");
+		goto error_clocks;
+	}
+
+	/* interface */
+	ret = ma35_interface_init(priv);
+	if (ret) {
+		if (ret != -EPROBE_DEFER)
+			drm_err(drm_dev, "Failed to initialize interface\n");
+
+		goto error_clocks;
+	}

drivers/gpu/drm/nuvoton/ma35_drm.c line 291

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+
+	drm_mode_config_reset(drm_dev);
+
+	ret = drm_dev_register(drm_dev, 0);
+	if (ret) {
+		drm_err(drm_dev, "Failed to register DRM device\n");
+		goto error_mode;
+	}
+
+	drm_client_setup(drm_dev, NULL);

Best regards,
Krzysztof

author
#11 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 19 lines · Krzysztof Kozlowski
Quoted 4 lines · Joey Lu

Add DRM driver support for the Display Control Unit (DCU) found in Nuvoton MA35D1 SoCs.

Quoted 14 lines
---
  drivers/gpu/drm/Kconfig                  |   1 +
  drivers/gpu/drm/Makefile                 |   1 +
  drivers/gpu/drm/nuvoton/Kconfig          |  21 +
  drivers/gpu/drm/nuvoton/Makefile         |   7 +
  drivers/gpu/drm/nuvoton/ma35_crtc.c      | 372 ++++++++++++++
  drivers/gpu/drm/nuvoton/ma35_crtc.h      |  67 +++
  drivers/gpu/drm/nuvoton/ma35_drm.c       | 371 ++++++++++++++
  drivers/gpu/drm/nuvoton/ma35_drm.h       |  48 ++
  drivers/gpu/drm/nuvoton/ma35_interface.c | 193 ++++++++
  drivers/gpu/drm/nuvoton/ma35_interface.h |  30 ++
  drivers/gpu/drm/nuvoton/ma35_plane.c     | 603 +++++++++++++++++++++++
  drivers/gpu/drm/nuvoton/ma35_plane.h     | 115 +++++
  drivers/gpu/drm/nuvoton/ma35_regs.h      |  88 ++++
Quoted 1 line

No maintainers? Why would we want to take unmaintained code?

I'll add an entry in MAINTAINERS file.

Quoted 20 lines
Quoted 7 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +6 -0
+static void ma35_mode_fini(struct ma35_drm *priv)
+{
+	struct drm_device *drm_dev = &priv->drm_dev;
+
+	drm_kms_helper_poll_fini(drm_dev);
+}

drivers/gpu/drm/nuvoton/ma35_drm.c line 149

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+
+static int ma35_clocks_prepare(struct ma35_drm *priv)
+{
+	struct drm_device *drm_dev = &priv->drm_dev;
+	struct device *dev = drm_dev->dev;
+	int ret;
+
+	priv->dcuclk = devm_clk_get(dev, "dcu_gate");
+	if (IS_ERR(priv->dcuclk)) {
+		dev_err(dev, "Failed to get display core clock\n");

Don't spam logs on defers. Syntax is in entire probe path: return dev_err_probe

Quoted 5 lines

drivers/gpu/drm/nuvoton/ma35_drm.c line 153

Quoted 4 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +4 -0
+		return PTR_ERR(priv->dcuclk);
+	}
+
+	ret = clk_prepare_enable(priv->dcuclk);

Why this cannot be devm_clk_get_enabled?

I'll fix it.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +28 -0
+	if (ret) {
+		dev_err(dev, "Failed to enable display core clock\n");
+		return ret;
+	}
+
+	priv->dcupclk = devm_clk_get(dev, "dcup_div");
+	if (IS_ERR(priv->dcupclk)) {
+		dev_err(dev, "Failed to get display pixel clock\n");
+		return PTR_ERR(priv->dcupclk);
+	}
+
+	ret = clk_prepare_enable(priv->dcupclk);
+	if (ret) {
+		dev_err(dev, "Failed to enable display pixel clock\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int ma35_clocks_unprepare(struct ma35_drm *priv)
+{
+	struct clk **clocks[] = {
+		&priv->dcuclk,
+		&priv->dcupclk,
+	};
+	unsigned int i;
+
Quoted 8 lines

drivers/gpu/drm/nuvoton/ma35_drm.c line 187

Quoted 6 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +6 -0
+	for (i = 0; i < ARRAY_SIZE(clocks); i++) {
+		if (!*clocks[i])
+			continue;
+
+		clk_disable_unprepare(*clocks[i]);
+		*clocks[i] = NULL;

Huh, pretty complicated and pointless code. This should be devm and bulk API...

I'll use memory safe helpers instead.

Quoted 102 lines
Quoted 14 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +14 -0
+	}
+
+	return 0;
+}
+
+static int ma35_drm_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct ma35_drm *priv;
+	struct drm_device *drm_dev;
+	void __iomem *base;
+	struct regmap *regmap = NULL;
+	int irq;
+	int ret;

drivers/gpu/drm/nuvoton/ma35_drm.c line 211

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+
+	ret = of_reserved_mem_device_init(dev);
+	if (ret && ret != -ENODEV) {
+		dev_err(dev, "Failed to get optional reserved memory: %d\n", ret);
+		return ret;
+	}
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		dev_err(dev, "Failed to map I/O base\n");

Why aren't you using dev_err_probe?

Quoted 21 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +21 -0
+		ret = PTR_ERR(base);
+		goto error_reserved_mem;
+	}
+	regmap = devm_regmap_init_mmio(dev, base, &ma35_drm_regmap_config);
+	if (IS_ERR(regmap)) {
+		dev_err(dev, "Failed to create regmap for I/O\n");
+		ret = PTR_ERR(regmap);
+		goto error_reserved_mem;
+	}
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		ret = -ENODEV;
+		goto error_reserved_mem;
+	}
+
+	priv = devm_drm_dev_alloc(dev, &ma35_drm_driver,
+				     struct ma35_drm, drm_dev);
+	if (IS_ERR(priv)) {
+		ret = PTR_ERR(priv);
+		goto error_reserved_mem;

drivers/gpu/drm/nuvoton/ma35_drm.c line 242

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +10 -0
+	}
+
+	platform_set_drvdata(pdev, priv);
+	drm_dev = &priv->drm_dev;
+	priv->regmap = regmap;
+	INIT_LIST_HEAD(&priv->layers_list);
+
+	ret = ma35_clocks_prepare(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to prepare clocks\n");

Why do you print error twice? Once in the function, second time here?

Quoted 43 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +43 -0
+		goto error_reserved_mem;
+	}
+
+	ret = devm_request_irq(dev, irq, ma35_drm_irq_handler, 0,
+			       dev_name(dev), priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to request IRQ\n");
+		goto error_clocks;
+	}
+
+	/* modeset */
+	ret = ma35_mode_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize KMS\n");
+		goto error_clocks;
+	}
+
+	/* plane */
+	ret = ma35_plane_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize layers\n");
+		goto error_clocks;
+	}
+
+	/* crtc */
+	ret = ma35_crtc_init(priv);
+	if (ret) {
+		drm_err(drm_dev, "Failed to initialize CRTC\n");
+		goto error_clocks;
+	}
+
+	/* interface */
+	ret = ma35_interface_init(priv);
+	if (ret) {
+		if (ret != -EPROBE_DEFER)
+			drm_err(drm_dev, "Failed to initialize interface\n");
+
+		goto error_clocks;
+	}
+
+	drm_mode_config_reset(drm_dev);
+
+	ret = drm_dev_register(drm_dev, 0);
Quoted 8 lines

drivers/gpu/drm/nuvoton/ma35_drm.c line 291

Quoted 6 lines
drivers/gpu/drm/nuvoton/ma35_drm.c new file +6 -0
+	if (ret) {
+		drm_err(drm_dev, "Failed to register DRM device\n");
+		goto error_mode;
+	}
+
+	drm_client_setup(drm_dev, NULL);

Best regards,
Krzysztof

I'll  return raw error codes and let probe wrap them with dev_err_probe().

Thanks for the review.

Best regards,

Joey

#12 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

In reply to Joey Lu
Quoted 12 lines · 在 2026-01-29星期四的 12:05 +0800,Joey Lu写道:

========== 8< ============

(quoted diff) +1 -0
+#endif
drivers/gpu/drm/nuvoton/ma35_regs.h new file +3 -0
new file mode 100644
index 000000000000..0f4a7a13e7d8
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver

drivers/gpu/drm/nuvoton/ma35_regs.h line 13

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +10 -0
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_REGS_H_
+#define _MA35_REGS_H_
+
+#define MA35_FRAMEBUFFER_CONFIG                   0x1518

Please check my Verisilicon DC8200 driver, which is already part of drm-misc-next now.

The display controller here seems to be a earlier one from Verisilicon.it looks like a DC8000, or maybe a more earlier one?

Quoted 75 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +75 -0
+#define MA35_FRAMEBUFFER_ADDRESS                  0x1400
+#define MA35_FRAMEBUFFER_STRIDE                   0x1408
+#define MA35_HDISPLAY                             0x1430
+#define MA35_HSYNC                                0x1438
+#define MA35_VDISPLAY                             0x1440
+#define MA35_VSYNC                                0x1448
+#define MA35_PANEL_CONFIG                         0x1418
+#define MA35_DPI_CONFIG                           0x14B8
+#define MA35_CURSOR_ADDRESS                       0x146C
+#define MA35_CURSOR_CONFIG                        0x1468
+#define MA35_CURSOR_LOCATION                      0x1470
+#define MA35_CURSOR_BACKGROUND                    0x1474
+#define MA35_CURSOR_FOREGROUND                    0x1478
+#define MA35_FRAMEBUFFER_UPLANAR_ADDRESS          0x1530
+#define MA35_FRAMEBUFFER_VPLANAR_ADDRESS          0x1538
+#define MA35_FRAMEBUFFER_USTRIDE                  0x1800
+#define MA35_FRAMEBUFFER_VSTRIDE                  0x1808
+#define MA35_INDEXCOLOR_TABLEINDEX                0x1818
+#define MA35_INDEXCOLOR_TABLEDATA                 0x1820
+#define MA35_FRAMEBUFFER_SIZE                     0x1810
+#define MA35_FRAMEBUFFER_SCALEFACTORX             0x1828
+#define MA35_FRAMEBUFFER_SCALEFACTORY             0x1830
+#define MA35_FRAMEBUFFER_SCALEFCONFIG             0x1520
+#define MA35_HORIFILTER_KERNELINDEX               0x1838
+#define MA35_HORIFILTER_KERNEL                    0x1A00
+#define MA35_VERTIFILTER_KERNELINDEX              0x1A08
+#define MA35_VERTIFILTER_KERNEL                   0x1A10
+#define MA35_FRAMEBUFFER_INITIALOFFSET            0x1A20
+#define MA35_FRAMEBUFFER_COLORKEY                 0x1508
+#define MA35_FRAMEBUFFER_COLORHIGHKEY             0x1510
+#define MA35_FRAMEBUFFER_BGCOLOR                  0x1528
+#define MA35_FRAMEBUFFER_CLEARVALUE               0x1A18
+#define MA35_DISPLAY_INTRENABLE                   0x1480
+#define MA35_INT_STATE                            0x147C
+#define MA35_PANEL_DEST_ADDRESS                   0x14F0
+#define MA35_MEM_DEST_ADDRESS                     0x14E8
+#define MA35_DEST_CONFIG                          0x14F8
+#define MA35_DEST_STRIDE                          0x1500
+#define MA35_DBI_CONFIG                           0x1488
+#define MA35_AQHICLOCKCONTROL                     0x0000
+#define MA35_OVERLAY_CONFIG                       0x1540
+#define MA35_OVERLAY_STRIDE                       0x1600
+#define MA35_OVERLAY_USTRIDE                      0x18C0
+#define MA35_OVERLAY_VSTRIDE                      0x1900
+#define MA35_OVERLAY_TL                           0x1640
+#define MA35_OVERLAY_BR                           0x1680
+#define MA35_OVERLAY_ALPHA_BLEND_CONFIG           0x1580
+#define MA35_OVERLAY_SRC_GLOBAL_COLOR             0x16C0
+#define MA35_OVERLAY_DST_GLOBAL_COLOR             0x1700
+#define MA35_OVERLAY_CLEAR_VALUE                  0x1940
+#define MA35_OVERLAY_SIZE                         0x17C0
+#define MA35_OVERLAY_COLOR_KEY                    0x1740
+#define MA35_OVERLAY_COLOR_KEY_HIGH               0x1780
+#define MA35_OVERLAY_ADDRESS                      0x15C0
+#define MA35_OVERLAY_UPLANAR_ADDRESS              0x1840
+#define MA35_OVERLAY_VPLANAR_ADDRESS              0x1880
+#define MA35_OVERLAY_SCALE_CONFIG                 0x1C00
+#define MA35_OVERLAY_SCALE_FACTOR_X               0x1A40
+#define MA35_OVERLAY_SCALE_FACTOR_Y               0x1A80
+#define MA35_OVERLAY_HORI_FILTER_KERNEL_INDEX     0x1AC0
+#define MA35_OVERLAY_HORI_FILTER_KERNEL           0x1B00
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL_INDEX    0x1B40
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL          0x1B80
+#define MA35_OVERLAY_INITIAL_OFFSET               0x1BC0
+#define MA35_GAMMA_EX_INDEX                       0x1CF0
+#define MA35_GAMMA_EX_DATA                        0x1CF8
+#define MA35_GAMMA_EX_ONE_DATA                    0x1D80
+#define MA35_GAMMA_INDEX                          0x1458
+#define MA35_GAMMA_DATA                           0x1460
+#define MA35_DISPLAY_DITHER_TABLE_LOW             0x1420
+#define MA35_DISPLAY_DITHER_TABLE_HIGH            0x1428
+#define MA35_DISPLAY_DITHER_CONFIG                0x1410
+#define MA35_DISPLAY_CURRENT_LOCATION             0x1450
+
+#endif
author
#13 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 26 lines · Icenowy Zheng
Quoted 12 lines · 在 2026-01-29星期四的 12:05 +0800,Joey Lu写道:

========== 8< ============

(quoted diff) +1 -0
+#endif
drivers/gpu/drm/nuvoton/ma35_regs.h new file +3 -0
new file mode 100644
index 000000000000..0f4a7a13e7d8
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver

drivers/gpu/drm/nuvoton/ma35_regs.h line 13

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +10 -0
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_REGS_H_
+#define _MA35_REGS_H_
+
+#define MA35_FRAMEBUFFER_CONFIG                   0x1518

Please check my Verisilicon DC8200 driver, which is already part of drm-misc-next now.

Quoted 2 lines

The display controller here seems to be a earlier one from Verisilicon.it looks like a DC8000, or maybe a more earlier one?

The DCU is a Vivante DCUltra IP rather than a DC8000 series.

It's an earlier generation display controller and was customized for Nuvoton, so it doesn't have a public model ID.

Because of that lineage, parts of the register layout and functionality remain similar to older DC IPs.

Please refer to MA35D1 datasheet for more details.

Quoted 75 lines
Quoted 75 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +75 -0
+#define MA35_FRAMEBUFFER_ADDRESS                  0x1400
+#define MA35_FRAMEBUFFER_STRIDE                   0x1408
+#define MA35_HDISPLAY                             0x1430
+#define MA35_HSYNC                                0x1438
+#define MA35_VDISPLAY                             0x1440
+#define MA35_VSYNC                                0x1448
+#define MA35_PANEL_CONFIG                         0x1418
+#define MA35_DPI_CONFIG                           0x14B8
+#define MA35_CURSOR_ADDRESS                       0x146C
+#define MA35_CURSOR_CONFIG                        0x1468
+#define MA35_CURSOR_LOCATION                      0x1470
+#define MA35_CURSOR_BACKGROUND                    0x1474
+#define MA35_CURSOR_FOREGROUND                    0x1478
+#define MA35_FRAMEBUFFER_UPLANAR_ADDRESS          0x1530
+#define MA35_FRAMEBUFFER_VPLANAR_ADDRESS          0x1538
+#define MA35_FRAMEBUFFER_USTRIDE                  0x1800
+#define MA35_FRAMEBUFFER_VSTRIDE                  0x1808
+#define MA35_INDEXCOLOR_TABLEINDEX                0x1818
+#define MA35_INDEXCOLOR_TABLEDATA                 0x1820
+#define MA35_FRAMEBUFFER_SIZE                     0x1810
+#define MA35_FRAMEBUFFER_SCALEFACTORX             0x1828
+#define MA35_FRAMEBUFFER_SCALEFACTORY             0x1830
+#define MA35_FRAMEBUFFER_SCALEFCONFIG             0x1520
+#define MA35_HORIFILTER_KERNELINDEX               0x1838
+#define MA35_HORIFILTER_KERNEL                    0x1A00
+#define MA35_VERTIFILTER_KERNELINDEX              0x1A08
+#define MA35_VERTIFILTER_KERNEL                   0x1A10
+#define MA35_FRAMEBUFFER_INITIALOFFSET            0x1A20
+#define MA35_FRAMEBUFFER_COLORKEY                 0x1508
+#define MA35_FRAMEBUFFER_COLORHIGHKEY             0x1510
+#define MA35_FRAMEBUFFER_BGCOLOR                  0x1528
+#define MA35_FRAMEBUFFER_CLEARVALUE               0x1A18
+#define MA35_DISPLAY_INTRENABLE                   0x1480
+#define MA35_INT_STATE                            0x147C
+#define MA35_PANEL_DEST_ADDRESS                   0x14F0
+#define MA35_MEM_DEST_ADDRESS                     0x14E8
+#define MA35_DEST_CONFIG                          0x14F8
+#define MA35_DEST_STRIDE                          0x1500
+#define MA35_DBI_CONFIG                           0x1488
+#define MA35_AQHICLOCKCONTROL                     0x0000
+#define MA35_OVERLAY_CONFIG                       0x1540
+#define MA35_OVERLAY_STRIDE                       0x1600
+#define MA35_OVERLAY_USTRIDE                      0x18C0
+#define MA35_OVERLAY_VSTRIDE                      0x1900
+#define MA35_OVERLAY_TL                           0x1640
+#define MA35_OVERLAY_BR                           0x1680
+#define MA35_OVERLAY_ALPHA_BLEND_CONFIG           0x1580
+#define MA35_OVERLAY_SRC_GLOBAL_COLOR             0x16C0
+#define MA35_OVERLAY_DST_GLOBAL_COLOR             0x1700
+#define MA35_OVERLAY_CLEAR_VALUE                  0x1940
+#define MA35_OVERLAY_SIZE                         0x17C0
+#define MA35_OVERLAY_COLOR_KEY                    0x1740
+#define MA35_OVERLAY_COLOR_KEY_HIGH               0x1780
+#define MA35_OVERLAY_ADDRESS                      0x15C0
+#define MA35_OVERLAY_UPLANAR_ADDRESS              0x1840
+#define MA35_OVERLAY_VPLANAR_ADDRESS              0x1880
+#define MA35_OVERLAY_SCALE_CONFIG                 0x1C00
+#define MA35_OVERLAY_SCALE_FACTOR_X               0x1A40
+#define MA35_OVERLAY_SCALE_FACTOR_Y               0x1A80
+#define MA35_OVERLAY_HORI_FILTER_KERNEL_INDEX     0x1AC0
+#define MA35_OVERLAY_HORI_FILTER_KERNEL           0x1B00
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL_INDEX    0x1B40
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL          0x1B80
+#define MA35_OVERLAY_INITIAL_OFFSET               0x1BC0
+#define MA35_GAMMA_EX_INDEX                       0x1CF0
+#define MA35_GAMMA_EX_DATA                        0x1CF8
+#define MA35_GAMMA_EX_ONE_DATA                    0x1D80
+#define MA35_GAMMA_INDEX                          0x1458
+#define MA35_GAMMA_DATA                           0x1460
+#define MA35_DISPLAY_DITHER_TABLE_LOW             0x1420
+#define MA35_DISPLAY_DITHER_TABLE_HIGH            0x1428
+#define MA35_DISPLAY_DITHER_CONFIG                0x1410
+#define MA35_DISPLAY_CURRENT_LOCATION             0x1450
+
+#endif
#14 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 31 lines · 在 2026-02-09星期一的 16:45 +0800,Joey Lu写道:
Quoted 26 lines · Icenowy Zheng
Quoted 12 lines · 在 2026-01-29星期四的 12:05 +0800,Joey Lu写道:

========== 8< ============

(quoted diff) +1 -0
+#endif
drivers/gpu/drm/nuvoton/ma35_regs.h new file +3 -0
new file mode 100644
index 000000000000..0f4a7a13e7d8
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver

drivers/gpu/drm/nuvoton/ma35_regs.h line 13

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +10 -0
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_REGS_H_
+#define _MA35_REGS_H_
+
+#define MA35_FRAMEBUFFER_CONFIG                   0x1518

Please check my Verisilicon DC8200 driver, which is already part of drm-misc-next now.

Quoted 2 lines

The display controller here seems to be a earlier one from Verisilicon.it looks like a DC8000, or maybe a more earlier one?

Quoted 8 lines

The DCU is a Vivante DCUltra IP rather than a DC8000 series.

It's an earlier generation display controller and was customized for Nuvoton, so it doesn't have a public model ID.

Because of that lineage, parts of the register layout and functionality
remain similar to older DC IPs.

The kernel seems to dislike different drivers for similar IPs.

Quoted 2 lines

Please refer to MA35D1 datasheet for more details.

I checked it, and the register definitions looks compatible with DC8000 registers at [1]. However no identification information is shown in the manual.

I may get a MA35D1 board after the Lunar New Year (although it looks a little expensive), is it easy to bring up mainline kernal on arbitary MA35D1 boards?

[1]
https://github.com/milkv-megrez/rockos-u-boot/blob/c9221cf2fa77d39c0b241ab4b030c708e7ebe279/drivers/video/eswin/eswin_dc_reg.h

Quoted 76 lines
Quoted 76 lines
Quoted 76 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +75 -0
+#define MA35_FRAMEBUFFER_ADDRESS                  0x1400
+#define MA35_FRAMEBUFFER_STRIDE                   0x1408
+#define MA35_HDISPLAY                             0x1430
+#define MA35_HSYNC                                0x1438
+#define MA35_VDISPLAY                             0x1440
+#define MA35_VSYNC                                0x1448
+#define MA35_PANEL_CONFIG                         0x1418
+#define MA35_DPI_CONFIG                           0x14B8
+#define MA35_CURSOR_ADDRESS                       0x146C
+#define MA35_CURSOR_CONFIG                        0x1468
+#define MA35_CURSOR_LOCATION                      0x1470
+#define MA35_CURSOR_BACKGROUND                    0x1474
+#define MA35_CURSOR_FOREGROUND                    0x1478
+#define MA35_FRAMEBUFFER_UPLANAR_ADDRESS          0x1530
+#define MA35_FRAMEBUFFER_VPLANAR_ADDRESS          0x1538
+#define MA35_FRAMEBUFFER_USTRIDE                  0x1800
+#define MA35_FRAMEBUFFER_VSTRIDE                  0x1808
+#define MA35_INDEXCOLOR_TABLEINDEX                0x1818
+#define MA35_INDEXCOLOR_TABLEDATA                 0x1820
+#define MA35_FRAMEBUFFER_SIZE                     0x1810
+#define MA35_FRAMEBUFFER_SCALEFACTORX             0x1828
+#define MA35_FRAMEBUFFER_SCALEFACTORY             0x1830
+#define MA35_FRAMEBUFFER_SCALEFCONFIG             0x1520
+#define MA35_HORIFILTER_KERNELINDEX               0x1838
+#define MA35_HORIFILTER_KERNEL                    0x1A00
+#define MA35_VERTIFILTER_KERNELINDEX              0x1A08
+#define MA35_VERTIFILTER_KERNEL                   0x1A10
+#define MA35_FRAMEBUFFER_INITIALOFFSET            0x1A20
+#define MA35_FRAMEBUFFER_COLORKEY                 0x1508
+#define MA35_FRAMEBUFFER_COLORHIGHKEY             0x1510
+#define MA35_FRAMEBUFFER_BGCOLOR                  0x1528
+#define MA35_FRAMEBUFFER_CLEARVALUE               0x1A18
+#define MA35_DISPLAY_INTRENABLE                   0x1480
+#define MA35_INT_STATE                            0x147C
+#define MA35_PANEL_DEST_ADDRESS                   0x14F0
+#define MA35_MEM_DEST_ADDRESS                     0x14E8
+#define MA35_DEST_CONFIG                          0x14F8
+#define MA35_DEST_STRIDE                          0x1500
+#define MA35_DBI_CONFIG                           0x1488
+#define MA35_AQHICLOCKCONTROL                     0x0000
+#define MA35_OVERLAY_CONFIG                       0x1540
+#define MA35_OVERLAY_STRIDE                       0x1600
+#define MA35_OVERLAY_USTRIDE                      0x18C0
+#define MA35_OVERLAY_VSTRIDE                      0x1900
+#define MA35_OVERLAY_TL                           0x1640
+#define MA35_OVERLAY_BR                           0x1680
+#define MA35_OVERLAY_ALPHA_BLEND_CONFIG           0x1580
+#define MA35_OVERLAY_SRC_GLOBAL_COLOR             0x16C0
+#define MA35_OVERLAY_DST_GLOBAL_COLOR             0x1700
+#define MA35_OVERLAY_CLEAR_VALUE                  0x1940
+#define MA35_OVERLAY_SIZE                         0x17C0
+#define MA35_OVERLAY_COLOR_KEY                    0x1740
+#define MA35_OVERLAY_COLOR_KEY_HIGH               0x1780
+#define MA35_OVERLAY_ADDRESS                      0x15C0
+#define MA35_OVERLAY_UPLANAR_ADDRESS              0x1840
+#define MA35_OVERLAY_VPLANAR_ADDRESS              0x1880
+#define MA35_OVERLAY_SCALE_CONFIG                 0x1C00
+#define MA35_OVERLAY_SCALE_FACTOR_X               0x1A40
+#define MA35_OVERLAY_SCALE_FACTOR_Y               0x1A80
+#define MA35_OVERLAY_HORI_FILTER_KERNEL_INDEX     0x1AC0
+#define MA35_OVERLAY_HORI_FILTER_KERNEL           0x1B00
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL_INDEX    0x1B40
+#define MA35_OVERLAY_VERTI_FILTER_KERNEL          0x1B80
+#define MA35_OVERLAY_INITIAL_OFFSET               0x1BC0
+#define MA35_GAMMA_EX_INDEX                       0x1CF0
+#define MA35_GAMMA_EX_DATA                        0x1CF8
+#define MA35_GAMMA_EX_ONE_DATA                    0x1D80
+#define MA35_GAMMA_INDEX                          0x1458
+#define MA35_GAMMA_DATA                           0x1460
+#define MA35_DISPLAY_DITHER_TABLE_LOW             0x1420
+#define MA35_DISPLAY_DITHER_TABLE_HIGH            0x1428
+#define MA35_DISPLAY_DITHER_CONFIG                0x1410
+#define MA35_DISPLAY_CURRENT_LOCATION             0x1450
+
+#endif
author
#15 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 45 lines · Icenowy Zheng
Quoted 29 lines · 在 2026-02-09星期一的 16:45 +0800,Joey Lu写道:
Quoted 26 lines · Icenowy Zheng
Quoted 12 lines · 在 2026-01-29星期四的 12:05 +0800,Joey Lu写道:

========== 8< ============

(quoted diff) +1 -0
+#endif
drivers/gpu/drm/nuvoton/ma35_regs.h new file +3 -0
new file mode 100644
index 000000000000..0f4a7a13e7d8
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver

drivers/gpu/drm/nuvoton/ma35_regs.h line 13

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +10 -0
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_REGS_H_
+#define _MA35_REGS_H_
+
+#define MA35_FRAMEBUFFER_CONFIG                   0x1518

Please check my Verisilicon DC8200 driver, which is already part of drm-misc-next now.

Quoted 2 lines

The display controller here seems to be a earlier one from Verisilicon.it looks like a DC8000, or maybe a more earlier one?

Quoted 8 lines

The DCU is a Vivante DCUltra IP rather than a DC8000 series.

It's an earlier generation display controller and was customized for Nuvoton, so it doesn't have a public model ID.

Because of that lineage, parts of the register layout and functionality
remain similar to older DC IPs.

The kernel seems to dislike different drivers for similar IPs.

Quoted 1 line

Please refer to MA35D1 datasheet for more details.

I checked it, and the register definitions looks compatible with DC8000 registers at [1]. However no identification information is shown in the manual.

Quoted 6 lines

I may get a MA35D1 board after the Lunar New Year (although it looks a little expensive), is it easy to bring up mainline kernal on arbitary MA35D1 boards?

[1]
https://github.com/milkv-megrez/rockos-u-boot/blob/c9221cf2fa77d39c0b241ab4b030c708e7ebe279/drivers/video/eswin/eswin_dc_reg.h

Our team is actively working on upstreaming support for MA35D1. It is possible to bring up the mainline kernel on arbitrary MA35D1 boards, but for the best experience I strongly recommend using our Buildroot[1] or Yocto[2] tooling available on the official GitHub. These provide board-specific configurations and greatly simplify the process.

If you decide to get an MA35D1 board yourself, our Buildroot/Yocto setup will help you get started quickly and ensure you have the right patches and configurations in place.

Currently, the mainline kernel version is 6.6, which is sufficient for checking registers and basic functionality. For more complete feature support, our Buildroot/Yocto tooling remains the recommended path.

[1] https://github.com/OpenNuvoton/buildroot_2024

[2] https://github.com/OpenNuvoton/MA35D1_yocto-v5.0

Best regards,

Joey

#16 lore raw

Re: [PATCH v2 3/3] drm/nuvoton: add MA35D1 display controller driver

Quoted 43 lines · 在 2026-03-03二的 16:15 +0800,Joey Lu写道:
Quoted 41 lines · Icenowy Zheng
Quoted 40 lines · 在 2026-02-09星期一的 16:45 +0800,Joey Lu写道:
Quoted 27 lines · Icenowy Zheng
Quoted 12 lines · 在 2026-01-29星期四的 12:05 +0800,Joey Lu写道:

========== 8< ============

(quoted diff) +1 -0
+#endif
drivers/gpu/drm/nuvoton/ma35_regs.h new file +3 -0
new file mode 100644
index 000000000000..0f4a7a13e7d8
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Nuvoton DRM driver

drivers/gpu/drm/nuvoton/ma35_regs.h line 13

Quoted 10 lines
drivers/gpu/drm/nuvoton/ma35_regs.h new file +10 -0
+ *
+ * Copyright (C) 2026 Nuvoton Technology Corp.
+ *
+ * Author: Joey Lu <[email protected]>
+ */
+
+#ifndef _MA35_REGS_H_
+#define _MA35_REGS_H_
+
+#define MA35_FRAMEBUFFER_CONFIG                   0x1518

Please check my Verisilicon DC8200 driver, which is already part of
drm-misc-next now.

Quoted 3 lines

The display controller here seems to be a earlier one from Verisilicon.it looks like a DC8000, or maybe a more earlier one?

The DCU is a Vivante DCUltra IP rather than a DC8000 series.

It's an earlier generation display controller and was customized for
Nuvoton, so it doesn't have a public model ID.

Because of that lineage, parts of the register layout and functionality
remain similar to older DC IPs.

Quoted 8 lines
Quoted 8 lines

The kernel seems to dislike different drivers for similar IPs.

Quoted 1 line

Please refer to MA35D1 datasheet for more details.

I checked it, and the register definitions looks compatible with DC8000
registers at [1]. However no identification information is shown in the
manual.

I brought up my MYIR MYD-LMA35 (with its stock OS yet), and I got the following register value readings:

```
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x40260020
0x00000000 # chip id
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x40260024
0x00005560 # chip rev
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x40260028
0x20200807 # date code
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x40260030
0x00000305 # customer id
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x40260098
0x0000000C # patch rev
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x402600a4
0x00211110 # info
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x402600a8
0x02000002 # product id
root@myd-lma35-emmc:~# ./busybox-armv7l devmem 0x402600e8
0x00000000
```

Most of these values look okay, although the chip id register reads out 0x0 (although this is weird, this matches how this IP is called -- DCUltraLite, without any number).

Decoding 0xA4 with the the document from Eswin results:
- DC is included (of course ;-) )
- Single AXI
- AHB interface
- SingleGPU configuration
- AXI bus width 128bit

Decoding 0xA8 (which seems to be a more new and detailed IP name related register) results:
- Extra letter is "L-Lite" (well a little odd, because it should be "UL-UltraLite"?)
- Product number is 0
- Product type is DC

Looks like the only bad thing here is the IP's numerical name is 0, but matching revision 5560 customer 305 should be okay for this IP?

(BTW the revision number is between two recognized numbers in DC8000 driver from Eswin [1] (5551/5701), and the two numbers in DC8000 driver are strictly smaller than the two numbers in DC8200 driver from T-Head
[2] (5720/5721), indicates that it should be something similar to DC8000, which matches my previous thoughts; note that these two drivers both only match the 2 known numbers, so this IP is surely neither DC8000 nor DC8200)

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c
[2]
https://github.com/revyos/th1520-linux-kernel/blob/th1520-lts/drivers/gpu/drm/verisilicon/vs_dc_hw.c

Quoted 23 lines
Quoted 9 lines

I may get a MA35D1 board after the Lunar New Year (although it looks a
little expensive), is it easy to bring up mainline kernal on arbitary
MA35D1 boards?

[1]
https://github.com/milkv-megrez/rockos-u-boot/blob/c9221cf2fa77d39c0b241ab4b030c708e7ebe279/drivers/video/eswin/eswin_dc_reg.h

Our team is actively working on upstreaming support for MA35D1. It is possible to bring up the mainline kernel on arbitrary MA35D1 boards, but
for the best experience I strongly recommend using our Buildroot[1] or
Yocto[2] tooling available on the official GitHub. These provide board-specific configurations and greatly simplify the process.

If you decide to get an MA35D1 board yourself, our Buildroot/Yocto setup
will help you get started quickly and ensure you have the right patches
and configurations in place.

Quoted 4 lines

Currently, the mainline kernel version is 6.6, which is sufficient for
checking registers and basic functionality. For more complete feature support, our Buildroot/Yocto tooling remains the recommended path.

Ah I mean upstream kernel here. But it looks like it has at least decent support? (Well I think otherwise the display driver won't be sent to mailing list either)

Quoted 8 lines

[1] https://github.com/OpenNuvoton/buildroot_2024

[2] https://github.com/OpenNuvoton/MA35D1_yocto-v5.0

Best regards,

Joey