Skip to contentSkip to conversation

drm/verisilicon: add Nuvoton MA35D1 DCUltra Lite support

PATCH Superseded Joey Lu 6 participants 21 messages May 11 – May 18

Subsystems (5)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Joey Lu

author
#0 lore raw

cover drm/verisilicon: add Nuvoton MA35D1 DCUltra Lite support

This series adds support for the Verisilicon DCUltra Lite display controller as integrated in the Nuvoton MA35D1 SoC.

The Verisilicon DC driver and its DT binding were originally written by Icenowy Zheng <[email protected]> for the TH1520 SoC, which carries a DC8000 IP block. The present series builds on that foundation with gratitude to Icenowy for the original work.

The DCUltra Lite is a previous generation of the DC8000 series. While the two IPs share a broadly similar register layout, a number of differences prevent the existing driver from working on the MA35D1 without modification:

- No chip identity registers: the DCUltra Lite does not expose model/revision/customer_id hardware registers, so variant detection must come from platform data rather than register reads.

- No CONFIG_EX commit path: the DC8000 staging registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX) are absent; the DCUltra Lite uses enable and reset bits in FB_CONFIG (bit 0 / bit 4) for direct framebuffer updates.

- No PANEL_START register: panel output begins when PANEL_CONFIG.RUNNING is set; the DC8000 multi-display sync start register at 0x1CCC does not exist.

- Different IRQ registers: IRQ_STA at 0x147C / IRQ_EN at 0x1480,

    versus the DC8000's IRQ_ACK at 0x0010 / IRQ_EN at 0x0014.

- Simpler clock/reset topology: two clocks ("core" bus gate and "pix0" pixel divider), no driver-managed resets. The DC8000 requires core/axi/ahb clocks and three reset lines.

- Single display output: no per-output indexing is needed.

- Smaller register space: max_register 0x2000 vs. DC8000's 0x2544.

Patch 1 extends the verisilicon,dc DT binding to accommodate variants with flexible clock/reset counts and adds a new sub-schema for nuvoton,ma35d1-dcu.

Patch 2 introduces the vs_dc_info platform data structure, selects the correct code paths based on the detected IP family, extends Kconfig for ARCH_MA35, and wires up the "nuvoton,ma35d1-dcu" OF compatible string.

Both patches have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

Joey Lu (2):
dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite
variant
drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display
controller

 .../bindings/display/nuvoton,ma35d1-dcu.yaml  |  94 +++++++++++++
 .../bindings/display/verisilicon,dc.yaml      |  64 +++++----
 drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
 drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++--
 drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +-
 drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++------
 drivers/gpu/drm/verisilicon/vs_dc.h           |   1 +
 drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++-
 drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +-
 drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++
 .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++---
 .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +
 12 files changed, 318 insertions(+), 101 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/2 dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

Extend the verisilicon,dc base schema to accommodate the Nuvoton MA35D1 DCUltra Lite (a previous generation of the DC8000 series) which has a different clock topology, no reset control, and a single output.

- Replace the fixed clock/reset item lists with minItems/maxItems ranges so sub-schemas can enforce variant-specific constraints
- Add a 'port' property (single-port alias) alongside the existing 'ports' for single-output variants
- Remove the mandatory 'ports' requirement from the base schema; sub-schemas shall enforce their own port topology
- Add a 'select' stanza so the validator matches any node whose compatible contains a known Verisilicon DC string, including SoC-specific glue
- Relax additionalProperties to allow unevaluatedProperties enforcement in sub-schemas
- Fix a minor whitespace issue in the port@0 description

Add nuvoton,ma35d1-dcu.yaml as a sub-schema for the Nuvoton MA35D1 DCUltra Lite display controller:

The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display controller. It is a single-output display controller with a 32-bit RGB (DPI) interface. Unlike the DC8000, it does not have discoverable chip identity registers, does not support the CONFIG_EX commit path, and uses dedicated IRQ status/enable registers at offsets 0x147C/0x1480. The clock topology uses two clocks (bus gate and pixel divider) and does not require explicit reset control from the driver.

---
 .../bindings/display/nuvoton,ma35d1-dcu.yaml  | 94 +++++++++++++++++++
 .../bindings/display/verisilicon,dc.yaml      | 64 +++++++------
 2 files changed, 131 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml
Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file +94 -0
new file mode 100644
index 000000000000..9279004ae27c
@@ -0,0 +1,94 @@
+# 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 DCUltra Lite display controller
+
+maintainers:
+  - Joey Lu <[email protected]>
+
+description:
+  The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display
+  controller. It is a single-output display controller with a 32-bit
+  RGB (DPI) interface.
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - nuvoton,ma35d1-dcu
+  required:
+    - compatible
+
+allOf:
+  - $ref: http://devicetree.org/schemas/display/verisilicon,dc.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,ma35d1-dcu
+
+  reg:
+    maxItems: 1
+    description:
+      Register range of the DCUltra Lite controller. The address space
+      is 0x2000 bytes.
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus clock that gates register access (DCU_GATE)
+      - description: Pixel clock divider for display timing (DCUP_DIV)
+
+  clock-names:
+    items:
+      - const: core
+      - const: pix0
+
+  resets:
+    maxItems: 1
+    description:
+      Optional reset for the display controller. The driver does not
+      assert or deassert this reset; it may be used by firmware or
+      boot loaders to bring the hardware to a clean state.
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      Output port to the downstream display device (e.g. RGB panel).
+      The DCUltra Lite supports a single parallel RGB output.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port
+
+unevaluatedProperties: 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 = "core", "pix0";
+        resets = <&sys MA35D1_RESET_DISP>;
+
+        port {
+            dpi_out: endpoint {
+                remote-endpoint = <&panel_in>;
+            };
+        };
+    };
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +37 -27

100 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/2] dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

Quoted 27 lines · Joey Lu

Extend the verisilicon,dc base schema to accommodate the Nuvoton MA35D1 DCUltra Lite (a previous generation of the DC8000 series) which has a different clock topology, no reset control, and a single output.

- Replace the fixed clock/reset item lists with minItems/maxItems ranges so sub-schemas can enforce variant-specific constraints
- Add a 'port' property (single-port alias) alongside the existing 'ports' for single-output variants
- Remove the mandatory 'ports' requirement from the base schema; sub-schemas shall enforce their own port topology
- Add a 'select' stanza so the validator matches any node whose compatible contains a known Verisilicon DC string, including SoC-specific glue
- Relax additionalProperties to allow unevaluatedProperties enforcement in sub-schemas
- Fix a minor whitespace issue in the port@0 description

Add nuvoton,ma35d1-dcu.yaml as a sub-schema for the Nuvoton MA35D1 DCUltra Lite display controller:

The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display controller. It is a single-output display controller with a 32-bit RGB (DPI) interface. Unlike the DC8000, it does not have discoverable chip identity registers, does not support the CONFIG_EX commit path, and uses dedicated IRQ status/enable registers at offsets 0x147C/0x1480. The clock topology uses two clocks (bus gate and pixel divider) and does not require explicit reset control from the driver.

Quoted 7 lines
---
 .../bindings/display/nuvoton,ma35d1-dcu.yaml  | 94 +++++++++++++++++++
 .../bindings/display/verisilicon,dc.yaml      | 64 +++++++------
 2 files changed, 131 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml: allOf:0:$ref: 'http://devicetree.org/schemas/display/verisilicon,dc.yaml#' should not be valid under {'pattern': '^https?://'}
hint: References must start with '/schemas' or be relative to current schema's path.
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#3 lore raw

Re: [PATCH 1/2] dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

In reply to Joey Lu
Quoted 58 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

Extend the verisilicon,dc base schema to accommodate the Nuvoton MA35D1
DCUltra Lite (a previous generation of the DC8000 series) which has a different clock topology, no reset control, and a single output.

- Replace the fixed clock/reset item lists with minItems/maxItems ranges
  so sub-schemas can enforce variant-specific constraints
- Add a 'port' property (single-port alias) alongside the existing 'ports'
  for single-output variants
- Remove the mandatory 'ports' requirement from the base schema; sub- schemas
  shall enforce their own port topology
- Add a 'select' stanza so the validator matches any node whose compatible
  contains a known Verisilicon DC string, including SoC-specific glue
- Relax additionalProperties to allow unevaluatedProperties enforcement in
  sub-schemas
- Fix a minor whitespace issue in the port@0 description

Add nuvoton,ma35d1-dcu.yaml as a sub-schema for the Nuvoton MA35D1 DCUltra
Lite display controller:

The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display controller. It is a single-output display controller with a 32-bit RGB (DPI) interface. Unlike the DC8000, it does not have discoverable chip identity registers, does not support the CONFIG_EX commit path, and uses dedicated IRQ status/enable registers at offsets 0x147C/0x1480.
The clock topology uses two clocks (bus gate and pixel divider) and does not require explicit reset control from the driver.

---
 .../bindings/display/nuvoton,ma35d1-dcu.yaml  | 94
+++++++++++++++++++
 .../bindings/display/verisilicon,dc.yaml      | 64 +++++++------

 2 files changed, 131 insertions(+), 27 deletions(-)

 create mode 100644 Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml

diff --git a/Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml b/Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file mode 100644
index 000000000000..9279004ae27c

Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +0 -0

dcu.yaml

Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +5 -0
@@ -0,0 +1,94 @@
+# 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#

Documentation/devicetree/bindings/display/nuvoton,ma35d1- line 15

Quoted 10 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +10 -0
+
+title: Nuvoton MA35D1 DCUltra Lite display controller
+
+maintainers:
+  - Joey Lu <[email protected]>
+
+description:
+  The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display
+  controller. It is a single-output display controller with a 32-bit
+  RGB (DPI) interface.

You'd better write this in verisilicon,dc.yaml with if clauses. See Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml for an example for a generic IP with different integrations, and how it constraints different SoC's integration.

Quoted 21 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +21 -0
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - nuvoton,ma35d1-dcu
+  required:
+    - compatible
+
+allOf:
+  - $ref: http://devicetree.org/schemas/display/verisilicon,dc.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,ma35d1-dcu
+
+  reg:
+    maxItems: 1
+    description:
+      Register range of the DCUltra Lite controller. The address
Quoted 2 lines

space
+      is 0x2000 bytes.

Is it really 0x2000 bytes? The next peripherals in the address space, the GC520L 2D GPU, is 0x20000 bytes away from the start of DCU registers space.

Quoted 11 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +8 -0
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus clock that gates register access (DCU_GATE)
+      - description: Pixel clock divider for display timing

(DCUP_DIV)

Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +2 -0
+
+  clock-names:

Documentation/devicetree/bindings/display/nuvoton,ma35d1-

Quoted 10 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +10 -0
+    items:
+      - const: core
+      - const: pix0
+
+  resets:
+    maxItems: 1
+    description:
+      Optional reset for the display controller. The driver does not
+      assert or deassert this reset; it may be used by firmware or
+      boot loaders to bring the hardware to a clean state.

Why is there a reset in hardware but not toggled in the software?

Quoted 152 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +37 -0
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      Output port to the downstream display device (e.g. RGB panel).
+      The DCUltra Lite supports a single parallel RGB output.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port
+
+unevaluatedProperties: 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 = "core", "pix0";
+        resets = <&sys MA35D1_RESET_DISP>;
+
+        port {
+            dpi_out: endpoint {
+                remote-endpoint = <&panel_in>;
+            };
+        };
+    };

diff --git a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml index 9dc35ab973f2..00884529f8c1 100644

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -9,15 +9,34 @@ title: Verisilicon DC-series display controllers

 maintainers:
   - Icenowy Zheng <[email protected]>

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +4 -0
+description:
+  Verisilicon DC-series display controllers.
+
+# Select any node whose compatible contains one of the known

Verisilicon DC
+# or DC-derived compatible strings, including SoC-specific glue variants.

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +11 -0
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - verisilicon,dc
+          - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
+  required:
+    - compatible
+

 properties:
   $nodename:
     pattern: "^display@[0-9a-f]+$"

   compatible:
-    items:
-      - enum:
-          - thead,th1520-dc8200
-      - const: verisilicon,dc # DC IPs have discoverable ID/revision registers
+    # Enumerated in full so the schema validator can verify any compatible
+    # string against this list, including those from child schemas. +    contains:
+      enum:
+        - verisilicon,dc
+        - thead,th1520-dc8200
+        - nuvoton,ma35d1-dcu

   reg:
     maxItems: 1

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -26,32 +45,24 @@ properties:

     maxItems: 1

   clocks:
-    items:
-      - description: DC Core clock
-      - description: DMA AXI bus clock
-      - description: Configuration AHB bus clock -      - description: Pixel clock of output 0
-      - description: Pixel clock of output 1
+    minItems: 2
+    maxItems: 5

   clock-names:
-    items:
-      - const: core
-      - const: axi
-      - const: ahb
-      - const: pix0
-      - const: pix1
+    minItems: 2
+    maxItems: 5

   resets:
-    items:
-      - description: DC Core reset
-      - description: DMA AXI bus reset
-      - description: Configuration AHB bus reset +    minItems: 1
+    maxItems: 3

   reset-names:
-    items:
-      - const: core
-      - const: axi
-      - const: ahb
+    minItems: 1
+    maxItems: 3
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description: Single video output port for single-output variants.

   ports:
     $ref: /schemas/graph.yaml#/properties/ports

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -59,7 +70,7 @@ properties:

     properties:
       port@0:
         $ref: /schemas/graph.yaml#/properties/port
-        description: The first output channel , endpoint 0 should be +        description: The first output channel, endpoint 0 should be used for DPI format output and endpoint 1 should be used for DP format output.

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -75,9 +86,8 @@ required:

   - interrupts
   - clocks
   - clock-names
-  - ports

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +1 -1
-additionalProperties: false
+additionalProperties: true


 examples:
   - |

author
#4 lore raw

Re: [PATCH 1/2] dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

Quoted 65 lines · Icenowy Zheng
Quoted 64 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

Extend the verisilicon,dc base schema to accommodate the Nuvoton MA35D1
DCUltra Lite (a previous generation of the DC8000 series) which has a different clock topology, no reset control, and a single output.

- Replace the fixed clock/reset item lists with minItems/maxItems ranges
  so sub-schemas can enforce variant-specific constraints
- Add a 'port' property (single-port alias) alongside the existing 'ports'
  for single-output variants
- Remove the mandatory 'ports' requirement from the base schema; sub- schemas
  shall enforce their own port topology
- Add a 'select' stanza so the validator matches any node whose compatible
  contains a known Verisilicon DC string, including SoC-specific glue
- Relax additionalProperties to allow unevaluatedProperties enforcement in
  sub-schemas
- Fix a minor whitespace issue in the port@0 description

Add nuvoton,ma35d1-dcu.yaml as a sub-schema for the Nuvoton MA35D1 DCUltra
Lite display controller:

The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display controller. It is a single-output display controller with a 32-bit RGB (DPI) interface. Unlike the DC8000, it does not have discoverable chip identity registers, does not support the CONFIG_EX commit path, and uses dedicated IRQ status/enable registers at offsets 0x147C/0x1480.
The clock topology uses two clocks (bus gate and pixel divider) and does not require explicit reset control from the driver.

---
  .../bindings/display/nuvoton,ma35d1-dcu.yaml  | 94
+++++++++++++++++++
  .../bindings/display/verisilicon,dc.yaml      | 64 +++++++------
  2 files changed, 131 insertions(+), 27 deletions(-)

 create mode 100644
Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml

diff --git a/Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml b/Documentation/devicetree/bindings/display/nuvoton,ma35d1-dcu.yaml new file mode 100644
index 000000000000..9279004ae27c

Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +0 -0

dcu.yaml

Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +11 -0
@@ -0,0 +1,94 @@
+# 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 DCUltra Lite display controller
+
+maintainers:
+  - Joey Lu <[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/display/nuvoton,ma35d1- line 15

Quoted 4 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +4 -0
+description:
+  The Nuvoton MA35D1 integrates the Verisilicon DCUltra Lite display
+  controller. It is a single-output display controller with a 32-bit
+  RGB (DPI) interface.

You'd better write this in verisilicon,dc.yaml with if clauses. See Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml for an example for a generic IP with different integrations, and how it constraints different SoC's integration.

Understood. I'll drop both the separate nuvoton,ma35d1-dcu.yaml file and the nuvoton,ma35d1-dcu compatible string entirely. Since the chip identity registers are present on the DCUltra Lite (model=0x0, rev=0x5560, customer=0x305), the MA35D1 DT node will use compatible = "verisilicon,dc" directly. The YAML will use a single if/then/else block in allOf: keyed on whether thead,th1520-dc8200 is present in the compatible list: the then branch enforces DC8200 constraints (5 clocks, 3 resets, ports required), and the else branch enforces DCUltra Lite / generic constraints (2 clocks, 1 reset, port required, ports forbidden). The Nuvoton MA35D1 example will use compatible = "verisilicon,dc" and fall into the else branch.

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +18 -0
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - nuvoton,ma35d1-dcu
+  required:
+    - compatible
+
+allOf:
+  - $ref: http://devicetree.org/schemas/display/verisilicon,dc.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,ma35d1-dcu
+
+  reg:
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +3 -0
+    maxItems: 1
+    description:
+      Register range of the DCUltra Lite controller. The address

space
+      is 0x2000 bytes.

Is it really 0x2000 bytes? The next peripherals in the address space, the GC520L 2D GPU, is 0x20000 bytes away from the start of DCU registers space.

Good point. The 0x2000 figure is the driver's max_register, not the full hardware block size. I'll remove the description text claiming "0x2000 bytes" and update the example to use 0x20000 to match the actual hardware address space.

Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +8 -0
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus clock that gates register access (DCU_GATE)
+      - description: Pixel clock divider for display timing

(DCUP_DIV)
+
+  clock-names:
+    items:
+      - const: core
+      - const: pix0

Quoted 8 lines
Quoted 7 lines

+
+  resets:
+    maxItems: 1
+    description:
+      Optional reset for the display controller. The driver does not +      assert or deassert this reset; it may be used by firmware or +      boot loaders to bring the hardware to a clean state.

Why is there a reset in hardware but not toggled in the software?

The driver will handle the reset in v2. The probe path will call devm_reset_control_bulk_get_optional_shared() unconditionally with all three names ("core", "axi", "ahb"). Since the MA35D1 DT only provides a single reset named "core", the "axi" and "ahb" entries will be no-op handles — optional bulk reset lookup skips absent entries silently.

Quoted 152 lines
Quoted 152 lines
Documentation/devicetree/bindings/display/nuvoton,ma35d1- new file +37 -0
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      Output port to the downstream display device (e.g. RGB panel).
+      The DCUltra Lite supports a single parallel RGB output.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port
+
+unevaluatedProperties: 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 = "core", "pix0";
+        resets = <&sys MA35D1_RESET_DISP>;
+
+        port {
+            dpi_out: endpoint {
+                remote-endpoint = <&panel_in>;
+            };
+        };
+    };

diff --git a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml index 9dc35ab973f2..00884529f8c1 100644

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +4 -0
@@ -9,15 +9,34 @@ title: Verisilicon DC-series display controllers
  maintainers:
    - Icenowy Zheng <[email protected]>
 
+description:
+  Verisilicon DC-series display controllers.
+
+# Select any node whose compatible contains one of the known

Verisilicon DC
+# or DC-derived compatible strings, including SoC-specific glue variants.

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +11 -4
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - verisilicon,dc
+          - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
+  required:
+    - compatible
+
  properties:
    $nodename:
      pattern: "^display@[0-9a-f]+$"
 
    compatible:
-    items:
-      - enum:
-          - thead,th1520-dc8200
-      - const: verisilicon,dc # DC IPs have discoverable ID/revision

registers
+    # Enumerated in full so the schema validator can verify any compatible
+    # string against this list, including those from child schemas. +    contains:
+      enum:
+        - verisilicon,dc
+        - thead,th1520-dc8200
+        - nuvoton,ma35d1-dcu

   reg:
     maxItems: 1

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12 -20
@@ -26,32 +45,24 @@ properties:
      maxItems: 1
 
    clocks:
-    items:
-      - description: DC Core clock
-      - description: DMA AXI bus clock
-      - description: Configuration AHB bus clock
-      - description: Pixel clock of output 0
-      - description: Pixel clock of output 1
+    minItems: 2
+    maxItems: 5
 
    clock-names:
-    items:
-      - const: core
-      - const: axi
-      - const: ahb
-      - const: pix0
-      - const: pix1
+    minItems: 2
+    maxItems: 5
 
    resets:
-    items:
-      - description: DC Core reset
-      - description: DMA AXI bus reset
-      - description: Configuration AHB bus reset
+    minItems: 1
+    maxItems: 3
 
    reset-names:
-    items:
-      - const: core
-      - const: axi
-      - const: ahb
+    minItems: 1
+    maxItems: 3
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description: Single video output port for single-output

variants.

   ports:
     $ref: /schemas/graph.yaml#/properties/ports

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +2 -3
@@ -59,7 +70,7 @@ properties:
      properties:
        port@0:
          $ref: /schemas/graph.yaml#/properties/port
-        description: The first output channel , endpoint 0 should be
+        description: The first output channel, endpoint 0 should be
            used for DPI format output and endpoint 1 should be used
            for DP format output.
 
@@ -75,9 +86,8 @@ required:
    - interrupts
    - clocks
    - clock-names
-  - ports
 
-additionalProperties: false
+additionalProperties: true
 
  examples:
    - |
#5 lore raw

Re: [PATCH 1/2] dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

In reply to Joey Lu
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Relaxing base schema constraints without preserving them for existing hardware breaks validation…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Relaxing base schema constraints without preserving them for existing hardware breaks validation for thead,th1520-dc8200. --

commit 381b44c205709ac6503cee93b907e15828645951
Author: Joey Lu <[email protected]>

dt-bindings: display: verisilicon,dc: generalize for DCUltra Lite variant

Extend the verisilicon,dc base schema to accommodate the Nuvoton MA35D1 DCUltra Lite variant by relaxing several constraints including clocks, resets, ports, and additionalProperties. Add a dedicated sub-schema for the Nuvoton variant.

Quoted 4 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
index 9dc35ab973f20..00884529f8c1c 100644

[ ... ]

Quoted 31 lines

properties:

   $nodename:
     pattern: "^display@[0-9a-f]+$"
 
   compatible:
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +9 -10
-    items:
-      - enum:
-          - thead,th1520-dc8200
-      - const: verisilicon,dc # DC IPs have discoverable ID/revision registers
+    # Enumerated in full so the schema validator can verify any compatible
+    # string against this list, including those from child schemas.
+    contains:
+      enum:
+        - verisilicon,dc
+        - thead,th1520-dc8200
+        - nuvoton,ma35d1-dcu
 
   reg:
     maxItems: 1
@@ -26,32 +45,24 @@ properties:
     maxItems: 1
 
   clocks:
-    items:
-      - description: DC Core clock
-      - description: DMA AXI bus clock
-      - description: Configuration AHB bus clock
-      - description: Pixel clock of output 0
-      - description: Pixel clock of output 1
+    minItems: 2
+    maxItems: 5

[ ... ]

Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 90

Quoted 8 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +1 -2
@@ -75,9 +86,8 @@ required:
   - interrupts
   - clocks
   - clock-names
-  - ports
 
-additionalProperties: false
+additionalProperties: true

Does relaxing these constraints break schema validation for the existing thead,th1520-dc8200 hardware?

Since thead,th1520-dc8200 relies directly on this base schema and does not appear to have its own sub-schema, it seems malformed device tree nodes for this existing hardware could now silently pass validation.

For example, missing the verisilicon,dc fallback string, omitting the ports node, or containing undocumented properties would no longer be caught by the validator.

Should the legacy constraints for thead,th1520-dc8200 be preserved via an allOf if-then conditional block in this file, or by moving the existing hardware to its own dedicated sub-schema?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#6 lore raw

PATCH 2/2 drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

In reply to Joey Lu

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display controller, which is a previous generation of the DC8000 series. While the general register layout is similar to the DC8000, there are several key differences that require per-variant handling in the driver.

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe per-IP-variant capabilities, and use it throughout the driver to select the correct code paths at runtime.

Key differences between DC8000 and DCUltra Lite handled:

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static platform data instead of reading model/revision/customer_id from HW.

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT), 0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite omits all of these and instead uses enable/reset bits in FB_CONFIG (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts when PANEL_CONFIG.RUNNING is set; no separate multi-display sync start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

5. Different clock/reset topology: DCUltra Lite requires only "core" (bus gate) and "pix0" (pixel divider) clocks with no reset lines managed by the driver. DC8000 needs core/axi/ahb clocks and three resets.

6. Single output only: DCUltra Lite has one display output; per-output index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table, extend Kconfig to allow building on ARCH_MA35 platforms, and expose vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
 drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
 drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++--
 drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +-
 drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++------
 drivers/gpu/drm/verisilicon/vs_dc.h           |   1 +
 drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++-
 drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +-
 drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++
 .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++---
 .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +
 10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +1 -1
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@
 config DRM_VERISILICON_DC
 	tristate "DRM Support for Verisilicon DC-series display controllers"
 	depends on DRM && COMMON_CLK
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST
 	select DRM_BRIDGE_CONNECTOR
 	select DRM_CLIENT_SELECTION
 	select DRM_DISPLAY_HELPER
drivers/gpu/drm/verisilicon/vs_bridge.c +17 -11
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct vs_crtc *crtc,
 			VSDC_DISP_PANEL_CONFIG_CLK_EN);
 	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
 			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));
 
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(output));
+
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}
 }
 
 static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,
@@ -228,14 +231,17 @@ static void vs_bridge_atomic_disable(struct drm_bridge *bridge,
 	struct vs_dc *dc = crtc->dc;
 	unsigned int output = crtc->id;
 
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
-			  VSDC_DISP_PANEL_START_RUNNING(output));
 	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
 			  VSDC_DISP_PANEL_CONFIG_RUNNING);
 
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
+				  VSDC_DISP_PANEL_START_RUNNING(output));
+
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}
 }
 
 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {
drivers/gpu/drm/verisilicon/vs_crtc.c +11 -2
index 9080344398ca..2f3e6d41c657 100644
@@ -18,6 +18,7 @@
 #include "vs_dc.h"
 #include "vs_dc_top_regs.h"
 #include "vs_drm.h"
+#include "vs_hwdb.h"
 #include "vs_plane.h"
 
 static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -132,7 +133,11 @@ static int vs_crtc_enable_vblank(struct drm_crtc *crtc)
 	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN, VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, BIT(0));
+	else
+		regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				VSDC_TOP_IRQ_VSYNC(vcrtc->id));
 
 	return 0;
 }
@@ -142,7 +147,11 @@ static void vs_crtc_disable_vblank(struct drm_crtc *crtc)
 	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN, VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, 0);
+	else
+		regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				  VSDC_TOP_IRQ_VSYNC(vcrtc->id));
 }
 
 static const struct drm_crtc_funcs vs_crtc_funcs = {
drivers/gpu/drm/verisilicon/vs_dc.c +90 -39

209 lines not on this page · raw message

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
index ed1016f18758..f0613519af37 100644
@@ -31,6 +31,7 @@ struct vs_dc {
 	struct clk *pix_clk[VSDC_MAX_OUTPUTS];
 	struct reset_control_bulk_data rsts[VSDC_RESET_COUNT];
 
+	const struct vs_dc_info *info;
 	struct vs_drm_dev *drm_dev;
 	struct vs_chip_identity identity;
 };
drivers/gpu/drm/verisilicon/vs_drm.c +12 -4
index fd259d53f49f..ff0fc6673006 100644
@@ -27,6 +27,7 @@
 #include "vs_dc.h"
 #include "vs_dc_top_regs.h"
 #include "vs_drm.h"
+#include "vs_hwdb.h"
 
 #define DRIVER_NAME	"verisilicon"
 #define DRIVER_DESC	"Verisilicon DC-series display controller driver"
@@ -72,12 +73,19 @@ static struct drm_mode_config_helper_funcs vs_mode_config_helper_funcs = {
 	.atomic_commit_tail = drm_atomic_helper_commit_tail,
 };
 
-static void vs_mode_config_init(struct drm_device *drm)
+static void vs_mode_config_init(struct drm_device *drm, struct vs_dc *dc)
 {
 	drm->mode_config.min_width = 0;
 	drm->mode_config.min_height = 0;
-	drm->mode_config.max_width = 8192;
-	drm->mode_config.max_height = 8192;
+
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		drm->mode_config.max_width = 1920;
+		drm->mode_config.max_height = 1080;
+	} else {
+		drm->mode_config.max_width = 8192;
+		drm->mode_config.max_height = 8192;
+	}
+
 	drm->mode_config.funcs = &vs_mode_config_funcs;
 	drm->mode_config.helper_private = &vs_mode_config_helper_funcs;
 }
@@ -125,7 +133,7 @@ int vs_drm_initialize(struct vs_dc *dc, struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	vs_mode_config_init(drm);
+	vs_mode_config_init(drm, dc);
 
 	/* Enable connectors polling */
 	drm_kms_helper_poll_init(drm);
drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -1
index 09336af0900a..39402d75d841 100644
@@ -78,7 +78,7 @@ static const u32 vs_formats_array_with_yuv444[] = {
 	/* TODO: non-RGB formats */
 };
 
-static const struct vs_formats vs_formats_no_yuv444 = {
+const struct vs_formats vs_formats_no_yuv444 = {
 	.array = vs_formats_array_no_yuv444,
 	.num = ARRAY_SIZE(vs_formats_array_no_yuv444)
 };
drivers/gpu/drm/verisilicon/vs_hwdb.h +25 -0
index 92192e4fa086..655cf93ca3aa 100644
@@ -14,6 +14,29 @@ struct vs_formats {
 	unsigned int num;
 };
 
+enum vs_dc_family {
+	VS_DC_FAMILY_DC8000,
+	VS_DC_FAMILY_DCULTRA_LITE,
+};
+
+/**
+ * struct vs_dc_info - per-SoC DC platform data
+ * @family:		DC IP family (DC8000, DCUltra Lite, etc.)
+ * @display_count:	number of display outputs (0 = auto-detect from DT/HW)
+ * @has_chip_id:	whether chip identity registers exist
+ * @has_config_ex:	whether CONFIG_EX commit mechanism exists
+ * @regmap_cfg:		regmap configuration for this variant
+ * @formats:		supported pixel formats (NULL = auto-detect from chip ID)
+ */
+struct vs_dc_info {
+	enum vs_dc_family family;
+	u32 display_count;
+	bool has_chip_id;
+	bool has_config_ex;
+	const struct regmap_config *regmap_cfg;
+	const struct vs_formats *formats;
+};
+
 struct vs_chip_identity {
 	u32 model;
 	u32 revision;
@@ -23,6 +46,8 @@ struct vs_chip_identity {
 	const struct vs_formats *formats;
 };
 
+extern const struct vs_formats vs_formats_no_yuv444;
+
 int vs_fill_chip_identity(struct regmap *regs,
 			  struct vs_chip_identity *ident);
 
drivers/gpu/drm/verisilicon/vs_primary_plane.c +27 -16

76 lines not on this page · raw message

drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +2 -0
index cbb125c46b39..288064760b48 100644
@@ -16,6 +16,8 @@
 #define VSDC_FB_STRIDE(n)			(0x1408 + 0x4 * (n))
 
 #define VSDC_FB_CONFIG(n)			(0x1518 + 0x4 * (n))
+#define VSDC_FB_CONFIG_ENABLE			BIT(0)
+#define VSDC_FB_CONFIG_RESET			BIT(4)
 #define VSDC_FB_CONFIG_CLEAR_EN			BIT(8)
 #define VSDC_FB_CONFIG_ROT_MASK			GENMASK(13, 11)
 #define VSDC_FB_CONFIG_ROT(v)			((v) << 11)
Signature · 1 line
2.43.0
maintainer
#7 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 7 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display controller, which is a previous generation of the DC8000 series. While
the general register layout is similar to the DC8000, there are several
key differences that require per-variant handling in the driver.

Quoted 6 lines

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe per-IP-variant capabilities, and use it throughout the driver to select
the correct code paths at runtime.

Key differences between DC8000 and DCUltra Lite handled:

What the driver supports now is DC8200, DC8000 have the following point 1~4 the same with DCUltraLite (different to DC8200).

Quoted 5 lines

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static
   platform data instead of reading model/revision/customer_id from HW.

My test shows that revision and customer_id is correctly present, only model is 0 -- I think this can be also considered as a valid model value because the IP name has also no model number.

The revision number is 0x5560 and customer id is 0x305 .

Quoted 11 lines

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT), 0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite omits all of these and instead uses enable/reset bits in FB_CONFIG (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts when PANEL_CONFIG.RUNNING is set; no separate multi-display sync start register is needed.

Quoted 7 lines

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

5. Different clock/reset topology: DCUltra Lite requires only "core" (bus gate) and "pix0" (pixel divider) clocks with no reset lines managed by the driver. DC8000 needs core/axi/ahb clocks and three resets.

It's possible that your SoC integration combines core clock gate with bus clock gate instead of bus clock gate not existing.

Quoted 73 lines

6. Single output only: DCUltra Lite has one display output; per- output
   index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table, extend Kconfig to allow building on ARCH_MA35 platforms, and expose vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
 drivers/gpu/drm/verisilicon/Kconfig           |   2 +- drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++-- drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +- drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++---- --
 drivers/gpu/drm/verisilicon/vs_dc.h           |   1 + drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++- drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +- drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++ .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++--- .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +

 10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +0 -0
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@

 config DRM_VERISILICON_DC
  tristate "DRM Support for Verisilicon DC-series display controllers"
  depends on DRM && COMMON_CLK

drivers/gpu/drm/verisilicon/Kconfig +1 -1
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST

  select DRM_BRIDGE_CONNECTOR
  select DRM_CLIENT_SELECTION
  select DRM_DISPLAY_HELPER

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -4
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,
  			VSDC_DISP_PANEL_CONFIG_CLK_EN);
  	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
  			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc-
Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +3 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				 

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(output

));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c

Quoted 1 line
drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);

Should the commit operation happen on DC8000/DCUltraLite too? (By writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in the DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 12 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+	}

 }

 static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
@@ -228,14 +231,17 @@ static void vs_bridge_atomic_disable(struct
 drm_bridge *bridge,
  	struct vs_dc *dc = crtc->dc;
  	unsigned int output = crtc->id;

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -3
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
-			  VSDC_DISP_PANEL_START_RUNNING(output));
Quoted 2 lines

  regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output), VSDC_DISP_PANEL_CONFIG_RUNNING);

This bit seems to be not present in DCUltraLite, instead should DcregFrameBufferConfig0.RESET be clear, which will stall the DPI timing?

Quoted 13 lines

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc-
Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +3 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				 

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				 

VSDC_DISP_PANEL_START_RUNNING(output));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}

Ditto.

Quoted 23 lines

 }

 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -0
index 9080344398ca..2f3e6d41c657 100644
@@ -18,6 +18,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"
  #include "vs_plane.h"


 static void vs_crtc_atomic_disable(struct drm_crtc *crtc,

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -132,7 +133,11 @@ static int vs_crtc_enable_vblank(struct drm_crtc
 *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -1
-	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,

VSDC_TOP_IRQ_VSYNC(vcrtc->id));

drivers/gpu/drm/verisilicon/vs_crtc.c static int vs_crtc_enable_vblank(struct drm_crtc *crtc) · line 137

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +2 -0
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, BIT(0));

Should BIT(0) be assigned with a named macro here, like VSDC_DISP_IRQ_VSYNC(0) ?

In addition, even it's known that DC8000/DCUltraLite has only one output, hardcoding 0 here isn't so good. The header file at [1] (which is for DC8000) shows that two display interrupts and more other interrupts are present.

BTW I don't like the idea of setting a "family" (because DC8000 behave nearly the same with DCUltraLite), maybe use .irq_reg = VSDC_DISP_IRQ (or a bool variable named uses_top_irq) is better?

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

Quoted 36 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -0
+	else
+		regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				VSDC_TOP_IRQ_VSYNC(vcrtc->id));


  return 0;
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -142,7 +147,11 @@ static void vs_crtc_disable_vblank(struct
 drm_crtc *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -1
-	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,

VSDC_TOP_IRQ_VSYNC(vcrtc->id));

drivers/gpu/drm/verisilicon/vs_crtc.c +5 -0
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, 0);
+	else
+		regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				  VSDC_TOP_IRQ_VSYNC(vcrtc->id));

 }

 static const struct drm_crtc_funcs vs_crtc_funcs = {

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index dad9967bc10b..82a6a26f6d81 100644
@@ -9,21 +9,45 @@
  #include <linux/of_graph.h>


 #include "vs_crtc.h"
+#include "vs_crtc_regs.h"
 #include "vs_dc.h"
 #include "vs_dc_top_regs.h"
 #include "vs_drm.h"
 #include "vs_hwdb.h"

drivers/gpu/drm/verisilicon/vs_dc.c line 18

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-static const struct regmap_config vs_dc_regmap_cfg = {
+static const struct regmap_config vs_dc8000_regmap_cfg = {

As what I said, the currently supported thing is DC8200, not DC8000.

Quoted 31 lines

  .reg_bits = 32,
  .val_bits = 32,
  .reg_stride = sizeof(u32),

drivers/gpu/drm/verisilicon/vs_dc.c +0 -1
-	/* VSDC_OVL_CONFIG_EX(1) */

  .max_register = 0x2544,
 };

drivers/gpu/drm/verisilicon/vs_dc.c +23 -0
+static const struct regmap_config vs_dcultra_lite_regmap_cfg = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = sizeof(u32),
+	.max_register = 0x2000,
+};
+
+static const struct vs_dc_info vs_dc8000_info = {
+	.family = VS_DC_FAMILY_DC8000,
+	.has_chip_id = true,
+	.has_config_ex = true,
+	.regmap_cfg = &vs_dc8000_regmap_cfg,
+};
+
+static const struct vs_dc_info vs_dcultra_lite_info = {
+	.family = VS_DC_FAMILY_DCULTRA_LITE,
+	.display_count = 1,
+	.has_chip_id = false,
+	.has_config_ex = false,
+	.regmap_cfg = &vs_dcultra_lite_regmap_cfg,
+	.formats = &vs_formats_no_yuv444,
+};
+

 static const struct of_device_id vs_dc_driver_dt_match[] = {

drivers/gpu/drm/verisilicon/vs_dc.c line 49

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	{ .compatible = "verisilicon,dc" },
+	{ .compatible = "verisilicon,dc", .data = &vs_dc8000_info },

"verisilicon,dc" is expected for DC8000 and 8200, and because of model, rev and customer_id values are all present for DCUltraLite, the special data might be dropped?

drivers/gpu/drm/verisilicon/vs_dc.c static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 61

Quoted 12 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
+	{ .compatible = "nuvoton,ma35d1-dcu", .data =

&vs_dcultra_lite_info },
  {},
 };
 MODULE_DEVICE_TABLE(of, vs_dc_driver_dt_match);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -33,6 +57,13 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  	struct vs_dc *dc = private;
  	u32 irqs;

drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);

Maybe add an item in the hwdb for the IRQ register?

drivers/gpu/drm/verisilicon/vs_dc.c static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 64

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+		if (irqs & BIT(0))
+			vs_drm_handle_irq(dc,

VSDC_TOP_IRQ_VSYNC(0));

drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
+		return IRQ_HANDLED;

Now I think for DC8200, the irq number decoding should be done here too.

Quoted 56 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	}
+

  regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
  vs_drm_handle_irq(dc, irqs);

drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
@@ -43,6 +74,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  static int vs_dc_probe(struct platform_device *pdev)
  {
  	struct device *dev = &pdev->dev;
+	const struct vs_dc_info *info;
  	struct vs_dc *dc;
  	void __iomem *regs;

  unsigned int port_count, i;

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -55,6 +87,10 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return -ENODEV;
  	}

drivers/gpu/drm/verisilicon/vs_dc.c +4 -0
+	info = of_device_get_match_data(dev);
+	if (!info)
+		return -ENODEV;
+

  port_count = of_graph_get_port_count(dev->of_node); if (!port_count) {
  dev_err(dev, "can't find DC downstream ports\n");

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -75,15 +111,31 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	if (!dc)
  		return -ENOMEM;

drivers/gpu/drm/verisilicon/vs_dc.c +1 -3
-	dc->rsts[0].id = "core";
-	dc->rsts[1].id = "axi";
-	dc->rsts[2].id = "ahb";
+	dc->info = info;

drivers/gpu/drm/verisilicon/vs_dc.c +0 -1
-	ret = devm_reset_control_bulk_get_optional_shared(dev,

VSDC_RESET_COUNT,

drivers/gpu/drm/verisilicon/vs_dc.c +6 -4
-							  dc->rsts);
-	if (ret) {
-		dev_err(dev, "can't get reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		dc->rsts[0].id = "core";
+		dc->rsts[1].id = "axi";
+		dc->rsts[2].id = "ahb";
+
+		ret =

devm_reset_control_bulk_get_optional_shared(dev,

drivers/gpu/drm/verisilicon/vs_dc.c +7 -0
+				VSDC_RESET_COUNT, dc->rsts);
+		if (ret) {
+			dev_err(dev, "can't get reset lines\n");
+			return ret;
+		}
+
+		dc->axi_clk = devm_clk_get_enabled(dev, "axi");

drivers/gpu/drm/verisilicon/vs_dc.c static int vs_dc_probe(struct platform_device *pdev) · line 138

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc.c +10 -0
+		if (IS_ERR(dc->axi_clk)) {
+			dev_err(dev, "can't get axi clock\n");
+			return PTR_ERR(dc->axi_clk);
+		}
+
+		dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
+		if (IS_ERR(dc->ahb_clk)) {
+			dev_err(dev, "can't get ahb clock\n");
+			return PTR_ERR(dc->ahb_clk);
+		}

Please make these clocks optional, instead of wrap them in a "family detection". The resets are already optional, see above.

Quoted 152 lines

  }

  dc->core_clk = devm_clk_get_enabled(dev, "core");

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -92,28 +144,18 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return PTR_ERR(dc->core_clk);
  	}

drivers/gpu/drm/verisilicon/vs_dc.c +0 -12
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
-	if (IS_ERR(dc->axi_clk)) {
-		dev_err(dev, "can't get axi clock\n");
-		return PTR_ERR(dc->axi_clk);
-	}
-
-	dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
-	if (IS_ERR(dc->ahb_clk)) {
-		dev_err(dev, "can't get ahb clock\n");
-		return PTR_ERR(dc->ahb_clk);
-	}
-

  irq = platform_get_irq(pdev, 0);
  if (irq < 0) {
  dev_err(dev, "can't get irq\n");
  return irq;
  }

drivers/gpu/drm/verisilicon/vs_dc.c +0 -1
-	ret = reset_control_bulk_deassert(VSDC_RESET_COUNT, dc-
Quoted 1 line

rsts);

drivers/gpu/drm/verisilicon/vs_dc.c +2 -3
-	if (ret) {
-		dev_err(dev, "can't deassert reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		ret = reset_control_bulk_deassert(VSDC_RESET_COUNT,

dc->rsts);

drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+		if (ret) {
+			dev_err(dev, "can't deassert reset

lines\n");

drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+			return ret;
+		}

  }

  regs = devm_platform_ioremap_resource(pdev, 0);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -123,23 +165,30 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		goto err_rst_assert;
  	}

drivers/gpu/drm/verisilicon/vs_dc.c +0 -1
-	dc->regs = devm_regmap_init_mmio(dev, regs,

&vs_dc_regmap_cfg);

drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
+	dc->regs = devm_regmap_init_mmio(dev, regs, info-
Quoted 1 line

regmap_cfg);

  if (IS_ERR(dc->regs)) {
  ret = PTR_ERR(dc->regs);
  goto err_rst_assert;
  }

drivers/gpu/drm/verisilicon/vs_dc.c +2 -3
-	ret = vs_fill_chip_identity(dc->regs, &dc->identity);
-	if (ret)
-		goto err_rst_assert;
+	if (info->has_chip_id) {
+		ret = vs_fill_chip_identity(dc->regs, &dc-
Quoted 1 line

identity);

drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+		if (ret)
+			goto err_rst_assert;

drivers/gpu/drm/verisilicon/vs_dc.c +0 -1
-	dev_info(dev, "Found DC%x rev %x customer %x\n", dc-
Quoted 1 line

identity.model,

drivers/gpu/drm/verisilicon/vs_dc.c +3 -1
-		 dc->identity.revision, dc->identity.customer_id);
+		dev_info(dev, "Found DC%x rev %x customer %x\n",
+			 dc->identity.model, dc->identity.revision,
+			 dc->identity.customer_id);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -2
-	if (port_count > dc->identity.display_count) {
-		dev_err(dev, "too many downstream ports than HW

capability\n");

drivers/gpu/drm/verisilicon/vs_dc.c +2 -2
-		ret = -EINVAL;
-		goto err_rst_assert;
+		if (port_count > dc->identity.display_count) {
+			dev_err(dev, "too many downstream ports than

HW capability\n");

drivers/gpu/drm/verisilicon/vs_dc.c +7 -0
+			ret = -EINVAL;
+			goto err_rst_assert;
+		}
+	} else {
+		/* Fill identity from platform data */
+		dc->identity.display_count = info->display_count;
+		dc->identity.formats = info->formats;

  }

  for (i = 0; i < dc->identity.display_count; i++) {

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -168,7 +217,8 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	return 0;


 err_rst_assert:

drivers/gpu/drm/verisilicon/vs_dc.c +2 -1
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc-
Quoted 1 line

rsts);

  return ret;
 }

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -180,7 +230,8 @@ static void vs_dc_remove(struct platform_device
 *pdev)


  dev_set_drvdata(&pdev->dev, NULL);

drivers/gpu/drm/verisilicon/vs_dc.c +2 -1
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (dc->info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc-
Quoted 1 line

rsts);

 }

 static void vs_dc_shutdown(struct platform_device *pdev)

drivers/gpu/drm/verisilicon/vs_dc.h +0 -0
index ed1016f18758..f0613519af37 100644
@@ -31,6 +31,7 @@ struct vs_dc {
  	struct clk *pix_clk[VSDC_MAX_OUTPUTS];
  	struct reset_control_bulk_data rsts[VSDC_RESET_COUNT];

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	const struct vs_dc_info *info;

  struct vs_drm_dev *drm_dev;
  struct vs_chip_identity identity;
 };

drivers/gpu/drm/verisilicon/vs_drm.c +1 -0
index fd259d53f49f..ff0fc6673006 100644
@@ -27,6 +27,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"


 #define DRIVER_NAME "verisilicon"
 #define DRIVER_DESC "Verisilicon DC-series display controller
driver"

drivers/gpu/drm/verisilicon/vs_drm.c +0 -0
@@ -72,12 +73,19 @@ static struct drm_mode_config_helper_funcs
 vs_mode_config_helper_funcs = {
  	.atomic_commit_tail = drm_atomic_helper_commit_tail,
  };

drivers/gpu/drm/verisilicon/vs_drm.c +1 -1
-static void vs_mode_config_init(struct drm_device *drm)
+static void vs_mode_config_init(struct drm_device *drm, struct vs_dc

*dc)
 {
  drm->mode_config.min_width = 0;
  drm->mode_config.min_height = 0;

drivers/gpu/drm/verisilicon/vs_drm.c static struct drm_mode_config_helper_funcs vs_mode_config_helper_funcs = { · line 83

Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_drm.c +4 -2
-	drm->mode_config.max_width = 8192;
-	drm->mode_config.max_height = 8192;
+
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		drm->mode_config.max_width = 1920;
+		drm->mode_config.max_height = 1080;

Surely only max width 1920 and max height 1080? Can a display of 1080x1920 (e.g. a portrait DSI panel behind a RGB2DSI bridge) be supported? Can a 2170x60 display (MacBook Touch Bar panel, also a DSI panel) be supported? Both displays here will have no higher pixel clock than 1080p in the same refresh rate, although the width / height is higher than your restriction.

In addition, these parameters decide how big a FB can be created -- the FB might be scaned out by multiple devices (e.g. a USB DisplayLink device scanning out the remaining part). The stride register is said to have 17-bit width in the MA35D1 TRM, so the possible FB width could be quite high -- assume the 17th bit is only for the value with one 1 and all remaining 0, we get 65536 bytes stride; with 4-byte-per-pixel divided this gets 16384 pixels -- the htotal/hdisplay/vtotal/vdisplay fields in the manual has 15-bit field width, which can reach 32767.

I strongly suggest leave the original values here.

Quoted 91 lines
drivers/gpu/drm/verisilicon/vs_drm.c +5 -0
+	} else {
+		drm->mode_config.max_width = 8192;
+		drm->mode_config.max_height = 8192;
+	}
+

  drm->mode_config.funcs = &vs_mode_config_funcs; drm->mode_config.helper_private = &vs_mode_config_helper_funcs;
 }

drivers/gpu/drm/verisilicon/vs_drm.c +0 -0
@@ -125,7 +133,7 @@ int vs_drm_initialize(struct vs_dc *dc, struct
 platform_device *pdev)
  	if (ret)
  		return ret;

drivers/gpu/drm/verisilicon/vs_drm.c +1 -1
-	vs_mode_config_init(drm);
+	vs_mode_config_init(drm, dc);


  /* Enable connectors polling */
  drm_kms_helper_poll_init(drm);

drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
index 09336af0900a..39402d75d841 100644
@@ -78,7 +78,7 @@ static const u32 vs_formats_array_with_yuv444[] = {
  	/* TODO: non-RGB formats */
  };

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -1
-static const struct vs_formats vs_formats_no_yuv444 = {
+const struct vs_formats vs_formats_no_yuv444 = {

  .array = vs_formats_array_no_yuv444, .num = ARRAY_SIZE(vs_formats_array_no_yuv444) };

drivers/gpu/drm/verisilicon/vs_hwdb.h +0 -0
index 92192e4fa086..655cf93ca3aa 100644
@@ -14,6 +14,29 @@ struct vs_formats {
  	unsigned int num;
  };

drivers/gpu/drm/verisilicon/vs_hwdb.h +9 -0
+enum vs_dc_family {
+	VS_DC_FAMILY_DC8000,
+	VS_DC_FAMILY_DCULTRA_LITE,
+};
+
+/**
+ * struct vs_dc_info - per-SoC DC platform data
+ * @family:		DC IP family (DC8000, DCUltra Lite, etc.)
+ * @display_count:	number of display outputs (0 = auto-detect

from DT/HW)
+ * @has_chip_id: whether chip identity registers exist
+ * @has_config_ex: whether CONFIG_EX commit mechanism exists
+ * @regmap_cfg: regmap configuration for this
variant
+ * @formats: supported pixel formats (NULL = auto-detect
from chip ID)
+ */

drivers/gpu/drm/verisilicon/vs_hwdb.h +9 -0
+struct vs_dc_info {
+	enum vs_dc_family family;
+	u32 display_count;
+	bool has_chip_id;
+	bool has_config_ex;
+	const struct regmap_config *regmap_cfg;
+	const struct vs_formats *formats;
+};
+

 struct vs_chip_identity {
  u32 model;
  u32 revision;

drivers/gpu/drm/verisilicon/vs_hwdb.h +0 -0
@@ -23,6 +46,8 @@ struct vs_chip_identity {
  	const struct vs_formats *formats;
  };

drivers/gpu/drm/verisilicon/vs_hwdb.h +2 -0
+extern const struct vs_formats vs_formats_no_yuv444;
+

 int vs_fill_chip_identity(struct regmap *regs, struct vs_chip_identity *ident);

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
index 1f2be41ae496..197d5d683e22 100644
@@ -55,8 +55,9 @@ static int vs_primary_plane_atomic_check(struct
 drm_plane *plane,


 static void vs_primary_plane_commit(struct vs_dc *dc, unsigned int output)
 {

drivers/gpu/drm/verisilicon/vs_primary_plane.c static int vs_primary_plane_atomic_check(struct drm_plane *plane, · line 60

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -2
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_COMMIT);

Should VALID bit be written here instead of doing nothing on DC8000/DCUltraLite ?

Quoted 49 lines

 }

 static void vs_primary_plane_atomic_enable(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -69,11 +70,13 @@ static void vs_primary_plane_atomic_enable(struct
 drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;

drivers/gpu/drm/verisilicon/vs_primary_plane.c +4 -5
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
-	regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
+	if (dc->info->has_config_ex) {
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
+		regmap_update_bits(dc->regs,

VSDC_FB_CONFIG_EX(output),

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+				  

VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+				  

VSDC_FB_CONFIG_EX_DISPLAY_ID(output));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+	}


  vs_primary_plane_commit(dc, output);
 }

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -88,8 +91,9 @@ static void vs_primary_plane_atomic_disable(struct
 drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -2
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);


  vs_primary_plane_commit(dc, output);
 }

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -126,6 +130,11 @@ static void
 vs_primary_plane_atomic_update(struct drm_plane *plane,
  			   VSDC_FB_CONFIG_UV_SWIZZLE_EN,
  			   vs_state->format.uv_swizzle);

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+	/* DCUltra Lite requires explicit enable/reset bits in

FB_CONFIG */

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -0
+	if (!dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+				VSDC_FB_CONFIG_ENABLE |
Quoted 1 line

VSDC_FB_CONFIG_RESET);

Should VSDC_FB_CONFIG_RESET be only set when it's ready to output the signal (at least all timing is programmed)? I think it should be programmed in crtc/bridge instead of primary plane, although it's in the DcregFrameBufferConfig0 register (obviously this sounds a little weird, this might be why they changed this in DC8200).

When ENABLE (OUTPUT in the document) is cleared, all pixels will be blacked out; so I think it's better to set ENABLE in CRTC, and then set RESET in bridge (doing the work of encoder in this driver) -- it seems that for DC8000/DCUltraLite the primary plane is not possible to be disabled.

Quoted 44 lines

  dma_addr = vs_fb_get_dma_addr(fb, &state->src);
  regmap_write(dc->regs, VSDC_FB_ADDRESS(output),

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -133,16 +142,18 @@ static void
 vs_primary_plane_atomic_update(struct drm_plane *plane,
  	regmap_write(dc->regs, VSDC_FB_STRIDE(output),
  		     fb->pitches[0]);

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -2
-	regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x, state-
Quoted 1 line

crtc_y));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -2
-	regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x + state-
Quoted 1 line

crtc_w,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -1
-					 state->crtc_y + state-
Quoted 1 line

crtc_h));

  regmap_write(dc->regs, VSDC_FB_SIZE(output), VSDC_MAKE_PLANE_SIZE(state->crtc_w, state-

Quoted 1 line

crtc_h));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -2
-	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
-		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	if (dc->info->has_config_ex) {
+		regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x,

state->crtc_y));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +2 -0
+		regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x +

state->crtc_w,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+						 state->crtc_y +

state->crtc_h));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -0
+		regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
+			     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	}


  vs_primary_plane_commit(dc, output);
 }

drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +0 -0
index cbb125c46b39..288064760b48 100644
@@ -16,6 +16,8 @@
  #define VSDC_FB_STRIDE(n)			(0x1408 + 0x4 * (n))
Quoted 3 lines


 #define VSDC_FB_CONFIG(n) (0x1518 + 0x4 * (n))
+#define VSDC_FB_CONFIG_ENABLE BIT(0)

As I mentioned that the VALID bit is quite important, please add it here (you can call it "COMMIT" too if you like).

#define VSDC_FB_CONFIG_VALID BIT(3)

Quoted 5 lines

+#define VSDC_FB_CONFIG_RESET BIT(4)
 #define VSDC_FB_CONFIG_CLEAR_EN BIT(8)
 #define VSDC_FB_CONFIG_ROT_MASK GENMASK(13,
11)
 #define VSDC_FB_CONFIG_ROT(v) ((v) << 11)

author
#8 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 8 lines · Icenowy Zheng
Quoted 7 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display controller, which is a previous generation of the DC8000 series. While
the general register layout is similar to the DC8000, there are several
key differences that require per-variant handling in the driver.

Quoted 8 lines
Quoted 6 lines

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe per-IP-variant capabilities, and use it throughout the driver to select
the correct code paths at runtime.

Key differences between DC8000 and DCUltra Lite handled:

What the driver supports now is DC8200, DC8000 have the following point 1~4 the same with DCUltraLite (different to DC8200).

Understood. I'll rename all vs_dc8000_* identifiers to vs_dc8200_* in v2. The commit message will also be corrected to say that points 1~4 are differences from DC8200, not DC8000.

Quoted 9 lines
Quoted 4 lines

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static
   platform data instead of reading model/revision/customer_id from
HW.

My test shows that revision and customer_id is correctly present, only model is 0 -- I think this can be also considered as a valid model value because the IP name has also no model number.

The revision number is 0x5560 and customer id is 0x305 .

Thank you for testing. I'll drop the has_chip_id flag entirely. In v2, vs_fill_chip_identity() will be called for all variants. A new entry will be added to vs_chip_identities[] in vs_hwdb.c with model=0x0, revision=0x5560, customer_id=0x305, display_count=1, and vs_formats_no_yuv444.
e.g. verisilicon-dc 40260000.display: Found DC0 rev 5560 customer 305

Quoted 14 lines
Quoted 14 lines

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT), 0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite omits all of these and instead uses enable/reset bits in FB_CONFIG (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts when PANEL_CONFIG.RUNNING is set; no separate multi-display sync start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

Quoted 6 lines
Quoted 4 lines

5. Different clock/reset topology: DCUltra Lite requires only "core" (bus gate) and "pix0" (pixel divider) clocks with no reset lines managed by the driver. DC8000 needs core/axi/ahb clocks and three resets.

It's possible that your SoC integration combines core clock gate with bus clock gate instead of bus clock gate not existing.

Agreed. In v2 I'll remove the family-gated clock handling and instead use devm_clk_get_optional_enabled() for the axi and ahb clocks, so they are simply skipped if not present in DT. Resets are already optional. This keeps the probe path uniform and handles any SoC-specific clock combinations naturally.

Quoted 76 lines
Quoted 72 lines

6. Single output only: DCUltra Lite has one display output; per- output
   index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table, extend Kconfig to allow building on ARCH_MA35 platforms, and expose vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
  drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
  drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++--
  drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +-
  drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++----
--
  drivers/gpu/drm/verisilicon/vs_dc.h           |   1 +
  drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++-
  drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +-
  drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++
  .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++---
  .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +
  10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +0 -0
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@
  config DRM_VERISILICON_DC
  	tristate "DRM Support for Verisilicon DC-series display

controllers"
  depends on DRM && COMMON_CLK

drivers/gpu/drm/verisilicon/Kconfig +1 -1
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST
  	select DRM_BRIDGE_CONNECTOR
  	select DRM_CLIENT_SELECTION
  	select DRM_DISPLAY_HELPER
drivers/gpu/drm/verisilicon/vs_bridge.c +5 -6
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,
  			VSDC_DISP_PANEL_CONFIG_CLK_EN);
  	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
  			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));
 
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc-
 > id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				
 VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(output

));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c

Quoted 1 line
drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);

Should the commit operation happen on DC8000/DCUltraLite too? (By writing to DcregFrameBufferConfig0.VALID).

Quoted 6 lines

Many registers written has "Note: This field is double buffered" in the DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

[a] There is no commit operation for DCUltra Lite.
I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a hardware-managed double-buffer status bit: hardware writes 1=PENDING when a new register set is ready and clears to 0=WORKING after the VBLANK copy. Software must never write it, and there is no polling use case in the driver that requires a named constant. For non-config_ex variants, vs_primary_plane_commit() performs no commit operation — VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is set/cleared in the bridge enable/disable paths.

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+	}
  }
 
  static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,
@@ -228,14 +231,17 @@ static void vs_bridge_atomic_disable(struct
 drm_bridge *bridge,
  	struct vs_dc *dc = crtc->dc;
  	unsigned int output = crtc->id;
 
Quoted 8 lines

drivers/gpu/drm/verisilicon/vs_bridge.c static void vs_bridge_atomic_disable(struct drm_bridge *bridge, · line 235

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -3
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
-			  VSDC_DISP_PANEL_START_RUNNING(output));
  	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
  			  VSDC_DISP_PANEL_CONFIG_RUNNING);

This bit seems to be not present in DCUltraLite, instead should DcregFrameBufferConfig0.RESET be clear, which will stall the DPI timing?

I'll move VSDC_DISP_PANEL_CONFIG_RUNNING inside the has_config_ex block in both the enable and disable paths. For non-config_ex variants (DCUltra Lite), the disable path will instead clear VSDC_FB_CONFIG_RESET to stall DPI output. VSDC_DISP_PANEL_CONFIG_RUNNING will only be set/cleared for DC8200 (has_config_ex=true).

Quoted 16 lines
Quoted 13 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +3 -2
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc-
 > id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_RUNNING(output));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}

Ditto.

Covered by the same fix above — the else branch in vs_bridge_atomic_disable() will handle the non-config_ex (DCUltra Lite) path by clearing RESET.

Quoted 33 lines
Quoted 17 lines

 }

 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -0
index 9080344398ca..2f3e6d41c657 100644
@@ -18,6 +18,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"
  #include "vs_plane.h"
 
  static void vs_crtc_atomic_disable(struct drm_crtc *crtc,

drivers/gpu/drm/verisilicon/vs_crtc.c static int vs_crtc_enable_vblank(struct drm_crtc · line 139

Quoted 8 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +2 -1
@@ -132,7 +133,11 @@ static int vs_crtc_enable_vblank(struct drm_crtc
 *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
 VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, BIT(0));

Should BIT(0) be assigned with a named macro here, like VSDC_DISP_IRQ_VSYNC(0) ?

In addition, even it's known that DC8000/DCUltraLite has only one output, hardcoding 0 here isn't so good. The header file at [1] (which is for DC8000) shows that two display interrupts and more other interrupts are present.

Quoted 6 lines

BTW I don't like the idea of setting a "family" (because DC8000 behave nearly the same with DCUltraLite), maybe use .irq_reg = VSDC_DISP_IRQ (or a bool variable named uses_top_irq) is better?

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

I'll address all three issues in v2:
1. Add VSDC_DISP_IRQ_VSYNC(n) macro (BIT(n)) to vs_crtc_regs.h.
2. Use VSDC_DISP_IRQ_VSYNC(vcrtc->id) with regmap_set_bits/regmap_clear_bits instead of hardcoding 0 and using regmap_write (which would clobber other IRQ bits).
3. Add uses_top_irq bool to struct vs_chip_identity in vs_hwdb.h. DC8200 entries will have uses_top_irq = true; the DCUltra Lite entry (model=0x0, rev=0x5560) will have uses_top_irq = false.

Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -0
+	else
+		regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				VSDC_TOP_IRQ_VSYNC(vcrtc->id));
 

  return 0;
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +5 -1
@@ -142,7 +147,11 @@ static void vs_crtc_disable_vblank(struct
 drm_crtc *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
 VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, 0);
+	else
+		regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				  VSDC_TOP_IRQ_VSYNC(vcrtc->id));
  }

 static const struct drm_crtc_funcs vs_crtc_funcs = {

drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
index dad9967bc10b..82a6a26f6d81 100644
@@ -9,21 +9,45 @@
  #include <linux/of_graph.h>
 
  #include "vs_crtc.h"
+#include "vs_crtc_regs.h"
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
  #include "vs_hwdb.h"
 
Quoted 3 lines

drivers/gpu/drm/verisilicon/vs_dc.c line 18

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-static const struct regmap_config vs_dc_regmap_cfg = {
+static const struct regmap_config vs_dc8000_regmap_cfg = {

As what I said, the currently supported thing is DC8200, not DC8000.

I'll keep the name vs_dc_regmap_cfg — the original name from upstream. A separate DCUltra Lite regmap config is not needed; the hardware simply does not implement registers above 0x2000, and a regmap window up to 0x2544 is harmless for that variant.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/verisilicon/vs_dc.c +21 -1
  	.reg_bits = 32,
  	.val_bits = 32,
  	.reg_stride = sizeof(u32),
-	/* VSDC_OVL_CONFIG_EX(1) */
  	.max_register = 0x2544,
  };
 
+static const struct regmap_config vs_dcultra_lite_regmap_cfg = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = sizeof(u32),
+	.max_register = 0x2000,
+};
+
+static const struct vs_dc_info vs_dc8000_info = {
+	.family = VS_DC_FAMILY_DC8000,
+	.has_chip_id = true,
+	.has_config_ex = true,
+	.regmap_cfg = &vs_dc8000_regmap_cfg,
+};
+
+static const struct vs_dc_info vs_dcultra_lite_info = {
+	.family = VS_DC_FAMILY_DCULTRA_LITE,
+	.display_count = 1,
+	.has_chip_id = false,
+	.has_config_ex = false,
+	.regmap_cfg = &vs_dcultra_lite_regmap_cfg,
+	.formats = &vs_formats_no_yuv444,
Quoted 8 lines

drivers/gpu/drm/verisilicon/vs_dc.c line 49

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc.c +3 -1
+};
+
  static const struct of_device_id vs_dc_driver_dt_match[] = {
-	{ .compatible = "verisilicon,dc" },
+	{ .compatible = "verisilicon,dc", .data = &vs_dc8000_info },

"verisilicon,dc" is expected for DC8000 and 8200, and because of model, rev and customer_id values are all present for DCUltraLite, the special data might be dropped?

I'll drop .data from both of_device_id entries entirely. has_config_ex and uses_top_irq will be added as fields to struct vs_chip_identity in vs_hwdb.h, and populated for each entry in vs_chip_identities[] in vs_hwdb.c. vs_fill_chip_identity() is called unconditionally for all variants — chip-ID registers are present on DCUltra Lite too. There is no need for a separate vs_dc_info platform data structure.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
+	{ .compatible = "nuvoton,ma35d1-dcu", .data =
 &vs_dcultra_lite_info },
  	{},
  };

 MODULE_DEVICE_TABLE(of, vs_dc_driver_dt_match);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -33,6 +57,13 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  	struct vs_dc *dc = private;
  	u32 irqs;
 
Quoted 3 lines

drivers/gpu/drm/verisilicon/vs_dc.c static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 61

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);

Maybe add an item in the hwdb for the IRQ register?

I'll add uses_top_irq as a bool field to struct vs_chip_identity in vs_hwdb.h instead. The IRQ handler will branch on dc->identity.uses_top_irq to read either VSDC_TOP_IRQ_ACK or VSDC_DISP_IRQ_STA. No register address needs to be stored in the hwdb struct.

Quoted 6 lines

drivers/gpu/drm/verisilicon/vs_dc.c static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 64

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc.c +3 -0
+		if (irqs & BIT(0))
+			vs_drm_handle_irq(dc,
 VSDC_TOP_IRQ_VSYNC(0));
+		return IRQ_HANDLED;

Now I think for DC8200, the irq number decoding should be done here too.

I'll unify the IRQ handler: both paths will read their respective IRQ status register and pass the raw irqs value to vs_drm_handle_irq(). Since VSDC_TOP_IRQ_VSYNC(n) and VSDC_DISP_IRQ_VSYNC(n) are both BIT(n), the bit positions are identical and vs_drm_handle_irq() handles both without change.

Quoted 60 lines
Quoted 60 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	}
+
  	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);

  vs_drm_handle_irq(dc, irqs);

drivers/gpu/drm/verisilicon/vs_dc.c +1 -0
@@ -43,6 +74,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  static int vs_dc_probe(struct platform_device *pdev)
  {
  	struct device *dev = &pdev->dev;
+	const struct vs_dc_info *info;
  	struct vs_dc *dc;
  	void __iomem *regs;

  unsigned int port_count, i;

drivers/gpu/drm/verisilicon/vs_dc.c +4 -0
@@ -55,6 +87,10 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return -ENODEV;
  	}
 
+	info = of_device_get_match_data(dev);
+	if (!info)
+		return -ENODEV;
+
  	port_count = of_graph_get_port_count(dev->of_node);
  	if (!port_count) {

  dev_err(dev, "can't find DC downstream ports\n");

drivers/gpu/drm/verisilicon/vs_dc.c +18 -8
@@ -75,15 +111,31 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	if (!dc)
  		return -ENOMEM;
 
-	dc->rsts[0].id = "core";
-	dc->rsts[1].id = "axi";
-	dc->rsts[2].id = "ahb";
+	dc->info = info;
 
-	ret = devm_reset_control_bulk_get_optional_shared(dev,
 VSDC_RESET_COUNT,
-							  dc->rsts);
-	if (ret) {
-		dev_err(dev, "can't get reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		dc->rsts[0].id = "core";
+		dc->rsts[1].id = "axi";
+		dc->rsts[2].id = "ahb";
+
+		ret =
 devm_reset_control_bulk_get_optional_shared(dev,
+				VSDC_RESET_COUNT, dc->rsts);
+		if (ret) {
+			dev_err(dev, "can't get reset lines\n");
+			return ret;
+		}
+
+		dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+		if (IS_ERR(dc->axi_clk)) {
+			dev_err(dev, "can't get axi clock\n");
+			return PTR_ERR(dc->axi_clk);
+		}
Quoted 8 lines

drivers/gpu/drm/verisilicon/vs_dc.c static int vs_dc_probe(struct platform_device *pdev) · line 138

Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_dc.c +6 -0
+
+		dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
+		if (IS_ERR(dc->ahb_clk)) {
+			dev_err(dev, "can't get ahb clock\n");
+			return PTR_ERR(dc->ahb_clk);
+		}

Please make these clocks optional, instead of wrap them in a "family detection". The resets are already optional, see above.

I'll remove the family-gated block entirely. Resets will be acquired unconditionally (they are optional, so absent ones are skipped). axi and ahb clocks will use devm_clk_get_optional_enabled() so they are silently skipped when not present in DT. The probe path will be uniform for all variants.

Quoted 174 lines
Quoted 148 lines

  }

  dc->core_clk = devm_clk_get_enabled(dev, "core");

drivers/gpu/drm/verisilicon/vs_dc.c +4 -16
@@ -92,28 +144,18 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return PTR_ERR(dc->core_clk);
  	}
 
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
-	if (IS_ERR(dc->axi_clk)) {
-		dev_err(dev, "can't get axi clock\n");
-		return PTR_ERR(dc->axi_clk);
-	}
-
-	dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
-	if (IS_ERR(dc->ahb_clk)) {
-		dev_err(dev, "can't get ahb clock\n");
-		return PTR_ERR(dc->ahb_clk);
-	}
-
  	irq = platform_get_irq(pdev, 0);
  	if (irq < 0) {
  		dev_err(dev, "can't get irq\n");
  		return irq;
  	}
 
-	ret = reset_control_bulk_deassert(VSDC_RESET_COUNT, dc-
 > rsts);
-	if (ret) {
-		dev_err(dev, "can't deassert reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		ret = reset_control_bulk_deassert(VSDC_RESET_COUNT,
 dc->rsts);
+		if (ret) {
+			dev_err(dev, "can't deassert reset

lines\n");

drivers/gpu/drm/verisilicon/vs_dc.c +10 -8
+			return ret;
+		}
  	}
 
  	regs = devm_platform_ioremap_resource(pdev, 0);
@@ -123,23 +165,30 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		goto err_rst_assert;
  	}
 
-	dc->regs = devm_regmap_init_mmio(dev, regs,
 &vs_dc_regmap_cfg);
+	dc->regs = devm_regmap_init_mmio(dev, regs, info-
 > regmap_cfg);
  	if (IS_ERR(dc->regs)) {
  		ret = PTR_ERR(dc->regs);
  		goto err_rst_assert;
  	}
 
-	ret = vs_fill_chip_identity(dc->regs, &dc->identity);
-	if (ret)
-		goto err_rst_assert;
+	if (info->has_chip_id) {
+		ret = vs_fill_chip_identity(dc->regs, &dc-
 > identity);
+		if (ret)
+			goto err_rst_assert;
 
-	dev_info(dev, "Found DC%x rev %x customer %x\n", dc-
 > identity.model,
-		 dc->identity.revision, dc->identity.customer_id);
+		dev_info(dev, "Found DC%x rev %x customer %x\n",
+			 dc->identity.model, dc->identity.revision,
+			 dc->identity.customer_id);
 
-	if (port_count > dc->identity.display_count) {
-		dev_err(dev, "too many downstream ports than HW

capability\n");

drivers/gpu/drm/verisilicon/vs_dc.c +2 -2
-		ret = -EINVAL;
-		goto err_rst_assert;
+		if (port_count > dc->identity.display_count) {
+			dev_err(dev, "too many downstream ports than

HW capability\n");

drivers/gpu/drm/verisilicon/vs_dc.c +9 -1
+			ret = -EINVAL;
+			goto err_rst_assert;
+		}
+	} else {
+		/* Fill identity from platform data */
+		dc->identity.display_count = info->display_count;
+		dc->identity.formats = info->formats;
  	}
 
  	for (i = 0; i < dc->identity.display_count; i++) {
@@ -168,7 +217,8 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	return 0;
 
  err_rst_assert:
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc-
 > rsts);
  	return ret;

 }

drivers/gpu/drm/verisilicon/vs_dc.c +2 -1
@@ -180,7 +230,8 @@ static void vs_dc_remove(struct platform_device
 *pdev)
 
  	dev_set_drvdata(&pdev->dev, NULL);
 
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (dc->info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc-
 > rsts);
  }

 static void vs_dc_shutdown(struct platform_device *pdev)

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
index ed1016f18758..f0613519af37 100644
@@ -31,6 +31,7 @@ struct vs_dc {
  	struct clk *pix_clk[VSDC_MAX_OUTPUTS];
  	struct reset_control_bulk_data rsts[VSDC_RESET_COUNT];
 
+	const struct vs_dc_info *info;
  	struct vs_drm_dev *drm_dev;
  	struct vs_chip_identity identity;
  };
drivers/gpu/drm/verisilicon/vs_drm.c +1 -0
index fd259d53f49f..ff0fc6673006 100644
@@ -27,6 +27,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"
 
  #define DRIVER_NAME	"verisilicon"
  #define DRIVER_DESC	"Verisilicon DC-series display controller

driver"

drivers/gpu/drm/verisilicon/vs_drm.c +1 -1
@@ -72,12 +73,19 @@ static struct drm_mode_config_helper_funcs
 vs_mode_config_helper_funcs = {
  	.atomic_commit_tail = drm_atomic_helper_commit_tail,
  };
 
-static void vs_mode_config_init(struct drm_device *drm)
+static void vs_mode_config_init(struct drm_device *drm, struct vs_dc

drivers/gpu/drm/verisilicon/vs_drm.c static struct drm_mode_config_helper_funcs · line 85

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_drm.c +4 -2
 *dc)
  {
  	drm->mode_config.min_width = 0;
  	drm->mode_config.min_height = 0;
-	drm->mode_config.max_width = 8192;
-	drm->mode_config.max_height = 8192;
+
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		drm->mode_config.max_width = 1920;
+		drm->mode_config.max_height = 1080;

Surely only max width 1920 and max height 1080? Can a display of 1080x1920 (e.g. a portrait DSI panel behind a RGB2DSI bridge) be supported? Can a 2170x60 display (MacBook Touch Bar panel, also a DSI panel) be supported? Both displays here will have no higher pixel clock than 1080p in the same refresh rate, although the width / height is higher than your restriction.

In addition, these parameters decide how big a FB can be created -- the FB might be scaned out by multiple devices (e.g. a USB DisplayLink device scanning out the remaining part). The stride register is said to have 17-bit width in the MA35D1 TRM, so the possible FB width could be quite high -- assume the 17th bit is only for the value with one 1 and all remaining 0, we get 65536 bytes stride; with 4-byte-per-pixel divided this gets 16384 pixels -- the htotal/hdisplay/vtotal/vdisplay fields in the manual has 15-bit field width, which can reach 32767.

Quoted 1 line

I strongly suggest leave the original values here.

You are right. I'll revert to 8192x8192 for all variants. The variant-specific max_width/max_height logic will be removed entirely and vs_mode_config_init() will take no dc argument.

Quoted 88 lines
Quoted 88 lines
drivers/gpu/drm/verisilicon/vs_drm.c +5 -0
+	} else {
+		drm->mode_config.max_width = 8192;
+		drm->mode_config.max_height = 8192;
+	}
+
  	drm->mode_config.funcs = &vs_mode_config_funcs;

  drm->mode_config.helper_private =
&vs_mode_config_helper_funcs;
 }

drivers/gpu/drm/verisilicon/vs_drm.c +1 -1
@@ -125,7 +133,7 @@ int vs_drm_initialize(struct vs_dc *dc, struct
 platform_device *pdev)
  	if (ret)
  		return ret;
 
-	vs_mode_config_init(drm);
+	vs_mode_config_init(drm, dc);
 
  	/* Enable connectors polling */

  drm_kms_helper_poll_init(drm);

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -1
index 09336af0900a..39402d75d841 100644
@@ -78,7 +78,7 @@ static const u32 vs_formats_array_with_yuv444[] = {
  	/* TODO: non-RGB formats */
  };
 
-static const struct vs_formats vs_formats_no_yuv444 = {
+const struct vs_formats vs_formats_no_yuv444 = {
  	.array = vs_formats_array_no_yuv444,
  	.num = ARRAY_SIZE(vs_formats_array_no_yuv444)
  };
drivers/gpu/drm/verisilicon/vs_hwdb.h +12 -0
index 92192e4fa086..655cf93ca3aa 100644
@@ -14,6 +14,29 @@ struct vs_formats {
  	unsigned int num;
  };
 
+enum vs_dc_family {
+	VS_DC_FAMILY_DC8000,
+	VS_DC_FAMILY_DCULTRA_LITE,
+};
+
+/**
+ * struct vs_dc_info - per-SoC DC platform data
+ * @family:		DC IP family (DC8000, DCUltra Lite, etc.)
+ * @display_count:	number of display outputs (0 = auto-detect
 from DT/HW)
+ * @has_chip_id:	whether chip identity registers exist
+ * @has_config_ex:	whether CONFIG_EX commit mechanism exists
+ * @regmap_cfg:		regmap configuration for this

variant
+ * @formats: supported pixel formats (NULL = auto-detect
from chip ID)
+ */

drivers/gpu/drm/verisilicon/vs_hwdb.h +11 -0
+struct vs_dc_info {
+	enum vs_dc_family family;
+	u32 display_count;
+	bool has_chip_id;
+	bool has_config_ex;
+	const struct regmap_config *regmap_cfg;
+	const struct vs_formats *formats;
+};
+
  struct vs_chip_identity {
  	u32 model;
  	u32 revision;
@@ -23,6 +46,8 @@ struct vs_chip_identity {
  	const struct vs_formats *formats;
  };
 
+extern const struct vs_formats vs_formats_no_yuv444;
+
  int vs_fill_chip_identity(struct regmap *regs,
  			  struct vs_chip_identity *ident);
 
drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
index 1f2be41ae496..197d5d683e22 100644
@@ -55,8 +55,9 @@ static int vs_primary_plane_atomic_check(struct
 drm_plane *plane,
 
Quoted 10 lines

drivers/gpu/drm/verisilicon/vs_primary_plane.c static int vs_primary_plane_atomic_check(struct drm_plane *plane, · line 60

Quoted 8 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -2
  static void vs_primary_plane_commit(struct vs_dc *dc, unsigned int
 output)
  {
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_COMMIT);

Should VALID bit be written here instead of doing nothing on DC8000/DCUltraLite ?

Same as reply [a]. No VSDC_FB_CONFIG_VALID macro is needed. For non-config_ex variants, vs_primary_plane_commit() is a no-op — VSDC_FB_CONFIG_ENABLE (OUTPUT, bit 0) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (bit 4) is managed in the bridge enable/disable paths.

Quoted 56 lines
Quoted 49 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
  }

 static void vs_primary_plane_atomic_enable(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +6 -5
@@ -69,11 +70,13 @@ static void vs_primary_plane_atomic_enable(struct
 drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
-	regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
+	if (dc->info->has_config_ex) {
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
+		regmap_update_bits(dc->regs,
 VSDC_FB_CONFIG_EX(output),
+				
 VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
+				

VSDC_FB_CONFIG_EX_DISPLAY_ID(output));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +4 -2
+	}
 
  	vs_primary_plane_commit(dc, output);
  }
@@ -88,8 +91,9 @@ static void vs_primary_plane_atomic_disable(struct
 drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
 
  	vs_primary_plane_commit(dc, output);

 }

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
@@ -126,6 +130,11 @@ static void
 vs_primary_plane_atomic_update(struct drm_plane *plane,
  			   VSDC_FB_CONFIG_UV_SWIZZLE_EN,
  			   vs_state->format.uv_swizzle);
 
+	/* DCUltra Lite requires explicit enable/reset bits in

FB_CONFIG */

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -0
+	if (!dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+				VSDC_FB_CONFIG_ENABLE |
Quoted 1 line

VSDC_FB_CONFIG_RESET);

Should VSDC_FB_CONFIG_RESET be only set when it's ready to output the signal (at least all timing is programmed)? I think it should be programmed in crtc/bridge instead of primary plane, although it's in the DcregFrameBufferConfig0 register (obviously this sounds a little weird, this might be why they changed this in DC8200).

Quoted 5 lines

When ENABLE (OUTPUT in the document) is cleared, all pixels will be blacked out; so I think it's better to set ENABLE in CRTC, and then set RESET in bridge (doing the work of encoder in this driver) -- it seems that for DC8000/DCUltraLite the primary plane is not possible to be disabled.

I'll move these as suggested:
- VSDC_FB_CONFIG_ENABLE will be set in vs_crtc_atomic_enable() for non-config_ex variants (after the pixel clock is enabled).
- VSDC_FB_CONFIG_RESET will be set in vs_bridge_enable_common() for non-config_ex variants, after all timing registers are programmed.
- VSDC_FB_CONFIG_RESET will be cleared in vs_bridge_atomic_disable() for non-config_ex variants to stall DPI output.
- The ENABLE/RESET writes will be removed from vs_primary_plane_atomic_update().
- vs_primary_plane_commit() will perform no action for non-config_ex variants; the function only triggers VSDC_FB_CONFIG_EX_COMMIT for config_ex variants.

Quoted 45 lines
Quoted 45 lines

  dma_addr = vs_fb_get_dma_addr(fb, &state->src);

  regmap_write(dc->regs, VSDC_FB_ADDRESS(output),

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -7
@@ -133,16 +142,18 @@ static void
 vs_primary_plane_atomic_update(struct drm_plane *plane,
  	regmap_write(dc->regs, VSDC_FB_STRIDE(output),
  		     fb->pitches[0]);
 
-	regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x, state-
 > crtc_y));
-	regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x + state-
 > crtc_w,
-					 state->crtc_y + state-
 > crtc_h));
  	regmap_write(dc->regs, VSDC_FB_SIZE(output),
  		     VSDC_MAKE_PLANE_SIZE(state->crtc_w, state-
 > crtc_h));
 
-	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
-		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	if (dc->info->has_config_ex) {
+		regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x,

state->crtc_y));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +2 -0
+		regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x +

state->crtc_w,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +1 -0
+						 state->crtc_y +

state->crtc_h));

drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -0
+		regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
+			     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	}
 
  	vs_primary_plane_commit(dc, output);
  }
drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +0 -0
index cbb125c46b39..288064760b48 100644
@@ -16,6 +16,8 @@
  #define VSDC_FB_STRIDE(n)			(0x1408 + 0x4 * (n))
 
Quoted 6 lines

drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h line 19

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +1 -0
  #define VSDC_FB_CONFIG(n)			(0x1518 + 0x4 * (n))
+#define VSDC_FB_CONFIG_ENABLE			BIT(0)

As I mentioned that the VALID bit is quite important, please add it here (you can call it "COMMIT" too if you like).

#define VSDC_FB_CONFIG_VALID BIT(3)

Same as reply [a]. No VSDC_FB_CONFIG_VALID macro is needed.

Thank you very much for taking the time to review my work. 🙂

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +1 -0
+#define VSDC_FB_CONFIG_RESET			BIT(4)
  #define VSDC_FB_CONFIG_CLEAR_EN			BIT(8)
  #define VSDC_FB_CONFIG_ROT_MASK			GENMASK(13,
 11)

 #define VSDC_FB_CONFIG_ROT(v) ((v) << 11)

maintainer
#9 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 69 lines · 在 2026-05-12二的 15:45 +0800,Joey Lu写道:
Quoted 15 lines · Icenowy Zheng
Quoted 14 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display
controller, which is a previous generation of the DC8000 series. While
the general register layout is similar to the DC8000, there are several
key differences that require per-variant handling in the driver.

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe
per-IP-variant capabilities, and use it throughout the driver to select
the correct code paths at runtime.

Quoted 4 lines
Quoted 1 line

Key differences between DC8000 and DCUltra Lite handled:

What the driver supports now is DC8200, DC8000 have the following point
1~4 the same with DCUltraLite (different to DC8200).

Understood. I'll rename all vs_dc8000_* identifiers to vs_dc8200_* in v2. The commit message will also be corrected to say that points 1~4 are differences from DC8200, not DC8000.

Quoted 11 lines
Quoted 5 lines

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static
    platform data instead of reading model/revision/customer_id from
HW.

My test shows that revision and customer_id is correctly present, only
model is 0 -- I think this can be also considered as a valid model value because the IP name has also no model number.

The revision number is 0x5560 and customer id is 0x305 .

Thank you for testing. I'll drop the has_chip_id flag entirely. In v2, vs_fill_chip_identity() will be called for all variants. A new entry will be added to vs_chip_identities[] in vs_hwdb.c with model=0x0, revision=0x5560, customer_id=0x305, display_count=1, and vs_formats_no_yuv444.
e.g. verisilicon-dc 40260000.display: Found DC0 rev 5560 customer 305

Quoted 28 lines
Quoted 28 lines

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT),
    0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite
    omits all of these and instead uses enable/reset bits in FB_CONFIG
    (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts
    when PANEL_CONFIG.RUNNING is set; no separate multi-display sync
    start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

5. Different clock/reset topology: DCUltra Lite requires only "core"
    (bus gate) and "pix0" (pixel divider) clocks with no reset lines
    managed by the driver. DC8000 needs core/axi/ahb clocks and three
    resets.

Quoted 8 lines
Quoted 3 lines

It's possible that your SoC integration combines core clock gate with
bus clock gate instead of bus clock gate not existing.

Agreed. In v2 I'll remove the family-gated clock handling and instead use devm_clk_get_optional_enabled() for the axi and ahb clocks, so they are simply skipped if not present in DT. Resets are already optional. This keeps the probe path uniform and handles any SoC-specific clock combinations naturally.

Maybe this could be splitted as another patch, to make single commits smaller.

Quoted 94 lines
Quoted 87 lines
Quoted 83 lines

6. Single output only: DCUltra Lite has one display output; per- output
    index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table,
extend Kconfig to allow building on ARCH_MA35 platforms, and expose
vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
  drivers/gpu/drm/verisilicon/Kconfig           |   2 +- drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++-- drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +- drivers/gpu/drm/verisilicon/vs_dc.c           | 129
++++++++++++----
--
  drivers/gpu/drm/verisilicon/vs_dc.h           |   1 + drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++- drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +- drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++ .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++--- .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +

  10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +0 -0
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@

  config DRM_VERISILICON_DC
   tristate "DRM Support for Verisilicon DC-series display controllers"
   depends on DRM && COMMON_CLK

drivers/gpu/drm/verisilicon/Kconfig +1 -1
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST

   select DRM_BRIDGE_CONNECTOR
   select DRM_CLIENT_SELECTION
   select DRM_DISPLAY_HELPER

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -4
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,
   			VSDC_DISP_PANEL_CONFIG_CLK_EN);
   	regmap_set_bits(dc->regs,
 VSDC_DISP_PANEL_CONFIG(output),
   			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			 
 VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(ou

tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT
Quoted 1 line

);

Should the commit operation happen on DC8000/DCUltraLite too? (By writing to DcregFrameBufferConfig0.VALID).

Quoted 7 lines

Many registers written has "Note: This field is double buffered" in the
DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 6 lines

[a] There is no commit operation for DCUltra Lite.
I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a hardware-managed double-buffer status bit: hardware writes 1=PENDING when a new register set is ready and clears to 0=WORKING after the VBLANK copy. Software must never write it, and there is no polling use

It seems to be writable and controls whether register buffering is enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of a VBLANK signal in order to ensure all states are loaded before the next VBLANK", which indicates some kind of "committing write", although the code at [1] seems to indicate that double buffering is only enabled when bit is cleared.

Anyway this bit should be programmable, and "Software must never write it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Quoted 5 lines

case in the driver that requires a named constant. For non-config_ex variants, vs_primary_plane_commit() performs no commit operation — VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is set/cleared in the bridge enable/disable paths.

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

author
#10 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 71 lines · Icenowy Zheng
Quoted 70 lines · 在 2026-05-12二的 15:45 +0800,Joey Lu写道:
Quoted 15 lines · Icenowy Zheng
Quoted 14 lines · 在 2026-05-11一的 15:51 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display
controller, which is a previous generation of the DC8000 series. While
the general register layout is similar to the DC8000, there are several
key differences that require per-variant handling in the driver.

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe
per-IP-variant capabilities, and use it throughout the driver to select
the correct code paths at runtime.

Quoted 4 lines
Quoted 1 line

Key differences between DC8000 and DCUltra Lite handled:

What the driver supports now is DC8200, DC8000 have the following point
1~4 the same with DCUltraLite (different to DC8200).

Understood. I'll rename all vs_dc8000_* identifiers to vs_dc8200_* in v2. The commit message will also be corrected to say that points 1~4 are differences from DC8200, not DC8000.

Quoted 11 lines
Quoted 5 lines

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static
    platform data instead of reading model/revision/customer_id
from
HW.

My test shows that revision and customer_id is correctly present, only
model is 0 -- I think this can be also considered as a valid model value because the IP name has also no model number.

The revision number is 0x5560 and customer id is 0x305 .

Thank you for testing. I'll drop the has_chip_id flag entirely. In v2, vs_fill_chip_identity() will be called for all variants. A new entry will be added to vs_chip_identities[] in vs_hwdb.c with model=0x0, revision=0x5560, customer_id=0x305, display_count=1, and vs_formats_no_yuv444.
e.g. verisilicon-dc 40260000.display: Found DC0 rev 5560 customer 305

Quoted 30 lines
Quoted 20 lines

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0
(FB_BOTTOM_RIGHT),
    0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra
Lite
    omits all of these and instead uses enable/reset bits in
FB_CONFIG
    (bit 0 = enable, bit 4 = reset) for direct framebuffer
updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts
    when PANEL_CONFIG.RUNNING is set; no separate multi-display
sync
    start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014
(IRQ_EN).

Quoted 7 lines

5. Different clock/reset topology: DCUltra Lite requires only "core"
    (bus gate) and "pix0" (pixel divider) clocks with no reset
lines
    managed by the driver. DC8000 needs core/axi/ahb clocks and
three
    resets.

It's possible that your SoC integration combines core clock gate with
bus clock gate instead of bus clock gate not existing.

Quoted 7 lines
Quoted 5 lines

Agreed. In v2 I'll remove the family-gated clock handling and instead use devm_clk_get_optional_enabled() for the axi and ahb clocks, so they are simply skipped if not present in DT. Resets are already optional. This keeps the probe path uniform and handles any SoC-specific clock combinations naturally.

Maybe this could be splitted as another patch, to make single commits smaller.

Got it.

Quoted 111 lines
Quoted 94 lines
Quoted 87 lines
Quoted 83 lines

6. Single output only: DCUltra Lite has one display output; per- output
    index logic is still in place but display_count is fixed at
1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table,
extend Kconfig to allow building on ARCH_MA35 platforms, and expose
vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
   drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
   drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++--
   drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +-
   drivers/gpu/drm/verisilicon/vs_dc.c           | 129
++++++++++++----
--
   drivers/gpu/drm/verisilicon/vs_dc.h           |   1 +
   drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++-
   drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +-
   drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++
   .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++---
   .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +
   10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +0 -0
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@
   config DRM_VERISILICON_DC
   	tristate "DRM Support for Verisilicon DC-series display

controllers"
   depends on DRM && COMMON_CLK

drivers/gpu/drm/verisilicon/Kconfig +1 -1
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST
   	select DRM_BRIDGE_CONNECTOR
   	select DRM_CLIENT_SELECTION
   	select DRM_DISPLAY_HELPER
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -5
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,
   			VSDC_DISP_PANEL_CONFIG_CLK_EN);
   	regmap_set_bits(dc->regs,
 VSDC_DISP_PANEL_CONFIG(output),
   			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			
 VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));
 
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(ou

tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT
Quoted 1 line

);

Should the commit operation happen on DC8000/DCUltraLite too? (By writing to DcregFrameBufferConfig0.VALID).

Quoted 7 lines

Many registers written has "Note: This field is double buffered" in the
DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 6 lines

[a] There is no commit operation for DCUltra Lite.
I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a hardware-managed double-buffer status bit: hardware writes 1=PENDING when a new register set is ready and clears to 0=WORKING after the VBLANK copy. Software must never write it, and there is no polling use

It seems to be writable and controls whether register buffering is enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of a VBLANK signal in order to ensure all states are loaded before the next VBLANK", which indicates some kind of "committing write", although the code at [1] seems to indicate that double buffering is only enabled when bit is cleared.

Quoted 8 lines

Anyway this bit should be programmable, and "Software must never write it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h and write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 7 lines
Quoted 5 lines

case in the driver that requires a named constant. For non-config_ex variants, vs_primary_plane_commit() performs no commit operation — VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is set/cleared in the bridge enable/disable paths.

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

maintainer
#11 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 80 lines
Quoted 80 lines
Quoted 52 lines
Quoted 44 lines
Quoted 38 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
    VSDC_DISP_PANEL_CONFIG_CLK_EN); regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output), VSDC_DISP_PANEL_CONFIG_RUNNING);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-
			VSDC_DISP_PANEL_START_RUNNING(output));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_START_RUNNIN

G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_CO
Quoted 2 lines

MMIT
);

Should the commit operation happen on DC8000/DCUltraLite too? (By
writing to DcregFrameBufferConfig0.VALID).

Quoted 8 lines

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 9 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a hardware-managed double-buffer status bit: hardware writes 1=PENDING
when a new register set is ready and clears to 0=WORKING after the
VBLANK copy. Software must never write it, and there is no polling
use

It seems to be writable and controls whether register buffering is enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame
will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of
a VBLANK signal in order to ensure all states are loaded before the next VBLANK", which indicates some kind of "committing write", although
the code at [1] seems to indicate that double buffering is only enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never write
it" contradicts with the MA35D1 TRM.

Quoted 15 lines
Quoted 5 lines

Thanks,
Icenowy

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h and write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 7 lines
Quoted 7 lines

case in the driver that requires a named constant. For non- config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the bit named "VALID", maybe it should be cleared before programming the registers, and set after programming registers, to make the process of programming registers atomic from the perspective of the display controller.

Anyway this should require testing on real hardware to verify.

By the way, I see multiple peripheral drivers for MA35D1 get applied in the torvalds tree, but the device tree is still only a skeleton; when will the device tree be updated?

Thanks,
Icenowy

Quoted 2 lines
Quoted 2 lines

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

author
#12 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 104 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 80 lines
Quoted 80 lines
Quoted 52 lines
Quoted 44 lines
Quoted 38 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
    VSDC_DISP_PANEL_CONFIG_CLK_EN); regmap_set_bits(dc->regs,
VSDC_DISP_PANEL_CONFIG(output),
    VSDC_DISP_PANEL_CONFIG_RUNNING);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-
			VSDC_DISP_PANEL_START_RUNNING(output));
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_START_RUNNIN

G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_EX_CO
Quoted 2 lines

MMIT
);

Should the commit operation happen on DC8000/DCUltraLite too? (By
writing to DcregFrameBufferConfig0.VALID).

Quoted 8 lines

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

I suggest create a static function for commit -- write to the corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 9 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a hardware-managed double-buffer status bit: hardware writes 1=PENDING
when a new register set is ready and clears to 0=WORKING after the
VBLANK copy. Software must never write it, and there is no polling
use

It seems to be writable and controls whether register buffering is enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame
will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of
a VBLANK signal in order to ensure all states are loaded before the next VBLANK", which indicates some kind of "committing write", although
the code at [1] seems to indicate that double buffering is only enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never write
it" contradicts with the MA35D1 TRM.

Quoted 15 lines
Quoted 5 lines

Thanks,
Icenowy

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h and write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 7 lines
Quoted 7 lines

case in the driver that requires a named constant. For non- config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the bit named "VALID", maybe it should be cleared before programming the registers, and set after programming registers, to make the process of programming registers atomic from the perspective of the display controller.

Quoted 8 lines

Anyway this should require testing on real hardware to verify.

By the way, I see multiple peripheral drivers for MA35D1 get applied in the torvalds tree, but the device tree is still only a skeleton; when will the device tree be updated?

Thanks,
Icenowy

Thanks for pointing this out. I’ll perform tests on real hardware since I haven’t used this bit before.

As for the device tree, we plan to update it comprehensively after completing several major IPs, with the goal of releasing the update later this year.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

maintainer
#13 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 134 lines · 在 2026-05-12二的 18:59 +0800,Joey Lu写道:
Quoted 123 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 95 lines
Quoted 95 lines
Quoted 59 lines
Quoted 55 lines
Quoted 42 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
     VSDC_DISP_PANEL_CONFIG_CLK_EN); regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output), VSDC_DISP_PANEL_CONFIG_RUNNING);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-

VSDC_DISP_PANEL_START_RUNNING(ou
tput));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

-

			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_START_RU

NNIN
G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_E
Quoted 3 lines

X_CO
MMIT
);

Should the commit operation happen on DC8000/DCUltraLite too?
(By
writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

Quoted 4 lines

I suggest create a static function for commit -- write to the
corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 11 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a
hardware-managed double-buffer status bit: hardware writes 1=PENDING
when a new register set is ready and clears to 0=WORKING after
the
VBLANK copy. Software must never write it, and there is no polling
use

It seems to be writable and controls whether register buffering is
enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame
will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of
a VBLANK signal in order to ensure all states are loaded before the
next VBLANK", which indicates some kind of "committing write", although
the code at [1] seems to indicate that double buffering is only enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never
write
it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

Quoted 15 lines
Quoted 2 lines

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h and
write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 8 lines
Quoted 8 lines

case in the driver that requires a named constant. For non- config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is
set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the bit
named "VALID", maybe it should be cleared before programming the registers, and set after programming registers, to make the process of
programming registers atomic from the perspective of the display controller.

Anyway this should require testing on real hardware to verify.

Quoted 8 lines

By the way, I see multiple peripheral drivers for MA35D1 get applied in
the torvalds tree, but the device tree is still only a skeleton; when
will the device tree be updated?

Thanks,
Icenowy

Quoted 7 lines

Thanks for pointing this out. I’ll perform tests on real hardware since
I haven’t used this bit before.

As for the device tree, we plan to update it comprehensively after completing several major IPs, with the goal of releasing the update later this year.

Well I bought a MA35D1 board (MYIR MYB-LMA35 + RGB LCD) earlier this year (and this is where I got the MA35D1 identification register values). Hope I can have a chance to test this driver by myself.

As MMC, Ethernet and USB support is all applied, maybe it's already worthy to update the device tree ;-)

Thanks,
Icenowy

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

author
#14 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 144 lines · Icenowy Zheng
Quoted 132 lines · 在 2026-05-12二的 18:59 +0800,Joey Lu写道:
Quoted 123 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 95 lines
Quoted 95 lines
Quoted 59 lines
Quoted 55 lines
Quoted 42 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
     VSDC_DISP_PANEL_CONFIG_CLK_EN); regmap_set_bits(dc->regs,
VSDC_DISP_PANEL_CONFIG(output),
     VSDC_DISP_PANEL_CONFIG_RUNNING);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -2
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-

VSDC_DISP_PANEL_START_RUNNING(ou
tput));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

-

			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_START_RU

NNIN
G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONFIG_E
Quoted 3 lines

X_CO
MMIT
);

Should the commit operation happen on DC8000/DCUltraLite too?
(By
writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

Quoted 4 lines

I suggest create a static function for commit -- write to the
corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 11 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3)) is a
hardware-managed double-buffer status bit: hardware writes 1=PENDING
when a new register set is ready and clears to 0=WORKING after
the
VBLANK copy. Software must never write it, and there is no polling
use

It seems to be writable and controls whether register buffering is
enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a frame
will always start with a valid working set if this register is programmed last, which reduces the need for SW to wait for the start of
a VBLANK signal in order to ensure all states are loaded before the
next VBLANK", which indicates some kind of "committing write", although
the code at [1] seems to indicate that double buffering is only enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never
write
it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

Quoted 15 lines
Quoted 2 lines

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h and
write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 8 lines
Quoted 8 lines

case in the driver that requires a named constant. For non- config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4)) is
set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the bit
named "VALID", maybe it should be cleared before programming the registers, and set after programming registers, to make the process of
programming registers atomic from the perspective of the display controller.

Anyway this should require testing on real hardware to verify.

Quoted 8 lines

By the way, I see multiple peripheral drivers for MA35D1 get applied in
the torvalds tree, but the device tree is still only a skeleton; when
will the device tree be updated?

Thanks,
Icenowy

Quoted 7 lines

Thanks for pointing this out. I’ll perform tests on real hardware since
I haven’t used this bit before.

As for the device tree, we plan to update it comprehensively after completing several major IPs, with the goal of releasing the update later this year.

Well I bought a MA35D1 board (MYIR MYB-LMA35 + RGB LCD) earlier this year (and this is where I got the MA35D1 identification register values). Hope I can have a chance to test this driver by myself.

Quoted 5 lines

As MMC, Ethernet and USB support is all applied, maybe it's already worthy to update the device tree ;-)

Thanks,
Icenowy

Yes you can!

I have performed hardware validation on the MA35D1 and found that this bit acts as a manual latch for the shadow registers rather than an auto-clearing trigger, which clarifies the slightly ambiguous description in the TRM.

Following your suggestion, I will align the implementation with ESWIN's DC8000 logic: setting the VALID bit at atomic_begin and clearing it at atomic_flush. My tests confirm this allows the hardware to latch the plane configuration correctly while avoiding the blank screen issues observed with other configurations.

I am preparing the v2 patchset with this change, along with the requested commit splits, and will submit it shortly.🙂

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

maintainer
#15 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 190 lines · 在 2026-05-15五的 14:25 +0800,Joey Lu写道:
Quoted 174 lines · Icenowy Zheng
Quoted 163 lines · 在 2026-05-12二的 18:59 +0800,Joey Lu写道:
Quoted 156 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 114 lines
Quoted 114 lines
Quoted 68 lines
Quoted 63 lines
Quoted 48 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
      VSDC_DISP_PANEL_CONFIG_CLK_E N);
      regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output), VSDC_DISP_PANEL_CONFIG_RUNNI NG);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,
-
VSDC_DISP_PANEL_START_RUNNIN
G(ou
tput));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

-
VSDC_DISP_PANEL_CONFIG_EX_CO
MMIT);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_STAR

T_RU
NNIN
G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONF
Quoted 4 lines

IG_E
X_CO
MMIT
);

Should the commit operation happen on
DC8000/DCUltraLite
too?
(By
writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

Quoted 5 lines

I suggest create a static function for commit -- write to
the
corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 14 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3))
is a
hardware-managed double-buffer status bit: hardware writes
1=PENDING
when a new register set is ready and clears to 0=WORKING after
the
VBLANK copy. Software must never write it, and there is no
polling
use

It seems to be writable and controls whether register buffering
is
enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a
frame
will always start with a valid working set if this register is
programmed last, which reduces the need for SW to wait for the
start of
a VBLANK signal in order to ensure all states are loaded before
the
next VBLANK", which indicates some kind of "committing write",
although
the code at [1] seems to indicate that double buffering is only
enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never
write
it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

Quoted 18 lines
Quoted 2 lines

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h
and
write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 10 lines
Quoted 10 lines

case in the driver that requires a named constant. For non-
config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4))
is
set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the
bit
named "VALID", maybe it should be cleared before programming the
registers, and set after programming registers, to make the process
of
programming registers atomic from the perspective of the display
controller.

Anyway this should require testing on real hardware to verify.

By the way, I see multiple peripheral drivers for MA35D1 get applied in
the torvalds tree, but the device tree is still only a skeleton;
when
will the device tree be updated?

Quoted 2 lines

Thanks,
Icenowy

Thanks for pointing this out. I’ll perform tests on real hardware since
I haven’t used this bit before.

Quoted 5 lines

As for the device tree, we plan to update it comprehensively after
completing several major IPs, with the goal of releasing the update
later this year.

Well I bought a MA35D1 board (MYIR MYB-LMA35 + RGB LCD) earlier this
year (and this is where I got the MA35D1 identification register values). Hope I can have a chance to test this driver by myself.

Quoted 5 lines

As MMC, Ethernet and USB support is all applied, maybe it's already worthy to update the device tree ;-)

Thanks,
Icenowy

Yes you can!

I have performed hardware validation on the MA35D1 and found that this
bit acts as a manual latch for the shadow registers rather than an auto-clearing trigger, which clarifies the slightly ambiguous description in the TRM.

Quoted 3 lines

Following your suggestion, I will align the implementation with ESWIN's
DC8000 logic: setting the VALID bit at atomic_begin and clearing it

Ah do you mean clearing it at begin and setting it at flush?

In the Eswin driver (which seems to be based on reference code by Verisilicon, I saw similar driver code for DC8200), dc_hw_enable_shadow_register() clears VALID bit when enable is true, and all register setting sequences calls that function with enable = true before setting and enable = false after setting.

In addition, considering this bit is called "VALID" instead of "INVALID", I think it represents that the DC will apply the new setting when it's set and keep the current setting when it's cleared, so I think it should be cleared before modeset sequence and be set after modeset sequence.

Thanks,
Icenowy

Quoted 10 lines

at
atomic_flush. My tests confirm this allows the hardware to latch the plane configuration correctly while avoiding the blank screen issues observed with other configurations.

I am preparing the v2 patchset with this change, along with the requested commit splits, and will submit it shortly.🙂

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

author
#16 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 200 lines · Icenowy Zheng
Quoted 188 lines · 在 2026-05-15五的 14:25 +0800,Joey Lu写道:
Quoted 174 lines · Icenowy Zheng
Quoted 163 lines · 在 2026-05-12二的 18:59 +0800,Joey Lu写道:
Quoted 156 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 114 lines
Quoted 114 lines
Quoted 68 lines
Quoted 63 lines
Quoted 48 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
      VSDC_DISP_PANEL_CONFIG_CLK_E
N);
      regmap_set_bits(dc->regs,
VSDC_DISP_PANEL_CONFIG(output),
      VSDC_DISP_PANEL_CONFIG_RUNNI
NG);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,
-
VSDC_DISP_PANEL_START_RUNNIN
G(ou
tput));

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

-
VSDC_DISP_PANEL_CONFIG_EX_CO
MMIT);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_STAR

T_RU
NNIN
G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONF
Quoted 4 lines

IG_E
X_CO
MMIT
);

Should the commit operation happen on
DC8000/DCUltraLite
too?
(By
writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

Quoted 5 lines

I suggest create a static function for commit -- write to
the
corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 14 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3))
is a
hardware-managed double-buffer status bit: hardware writes
1=PENDING
when a new register set is ready and clears to 0=WORKING after
the
VBLANK copy. Software must never write it, and there is no
polling
use

It seems to be writable and controls whether register buffering
is
enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a
frame
will always start with a valid working set if this register is
programmed last, which reduces the need for SW to wait for the
start of
a VBLANK signal in order to ensure all states are loaded before
the
next VBLANK", which indicates some kind of "committing write",
although
the code at [1] seems to indicate that double buffering is only
enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never
write
it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

Quoted 18 lines
Quoted 2 lines

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h
and
write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 10 lines
Quoted 10 lines

case in the driver that requires a named constant. For non-
config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4))
is
set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the
bit
named "VALID", maybe it should be cleared before programming the
registers, and set after programming registers, to make the process
of
programming registers atomic from the perspective of the display
controller.

Anyway this should require testing on real hardware to verify.

By the way, I see multiple peripheral drivers for MA35D1 get applied in
the torvalds tree, but the device tree is still only a skeleton;
when
will the device tree be updated?

Quoted 2 lines

Thanks,
Icenowy

Thanks for pointing this out. I’ll perform tests on real hardware since
I haven’t used this bit before.

Quoted 5 lines

As for the device tree, we plan to update it comprehensively after
completing several major IPs, with the goal of releasing the update
later this year.

Well I bought a MA35D1 board (MYIR MYB-LMA35 + RGB LCD) earlier this
year (and this is where I got the MA35D1 identification register values). Hope I can have a chance to test this driver by myself.

Quoted 5 lines

As MMC, Ethernet and USB support is all applied, maybe it's already worthy to update the device tree ;-)

Thanks,
Icenowy

Yes you can!

I have performed hardware validation on the MA35D1 and found that this
bit acts as a manual latch for the shadow registers rather than an auto-clearing trigger, which clarifies the slightly ambiguous description in the TRM.

Quoted 3 lines

Following your suggestion, I will align the implementation with ESWIN's
DC8000 logic: setting the VALID bit at atomic_begin and clearing it

Ah do you mean clearing it at begin and setting it at flush?

In the Eswin driver (which seems to be based on reference code by Verisilicon, I saw similar driver code for DC8200), dc_hw_enable_shadow_register() clears VALID bit when enable is true, and all register setting sequences calls that function with enable = true before setting and enable = false after setting.

Quoted 8 lines

In addition, considering this bit is called "VALID" instead of "INVALID", I think it represents that the DC will apply the new setting when it's set and keep the current setting when it's cleared, so I think it should be cleared before modeset sequence and be set after modeset sequence.

Thanks,
Icenowy

Thanks for pointing that out. To clarify, the TRM defines the states for this bit as:
1: PENDING (Shadow registers are locked; incoming CPU writes are held in the shadow buffer). 0: WORKING (Shadow registers are unfrozen/live; configuration is committed).

Regarding the Eswin reference, dc_hw_enable_shadow_register(hw, false) actually writes a 1 to isolate the registers during a batch update, and then transitions back to true (0) to flush them out. My hardware test confirms this sequence:

- atomic_begin: We set VALID = 1. This safely freezes the current scanout configuration so we can update multiple registers (like frame addresses and pitches) without mid-frame tearing.
- atomic_update: We write the new register values safely into the frozen shadow space.
- atomic_flush: We clear VALID = 0. This releases the shadow lock, triggering the hardware to latch the whole batch atomically.

If we reverse this logic—leaving the bit at 1 after the flush — the hardware remains permanently stuck in the PENDING state, waiting to be unfrozen, which starves the display engine and results in the blank screen behavior I observed.

Quoted 10 lines
Quoted 10 lines

at
atomic_flush. My tests confirm this allows the hardware to latch the plane configuration correctly while avoiding the blank screen issues observed with other configurations.

I am preparing the v2 patchset with this change, along with the requested commit splits, and will submit it shortly.🙂

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

#17 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 207 lines · 于 2026年5月15日 GMT+08:00 17:08:25,Joey Lu <[email protected]> 写道:
Quoted 205 lines · Icenowy Zheng
Quoted 187 lines · 在 2026-05-15五的 14:25 +0800,Joey Lu写道:
Quoted 173 lines · Icenowy Zheng
Quoted 162 lines · 在 2026-05-12二的 18:59 +0800,Joey Lu写道:
Quoted 155 lines · Icenowy Zheng

在 2026-05-12二的 17:06 +0800,Joey Lu写道:

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

Quoted 113 lines
Quoted 113 lines
Quoted 67 lines
Quoted 62 lines
Quoted 47 lines
drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void

vs_bridge_enable_common(struct
vs_crtc *crtc,
      VSDC_DISP_PANEL_CONFIG_CLK_E
N);
      regmap_set_bits(dc->regs,
VSDC_DISP_PANEL_CONFIG(output),
      VSDC_DISP_PANEL_CONFIG_RUNNI
NG);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-			

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -1
-	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,
-
VSDC_DISP_PANEL_START_RUNNIN
G(ou

tput));
      -	regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc-

Quoted 1 line

id),

-
VSDC_DISP_PANEL_CONFIG_EX_CO
MMIT);

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				

VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_START,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_STAR

T_RU
NNIN
G(ou
tput
));

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -0
+
+		regmap_set_bits(dc->regs,

VSDC_DISP_PANEL_CONFIG_EX(crtc->id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -0
+				VSDC_DISP_PANEL_CONF
Quoted 4 lines

IG_E
X_CO
MMIT
);

Should the commit operation happen on
DC8000/DCUltraLite
too?
(By
writing to DcregFrameBufferConfig0.VALID).

Many registers written has "Note: This field is double buffered" in
the
DCUltraLite documentation.

Quoted 5 lines

I suggest create a static function for commit -- write to
the
corresponding commit bit on DC8200, and write to DcregFrameBufferConfig0.VALID on DC8000/DCUltraLite.

Quoted 14 lines

[a] There is no commit operation for DCUltra Lite. I'll not add a VSDC_FB_CONFIG_VALID macro. VALID (BIT(3))
is a
hardware-managed double-buffer status bit: hardware writes
1=PENDING
when a new register set is ready and clears to 0=WORKING after
the
VBLANK copy. Software must never write it, and there is no
polling
use

It seems to be writable and controls whether register buffering
is
enabled, see [1].

The description of this bit in MA35D1 TRM says "This ensures a
frame
will always start with a valid working set if this register is
programmed last, which reduces the need for SW to wait for the
start of
a VBLANK signal in order to ensure all states are loaded before
the
next VBLANK", which indicates some kind of "committing write",
although
the code at [1] seems to indicate that double buffering is only
enabled
when bit is cleared.

Anyway this bit should be programmable, and "Software must never
write
it" contradicts with the MA35D1 TRM.

Thanks,
Icenowy

Quoted 18 lines
Quoted 2 lines

[1]
https://github.com/rockos-riscv/rockos-kernel/blob/rockos-v6.6.y/drivers/gpu/drm/eswin/es_dc_hw.c#L993

Thank you for the correction. I'll add
#define VSDC_FB_CONFIG_VALID BIT(3) to vs_primary_plane_regs.h
and
write it in vs_primary_plane_commit() for non-config_ex variants.

Quoted 10 lines
Quoted 10 lines

case in the driver that requires a named constant. For non-
config_ex
variants, vs_primary_plane_commit() performs no commit operation —
VSDC_FB_CONFIG_ENABLE (OUTPUT, BIT(0)) is set in vs_crtc_atomic_enable() and VSDC_FB_CONFIG_RESET (BIT(4))
is
set/cleared in the bridge enable/disable paths.

Well according to the driver code for DC8000 from Eswin, and the
bit
named "VALID", maybe it should be cleared before programming the
registers, and set after programming registers, to make the process
of
programming registers atomic from the perspective of the display
controller.

Anyway this should require testing on real hardware to verify.

By the way, I see multiple peripheral drivers for MA35D1 get applied in
the torvalds tree, but the device tree is still only a skeleton;
when
will the device tree be updated?

Quoted 2 lines

Thanks,
Icenowy

Thanks for pointing this out. I’ll perform tests on real hardware since
I haven’t used this bit before.

Quoted 5 lines

As for the device tree, we plan to update it comprehensively after
completing several major IPs, with the goal of releasing the update
later this year.

Well I bought a MA35D1 board (MYIR MYB-LMA35 + RGB LCD) earlier this
year (and this is where I got the MA35D1 identification register values). Hope I can have a chance to test this driver by myself.

Quoted 5 lines

As MMC, Ethernet and USB support is all applied, maybe it's already worthy to update the device tree ;-)

Thanks,
Icenowy

Yes you can!

I have performed hardware validation on the MA35D1 and found that this
bit acts as a manual latch for the shadow registers rather than an auto-clearing trigger, which clarifies the slightly ambiguous description in the TRM.

Quoted 3 lines

Following your suggestion, I will align the implementation with ESWIN's
DC8000 logic: setting the VALID bit at atomic_begin and clearing it

Ah do you mean clearing it at begin and setting it at flush?

In the Eswin driver (which seems to be based on reference code by Verisilicon, I saw similar driver code for DC8200), dc_hw_enable_shadow_register() clears VALID bit when enable is true, and all register setting sequences calls that function with enable = true before setting and enable = false after setting.

In addition, considering this bit is called "VALID" instead of "INVALID", I think it represents that the DC will apply the new setting when it's set and keep the current setting when it's cleared, so I think it should be cleared before modeset sequence and be set after modeset sequence.

Quoted 5 lines
Quoted 2 lines

Thanks,
Icenowy

Thanks for pointing that out. To clarify, the TRM defines the states for this bit as:
1: PENDING (Shadow registers are locked; incoming CPU writes are held in the shadow buffer). 0: WORKING (Shadow registers are unfrozen/live; configuration is committed).

This sounds reasonable, thanks for the clarification.

Sorry for me to be too lazy to verify it in HW.

Thanks,
Icenowy

Quoted 19 lines

Regarding the Eswin reference, dc_hw_enable_shadow_register(hw, false) actually writes a 1 to isolate the registers during a batch update, and then transitions back to true (0) to flush them out. My hardware test confirms this sequence:

- atomic_begin: We set VALID = 1. This safely freezes the current scanout configuration so we can update multiple registers (like frame addresses and pitches) without mid-frame tearing.
- atomic_update: We write the new register values safely into the frozen shadow space.
- atomic_flush: We clear VALID = 0. This releases the shadow lock, triggering the hardware to latch the whole batch atomically.

If we reverse this logic—leaving the bit at 1 after the flush — the hardware remains permanently stuck in the PENDING state, waiting to be unfrozen, which starves the display engine and results in the blank screen behavior I observed.

Quoted 10 lines
Quoted 10 lines

at
atomic_flush. My tests confirm this allows the hardware to latch the plane configuration correctly while avoiding the blank screen issues observed with other configurations.

I am preparing the v2 patchset with this change, along with the requested commit splits, and will submit it shortly.🙂

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

#18 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

In reply to Joey Lu
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] The primary plane is never logically disabled in hardware for the DCUltra Lite variant, leading to…

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] The primary plane is never logically disabled in hardware for the DCUltra Lite variant, leading to a Use-After-Free condition.
- [High] The primary plane is enabled before its DMA address and size are configured, causing a hardware race condition.
- [High] The DCUltra Lite IRQ handler fails to acknowledge interrupts and unconditionally returns IRQ_HANDLED, which can cause an interrupt storm.
- [High] Pre-existing NULL pointer dereference in early IRQ handling due to incorrect initialization order.
--

commit 522901c8020d5fe12ddd26c3af8e4d282c2fd2fd
Author: Joey Lu <[email protected]>
Subject: drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

This commit adds support for the Nuvoton MA35D1 DCUltra Lite display controller to the verisilicon DRM driver. It introduces a vs_dc_info platform data structure to handle architectural differences between the DC8000 and DCUltra Lite variants.

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index dad9967bc10b8..82a6a26f6d817 100644

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc.c static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 65

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc.c +6 -0
@@ -33,6 +57,13 @@ static irqreturn_t vs_dc_irq_handler(int irq, void *private)
 	struct vs_dc *dc = private;
 	u32 irqs;
 
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);
+		if (irqs & BIT(0))
+			vs_drm_handle_irq(dc, VSDC_TOP_IRQ_VSYNC(0));
+		return IRQ_HANDLED;
+	}

Does this missing ACK cause an interrupt storm?

The DCUltra Lite code path reads the interrupt status but does not appear to write back to clear the pending hardware interrupt.

Additionally, unconditionally returning IRQ_HANDLED might prevent the spurious interrupt detector from disabling a faulty IRQ line.

This isn't a bug introduced by this patch, but could this lead to a NULL pointer dereference during boot?

In vs_dc_probe(), the IRQ handler is requested before initialization:

	ret = devm_request_irq(dev, irq, vs_dc_irq_handler, 0,
			       dev_name(dev), dc);
	...
	ret = vs_drm_initialize(dc, pdev);

If a leftover hardware interrupt fires immediately, vs_dc_irq_handler() calls vs_drm_handle_irq(), which accesses dc->drm_dev->crtcs[i].

Since dc->drm_dev is allocated inside vs_drm_initialize(), it appears an early interrupt would dereference a NULL pointer.

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
index 1f2be41ae496c..197d5d683e224 100644

[ ... ]

drivers/gpu/drm/verisilicon/vs_primary_plane.c static void vs_primary_plane_atomic_disable(struct drm_plane *plane, · line 99

Quoted 12 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +3 -2
@@ -88,8 +91,9 @@ static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
 	unsigned int output = vcrtc->id;
 	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
 
 	vs_primary_plane_commit(dc, output);
 }

If has_config_ex is false for DCUltra Lite, how is the primary plane disabled in hardware here?

Since the disable sequence is skipped, will the display controller continue fetching from the framebuffer memory after it is freed by the DRM core? This could lead to a use-after-free by the DMA engine.

[ ... ]

Quoted 13 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +5 -0
@@ -126,6 +130,11 @@ static void vs_primary_plane_atomic_update(struct drm_plane *plane,
 			   VSDC_FB_CONFIG_UV_SWIZZLE_EN,
 			   vs_state->format.uv_swizzle);
 
+	/* DCUltra Lite requires explicit enable/reset bits in FB_CONFIG */
+	if (!dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+				VSDC_FB_CONFIG_ENABLE | VSDC_FB_CONFIG_RESET);
+
 	dma_addr = vs_fb_get_dma_addr(fb, &state->src);
 
 	regmap_write(dc->regs, VSDC_FB_ADDRESS(output),

drivers/gpu/drm/verisilicon/vs_primary_plane.c static void vs_primary_plane_atomic_update(struct drm_plane *plane, · line 143

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -133,16 +142,18 @@ static void vs_primary_plane_atomic_update(struct drm_plane *plane,
 	regmap_write(dc->regs, VSDC_FB_STRIDE(output),
 		     fb->pitches[0]);

Could enabling the plane before configuring its DMA address and size cause the hardware to fetch from uninitialized or stale memory?

Since DCUltra Lite does not use a shadow register commit mechanism, it seems the address and stride should be programmed before setting the VSDC_FB_CONFIG_ENABLE bit to prevent out-of-bounds memory accesses.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#19 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

In reply to Joey Lu

Hi,

instead of this if-else branchery, I strongly recommend to add a new file with a new mode-setting pipeline for the new chipset.  You can share existing helpers where possible, and implement variants where chips differ.  It's a bit more code, but will be a lot easier to maintain in the future.

See ast and mgag200 for example. Both drivers support various revisions of their chipset, where each rev has its oddities.

Best regards
Thomas

Am 11.05.26 um 09:51 schrieb Joey Lu:

Quoted 592 lines

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display controller, which is a previous generation of the DC8000 series. While the general register layout is similar to the DC8000, there are several key differences that require per-variant handling in the driver.

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe per-IP-variant capabilities, and use it throughout the driver to select the correct code paths at runtime.

Key differences between DC8000 and DCUltra Lite handled:

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static platform data instead of reading model/revision/customer_id from HW.

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT), 0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite omits all of these and instead uses enable/reset bits in FB_CONFIG (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts when PANEL_CONFIG.RUNNING is set; no separate multi-display sync start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) /

    0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

5. Different clock/reset topology: DCUltra Lite requires only "core" (bus gate) and "pix0" (pixel divider) clocks with no reset lines managed by the driver. DC8000 needs core/axi/ahb clocks and three resets.

6. Single output only: DCUltra Lite has one display output; per-output index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table, extend Kconfig to allow building on ARCH_MA35 platforms, and expose vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
  drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
  drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++--
  drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +-
  drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++------
  drivers/gpu/drm/verisilicon/vs_dc.h           |   1 +
  drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++-
  drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +-
  drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++
  .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++---
  .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +
  10 files changed, 187 insertions(+), 74 deletions(-)
drivers/gpu/drm/verisilicon/Kconfig +1 -1
index 7cce86ec8603..295d246eb4b4 100644
@@ -2,7 +2,7 @@
  config DRM_VERISILICON_DC
  	tristate "DRM Support for Verisilicon DC-series display controllers"
  	depends on DRM && COMMON_CLK
-	depends on RISCV || COMPILE_TEST
+	depends on RISCV || ARCH_MA35 || COMPILE_TEST
  	select DRM_BRIDGE_CONNECTOR
  	select DRM_CLIENT_SELECTION
  	select DRM_DISPLAY_HELPER
drivers/gpu/drm/verisilicon/vs_bridge.c +17 -11
index 7a93049368db..225af322de32 100644
@@ -164,13 +164,16 @@ static void vs_bridge_enable_common(struct vs_crtc *crtc,
  			VSDC_DISP_PANEL_CONFIG_CLK_EN);
  	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
  			VSDC_DISP_PANEL_CONFIG_RUNNING);
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
-			VSDC_DISP_PANEL_START_RUNNING(output));
 
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC);
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_START,
+				VSDC_DISP_PANEL_START_RUNNING(output));
+
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}
  }
 
  static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,
@@ -228,14 +231,17 @@ static void vs_bridge_atomic_disable(struct drm_bridge *bridge,
  	struct vs_dc *dc = crtc->dc;
  	unsigned int output = crtc->id;
 
-	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
-			  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
-			  VSDC_DISP_PANEL_START_RUNNING(output));
  	regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_CONFIG(output),
  			  VSDC_DISP_PANEL_CONFIG_RUNNING);
 
-	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex) {
+		regmap_clear_bits(dc->regs, VSDC_DISP_PANEL_START,
+				  VSDC_DISP_PANEL_START_MULTI_DISP_SYNC |
+				  VSDC_DISP_PANEL_START_RUNNING(output));
+
+		regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(crtc->id),
+				VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	}
  }
 
  static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {
drivers/gpu/drm/verisilicon/vs_crtc.c +11 -2
index 9080344398ca..2f3e6d41c657 100644
@@ -18,6 +18,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"
  #include "vs_plane.h"
 
  static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -132,7 +133,11 @@ static int vs_crtc_enable_vblank(struct drm_crtc *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN, VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, BIT(0));
+	else
+		regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				VSDC_TOP_IRQ_VSYNC(vcrtc->id));
 
  	return 0;
  }
@@ -142,7 +147,11 @@ static void vs_crtc_disable_vblank(struct drm_crtc *crtc)
  	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN, VSDC_TOP_IRQ_VSYNC(vcrtc->id));
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE)
+		regmap_write(dc->regs, VSDC_DISP_IRQ_EN, 0);
+	else
+		regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+				  VSDC_TOP_IRQ_VSYNC(vcrtc->id));
  }
 
  static const struct drm_crtc_funcs vs_crtc_funcs = {
drivers/gpu/drm/verisilicon/vs_dc.c +90 -39
index dad9967bc10b..82a6a26f6d81 100644
@@ -9,21 +9,45 @@
  #include <linux/of_graph.h>
 
  #include "vs_crtc.h"
+#include "vs_crtc_regs.h"
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
  #include "vs_hwdb.h"
 
-static const struct regmap_config vs_dc_regmap_cfg = {
+static const struct regmap_config vs_dc8000_regmap_cfg = {
  	.reg_bits = 32,
  	.val_bits = 32,
  	.reg_stride = sizeof(u32),
-	/* VSDC_OVL_CONFIG_EX(1) */
  	.max_register = 0x2544,
  };
 
+static const struct regmap_config vs_dcultra_lite_regmap_cfg = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = sizeof(u32),
+	.max_register = 0x2000,
+};
+
+static const struct vs_dc_info vs_dc8000_info = {
+	.family = VS_DC_FAMILY_DC8000,
+	.has_chip_id = true,
+	.has_config_ex = true,
+	.regmap_cfg = &vs_dc8000_regmap_cfg,
+};
+
+static const struct vs_dc_info vs_dcultra_lite_info = {
+	.family = VS_DC_FAMILY_DCULTRA_LITE,
+	.display_count = 1,
+	.has_chip_id = false,
+	.has_config_ex = false,
+	.regmap_cfg = &vs_dcultra_lite_regmap_cfg,
+	.formats = &vs_formats_no_yuv444,
+};
+
  static const struct of_device_id vs_dc_driver_dt_match[] = {
-	{ .compatible = "verisilicon,dc" },
+	{ .compatible = "verisilicon,dc", .data = &vs_dc8000_info },
+	{ .compatible = "nuvoton,ma35d1-dcu", .data = &vs_dcultra_lite_info },
  	{},
  };
  MODULE_DEVICE_TABLE(of, vs_dc_driver_dt_match);
@@ -33,6 +57,13 @@ static irqreturn_t vs_dc_irq_handler(int irq, void *private)
  	struct vs_dc *dc = private;
  	u32 irqs;
 
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);
+		if (irqs & BIT(0))
+			vs_drm_handle_irq(dc, VSDC_TOP_IRQ_VSYNC(0));
+		return IRQ_HANDLED;
+	}
+
  	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
 
  	vs_drm_handle_irq(dc, irqs);
@@ -43,6 +74,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void *private)
  static int vs_dc_probe(struct platform_device *pdev)
  {
  	struct device *dev = &pdev->dev;
+	const struct vs_dc_info *info;
  	struct vs_dc *dc;
  	void __iomem *regs;
  	unsigned int port_count, i;
@@ -55,6 +87,10 @@ static int vs_dc_probe(struct platform_device *pdev)
  		return -ENODEV;
  	}
 
+	info = of_device_get_match_data(dev);
+	if (!info)
+		return -ENODEV;
+
  	port_count = of_graph_get_port_count(dev->of_node);
  	if (!port_count) {
  		dev_err(dev, "can't find DC downstream ports\n");
@@ -75,15 +111,31 @@ static int vs_dc_probe(struct platform_device *pdev)
  	if (!dc)
  		return -ENOMEM;
 
-	dc->rsts[0].id = "core";
-	dc->rsts[1].id = "axi";
-	dc->rsts[2].id = "ahb";
+	dc->info = info;
 
-	ret = devm_reset_control_bulk_get_optional_shared(dev, VSDC_RESET_COUNT,
-							  dc->rsts);
-	if (ret) {
-		dev_err(dev, "can't get reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		dc->rsts[0].id = "core";
+		dc->rsts[1].id = "axi";
+		dc->rsts[2].id = "ahb";
+
+		ret = devm_reset_control_bulk_get_optional_shared(dev,
+				VSDC_RESET_COUNT, dc->rsts);
+		if (ret) {
+			dev_err(dev, "can't get reset lines\n");
+			return ret;
+		}
+
+		dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+		if (IS_ERR(dc->axi_clk)) {
+			dev_err(dev, "can't get axi clock\n");
+			return PTR_ERR(dc->axi_clk);
+		}
+
+		dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
+		if (IS_ERR(dc->ahb_clk)) {
+			dev_err(dev, "can't get ahb clock\n");
+			return PTR_ERR(dc->ahb_clk);
+		}
  	}
 
  	dc->core_clk = devm_clk_get_enabled(dev, "core");
@@ -92,28 +144,18 @@ static int vs_dc_probe(struct platform_device *pdev)
  		return PTR_ERR(dc->core_clk);
  	}
 
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
-	if (IS_ERR(dc->axi_clk)) {
-		dev_err(dev, "can't get axi clock\n");
-		return PTR_ERR(dc->axi_clk);
-	}
-
-	dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
-	if (IS_ERR(dc->ahb_clk)) {
-		dev_err(dev, "can't get ahb clock\n");
-		return PTR_ERR(dc->ahb_clk);
-	}
-
  	irq = platform_get_irq(pdev, 0);
  	if (irq < 0) {
  		dev_err(dev, "can't get irq\n");
  		return irq;
  	}
 
-	ret = reset_control_bulk_deassert(VSDC_RESET_COUNT, dc->rsts);
-	if (ret) {
-		dev_err(dev, "can't deassert reset lines\n");
-		return ret;
+	if (info->family == VS_DC_FAMILY_DC8000) {
+		ret = reset_control_bulk_deassert(VSDC_RESET_COUNT, dc->rsts);
+		if (ret) {
+			dev_err(dev, "can't deassert reset lines\n");
+			return ret;
+		}
  	}
 
  	regs = devm_platform_ioremap_resource(pdev, 0);
@@ -123,23 +165,30 @@ static int vs_dc_probe(struct platform_device *pdev)
  		goto err_rst_assert;
  	}
 
-	dc->regs = devm_regmap_init_mmio(dev, regs, &vs_dc_regmap_cfg);
+	dc->regs = devm_regmap_init_mmio(dev, regs, info->regmap_cfg);
  	if (IS_ERR(dc->regs)) {
  		ret = PTR_ERR(dc->regs);
  		goto err_rst_assert;
  	}
 
-	ret = vs_fill_chip_identity(dc->regs, &dc->identity);
-	if (ret)
-		goto err_rst_assert;
+	if (info->has_chip_id) {
+		ret = vs_fill_chip_identity(dc->regs, &dc->identity);
+		if (ret)
+			goto err_rst_assert;
 
-	dev_info(dev, "Found DC%x rev %x customer %x\n", dc->identity.model,
-		 dc->identity.revision, dc->identity.customer_id);
+		dev_info(dev, "Found DC%x rev %x customer %x\n",
+			 dc->identity.model, dc->identity.revision,
+			 dc->identity.customer_id);
 
-	if (port_count > dc->identity.display_count) {
-		dev_err(dev, "too many downstream ports than HW capability\n");
-		ret = -EINVAL;
-		goto err_rst_assert;
+		if (port_count > dc->identity.display_count) {
+			dev_err(dev, "too many downstream ports than HW capability\n");
+			ret = -EINVAL;
+			goto err_rst_assert;
+		}
+	} else {
+		/* Fill identity from platform data */
+		dc->identity.display_count = info->display_count;
+		dc->identity.formats = info->formats;
  	}
 
  	for (i = 0; i < dc->identity.display_count; i++) {
@@ -168,7 +217,8 @@ static int vs_dc_probe(struct platform_device *pdev)
  	return 0;
 
  err_rst_assert:
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
  	return ret;
  }
 
@@ -180,7 +230,8 @@ static void vs_dc_remove(struct platform_device *pdev)
 
  	dev_set_drvdata(&pdev->dev, NULL);
 
-	reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
+	if (dc->info->family == VS_DC_FAMILY_DC8000)
+		reset_control_bulk_assert(VSDC_RESET_COUNT, dc->rsts);
  }
 
  static void vs_dc_shutdown(struct platform_device *pdev)
drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
index ed1016f18758..f0613519af37 100644
@@ -31,6 +31,7 @@ struct vs_dc {
  	struct clk *pix_clk[VSDC_MAX_OUTPUTS];
  	struct reset_control_bulk_data rsts[VSDC_RESET_COUNT];
 
+	const struct vs_dc_info *info;
  	struct vs_drm_dev *drm_dev;
  	struct vs_chip_identity identity;
  };
drivers/gpu/drm/verisilicon/vs_drm.c +12 -4
index fd259d53f49f..ff0fc6673006 100644
@@ -27,6 +27,7 @@
  #include "vs_dc.h"
  #include "vs_dc_top_regs.h"
  #include "vs_drm.h"
+#include "vs_hwdb.h"
 
  #define DRIVER_NAME	"verisilicon"
  #define DRIVER_DESC	"Verisilicon DC-series display controller driver"
@@ -72,12 +73,19 @@ static struct drm_mode_config_helper_funcs vs_mode_config_helper_funcs = {
  	.atomic_commit_tail = drm_atomic_helper_commit_tail,
  };
 
-static void vs_mode_config_init(struct drm_device *drm)
+static void vs_mode_config_init(struct drm_device *drm, struct vs_dc *dc)
  {
  	drm->mode_config.min_width = 0;
  	drm->mode_config.min_height = 0;
-	drm->mode_config.max_width = 8192;
-	drm->mode_config.max_height = 8192;
+
+	if (dc->info->family == VS_DC_FAMILY_DCULTRA_LITE) {
+		drm->mode_config.max_width = 1920;
+		drm->mode_config.max_height = 1080;
+	} else {
+		drm->mode_config.max_width = 8192;
+		drm->mode_config.max_height = 8192;
+	}
+
  	drm->mode_config.funcs = &vs_mode_config_funcs;
  	drm->mode_config.helper_private = &vs_mode_config_helper_funcs;
  }
@@ -125,7 +133,7 @@ int vs_drm_initialize(struct vs_dc *dc, struct platform_device *pdev)
  	if (ret)
  		return ret;
 
-	vs_mode_config_init(drm);
+	vs_mode_config_init(drm, dc);
 
  	/* Enable connectors polling */
  	drm_kms_helper_poll_init(drm);
drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -1
index 09336af0900a..39402d75d841 100644
@@ -78,7 +78,7 @@ static const u32 vs_formats_array_with_yuv444[] = {
  	/* TODO: non-RGB formats */
  };
 
-static const struct vs_formats vs_formats_no_yuv444 = {
+const struct vs_formats vs_formats_no_yuv444 = {
  	.array = vs_formats_array_no_yuv444,
  	.num = ARRAY_SIZE(vs_formats_array_no_yuv444)
  };
drivers/gpu/drm/verisilicon/vs_hwdb.h +25 -0
index 92192e4fa086..655cf93ca3aa 100644
@@ -14,6 +14,29 @@ struct vs_formats {
  	unsigned int num;
  };
 
+enum vs_dc_family {
+	VS_DC_FAMILY_DC8000,
+	VS_DC_FAMILY_DCULTRA_LITE,
+};
+
+/**
+ * struct vs_dc_info - per-SoC DC platform data
+ * @family:		DC IP family (DC8000, DCUltra Lite, etc.)
+ * @display_count:	number of display outputs (0 = auto-detect from DT/HW)
+ * @has_chip_id:	whether chip identity registers exist
+ * @has_config_ex:	whether CONFIG_EX commit mechanism exists
+ * @regmap_cfg:		regmap configuration for this variant
+ * @formats:		supported pixel formats (NULL = auto-detect from chip ID)
+ */
+struct vs_dc_info {
+	enum vs_dc_family family;
+	u32 display_count;
+	bool has_chip_id;
+	bool has_config_ex;
+	const struct regmap_config *regmap_cfg;
+	const struct vs_formats *formats;
+};
+
  struct vs_chip_identity {
  	u32 model;
  	u32 revision;
@@ -23,6 +46,8 @@ struct vs_chip_identity {
  	const struct vs_formats *formats;
  };
 
+extern const struct vs_formats vs_formats_no_yuv444;
+
  int vs_fill_chip_identity(struct regmap *regs,
  			  struct vs_chip_identity *ident);
 
drivers/gpu/drm/verisilicon/vs_primary_plane.c +27 -16
index 1f2be41ae496..197d5d683e22 100644
@@ -55,8 +55,9 @@ static int vs_primary_plane_atomic_check(struct drm_plane *plane,
 
  static void vs_primary_plane_commit(struct vs_dc *dc, unsigned int output)
  {
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_COMMIT);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_COMMIT);
  }
 
  static void vs_primary_plane_atomic_enable(struct drm_plane *plane,
@@ -69,11 +70,13 @@ static void vs_primary_plane_atomic_enable(struct drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
-	regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
-			   VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
+	if (dc->info->has_config_ex) {
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
+		regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				   VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
+				   VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
+	}
 
  	vs_primary_plane_commit(dc, output);
  }
@@ -88,8 +91,9 @@ static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
  	unsigned int output = vcrtc->id;
  	struct vs_dc *dc = vcrtc->dc;
 
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
+	if (dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+				VSDC_FB_CONFIG_EX_FB_EN);
 
  	vs_primary_plane_commit(dc, output);
  }
@@ -126,6 +130,11 @@ static void vs_primary_plane_atomic_update(struct drm_plane *plane,
  			   VSDC_FB_CONFIG_UV_SWIZZLE_EN,
  			   vs_state->format.uv_swizzle);
 
+	/* DCUltra Lite requires explicit enable/reset bits in FB_CONFIG */
+	if (!dc->info->has_config_ex)
+		regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+				VSDC_FB_CONFIG_ENABLE | VSDC_FB_CONFIG_RESET);
+
  	dma_addr = vs_fb_get_dma_addr(fb, &state->src);
 
  	regmap_write(dc->regs, VSDC_FB_ADDRESS(output),
@@ -133,16 +142,18 @@ static void vs_primary_plane_atomic_update(struct drm_plane *plane,
  	regmap_write(dc->regs, VSDC_FB_STRIDE(output),
  		     fb->pitches[0]);
 
-	regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x, state->crtc_y));
-	regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
-		     VSDC_MAKE_PLANE_POS(state->crtc_x + state->crtc_w,
-					 state->crtc_y + state->crtc_h));
  	regmap_write(dc->regs, VSDC_FB_SIZE(output),
  		     VSDC_MAKE_PLANE_SIZE(state->crtc_w, state->crtc_h));
 
-	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
-		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	if (dc->info->has_config_ex) {
+		regmap_write(dc->regs, VSDC_FB_TOP_LEFT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x, state->crtc_y));
+		regmap_write(dc->regs, VSDC_FB_BOTTOM_RIGHT(output),
+			     VSDC_MAKE_PLANE_POS(state->crtc_x + state->crtc_w,
+						 state->crtc_y + state->crtc_h));
+		regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
+			     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+	}
 
  	vs_primary_plane_commit(dc, output);
  }
drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +2 -0
index cbb125c46b39..288064760b48 100644
@@ -16,6 +16,8 @@
  #define VSDC_FB_STRIDE(n)			(0x1408 + 0x4 * (n))
 
  #define VSDC_FB_CONFIG(n)			(0x1518 + 0x4 * (n))
+#define VSDC_FB_CONFIG_ENABLE			BIT(0)
+#define VSDC_FB_CONFIG_RESET			BIT(4)
  #define VSDC_FB_CONFIG_CLEAR_EN			BIT(8)
  #define VSDC_FB_CONFIG_ROT_MASK			GENMASK(13, 11)
  #define VSDC_FB_CONFIG_ROT(v)			((v) << 11)
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
author
#20 lore raw

Re: [PATCH 2/2] drm/verisilicon: add support for Nuvoton MA35D1 DCUltra Lite display controller

Quoted 8 lines · Thomas Zimmermann

Hi,

instead of this if-else branchery, I strongly recommend to add a new file with a new mode-setting pipeline for the new chipset. You can share existing helpers where possible, and implement variants where chips differ.  It's a bit more code, but will be a lot easier to maintain in the future.

See ast and mgag200 for example. Both drivers support various revisions of their chipset, where each rev has its oddities.

Best regards
Thomas

Thank you for the detailed suggestion.

I see your point and will refactor by adding a new file with a mode-setting pipeline for the chipset, reusing helpers where possible and handling variants as needed.

Quoted 63 lines

Am 11.05.26 um 09:51 schrieb Joey Lu:

Quoted 60 lines

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltra Lite display controller, which is a previous generation of the DC8000 series. While the general register layout is similar to the DC8000, there are several key differences that require per-variant handling in the driver.

Add a vs_dc_info platform data structure (in vs_hwdb.h) to describe per-IP-variant capabilities, and use it throughout the driver to select the correct code paths at runtime.

Key differences between DC8000 and DCUltra Lite handled:

1. No chip identity registers (0x0020-0x0030): DCUltra Lite uses static platform data instead of reading model/revision/customer_id from HW.

2. No CONFIG_EX commit mechanism: DC8000 uses registers at 0x1CC0 (FB_CONFIG_EX), 0x24D8 (FB_TOP_LEFT), 0x24E0 (FB_BOTTOM_RIGHT), 0x2510 (FB_BLEND_CONFIG), 0x2518 (PANEL_CONFIG_EX). DCUltra Lite omits all of these and instead uses enable/reset bits in FB_CONFIG (bit 0 = enable, bit 4 = reset) for direct framebuffer updates.

3. No PANEL_START register (0x1CCC): DCUltra Lite panel output starts when PANEL_CONFIG.RUNNING is set; no separate multi-display sync start register is needed.

4. Different IRQ registers: DCUltra Lite uses 0x147C (IRQ_STA) / 0x1480 (IRQ_EN); DC8000 uses 0x0010 (IRQ_ACK) / 0x0014 (IRQ_EN).

5. Different clock/reset topology: DCUltra Lite requires only "core" (bus gate) and "pix0" (pixel divider) clocks with no reset lines managed by the driver. DC8000 needs core/axi/ahb clocks and three resets.

6. Single output only: DCUltra Lite has one display output; per-output index logic is still in place but display_count is fixed at 1.

7. Reduced register space: max_register is 0x2000 vs DC8000's 0x2544.

Add the "nuvoton,ma35d1-dcu" compatible string to the OF match table, extend Kconfig to allow building on ARCH_MA35 platforms, and expose vs_formats_no_yuv444 as the default format table for DCUltra Lite (YUV444 blending is a DC8000-only feature).

All changes have been tested on Nuvoton MA35D1 hardware and are functioning correctly.

---
  drivers/gpu/drm/verisilicon/Kconfig           |   2 +- drivers/gpu/drm/verisilicon/vs_bridge.c       |  28 ++-- drivers/gpu/drm/verisilicon/vs_crtc.c         |  13 +- drivers/gpu/drm/verisilicon/vs_dc.c           | 129 ++++++++++++------ drivers/gpu/drm/verisilicon/vs_dc.h           |   1 + drivers/gpu/drm/verisilicon/vs_drm.c          |  16 ++- drivers/gpu/drm/verisilicon/vs_hwdb.c         |   2 +- drivers/gpu/drm/verisilicon/vs_hwdb.h         |  25 ++++ .../gpu/drm/verisilicon/vs_primary_plane.c    |  43 +++--- .../drm/verisilicon/vs_primary_plane_regs.h   |   2 +

  10 files changed, 187 insertions(+), 74 deletions(-)