Skip to contentSkip to conversation

drm/verisilicon: add Nuvoton MA35D1 DCU Lite support

PATCH Superseded Joey Lu 3 participants 26 messages Jun 15 – Jun 22

Subsystems (5)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Joey Lu

author
#0 lore raw

v4 cover drm/verisilicon: add Nuvoton MA35D1 DCU Lite support

This series adds support for the Verisilicon DCUltraLite 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 T-Head TH1520 SoC, which carries a DC8200 IP block. The present series builds on that foundation with gratitude to Icenowy for the original work.

The DCUltraLite is a different variant in the DC IP family. 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 CONFIG_EX commit path: the DC8200 staging registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX) are absent. The DCUltraLite uses enable (bit 0) and reset (bit 4) bits in FB_CONFIG for direct framebuffer updates, and requires a per-frame VALID bit toggle (FB_CONFIG bit 3) to latch configuration changes.

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

- Different IRQ registers: DISP_IRQ_STA at 0x147C / DISP_IRQ_EN at

    0x1480, versus the DC8200's TOP_IRQ_ACK at 0x0010 / TOP_IRQ_EN at
    0x0014.

- Simpler clock topology: two clocks ("core" bus gate and "pix0" pixel divider); no axi or ahb clocks required.

- Single display output: no per-output indexing beyond index 0 is needed.

- Hardware-discoverable identity: the DCUltraLite exposes chip identity

    registers whose model field reads 0x0 (revision 0x5560,
    customer_id 0x305), allowing the existing vs_fill_chip_identity()
    path to identify the variant purely through register reads.

Patch 1 generalises the verisilicon,dc DT binding to accommodate the Nuvoton MA35D1 SoC-specific compatible and the variant's two-clock, one-reset, single-port topology.

Patch 2 adds the register-level macros needed by the DC8000 ops.

Patches 3-5 introduce the driver changes in three logical steps: the vs_dc_funcs hardware ops vtable with DC8200 ops extracted into vs_dc8200.c; the DC8000 ops in vs_dc8000.c with the necessary clock-optionality changes; and finally the DCUltraLite HWDB entry that gates hardware recognition once all support is in place.

Patch 6 adds the Kconfig dependency on ARCH_MA35, placed last because it is only meaningful after the HWDB entry is added.

All patches have been tested on Nuvoton MA35D1 hardware.

Changes from v3:
- [dt-bindings] Reverted extra space before inline '#' comment.
- [dt-bindings] Moved clock/reset items descriptions from the top-level clocks:/resets: into the per-variant allOf/if blocks; kept only minItems/maxItems at the top level.
- [dt-bindings] Restored full items lists for clock-names and reset-names at the top level with minItems so names are still validated.
- [dt-bindings] Added minItems: 1 to resets: in the nuvoton block.
- [dt-bindings] Added required: [resets, reset-names] inside the then:

    block for both thead,th1520-dc8200 and nuvoton,ma35d1-dcu.

- [dt-bindings] Added minItems: 3 to reset-names in the thead block.
- [dt-bindings] Added maxItems: 1 to reset-names in the nuvoton block.
- [dt-bindings] Reverted unevaluatedProperties: false back to
additionalProperties: false.
- [dt-bindings] Removed the second DT example for nuvoton,ma35d1-dcu since a difference in clocks/resets does not need a new example.
- [ops] Renamed bridge_enable/bridge_disable to panel_enable_ex/ panel_disable_ex.
- [ops] Renamed irq_handler to irq_ack.
- [ops] Renamed plane_enable_ex/disable_ex/update_ex to primary_plane_enable_ex/disable_ex/update_ex.
- [ops] Renamed vs_dcu_lite.c to vs_dc8000.c, all internal functions from vs_dcu_lite_* to vs_dc8000_*, exported symbol from vs_dcu_lite_funcs to vs_dc8000_funcs; updated Makefile.
- [kconfig] Moved ARCH_MA35 Kconfig change to a separate final commit, placed after the HWDB entry.

Joey Lu (6):
dt-bindings: display: verisilicon,dc: generalize for single-output
variants
drm/verisilicon: add register-level macros for DC8000 drm/verisilicon: introduce per-variant hardware ops table drm/verisilicon: add DC8000 (DCUltraLite) display controller support drm/verisilicon: add DCUltraLite chip identity to HWDB drm/verisilicon: extend Kconfig to support ARCH_MA35 platforms

 .../bindings/display/verisilicon,dc.yaml      |  80 +++++++++++--
 drivers/gpu/drm/verisilicon/Kconfig           |   2 +-
 drivers/gpu/drm/verisilicon/Makefile          |   2 +-
 drivers/gpu/drm/verisilicon/vs_bridge.c       |  20 +---
 drivers/gpu/drm/verisilicon/vs_crtc.c         |  38 ++++++-
 drivers/gpu/drm/verisilicon/vs_crtc_regs.h    |   1 +
 drivers/gpu/drm/verisilicon/vs_dc.c           |  13 ++-
 drivers/gpu/drm/verisilicon/vs_dc.h           |  33 ++++++
 drivers/gpu/drm/verisilicon/vs_dc8000.c       |  78 +++++++++++++
 drivers/gpu/drm/verisilicon/vs_dc8200.c       | 107 ++++++++++++++++++
 drivers/gpu/drm/verisilicon/vs_hwdb.c         |  14 +++
 drivers/gpu/drm/verisilicon/vs_hwdb.h         |   6 +
 .../gpu/drm/verisilicon/vs_primary_plane.c    |  32 +-----
 .../drm/verisilicon/vs_primary_plane_regs.h   |   3 +
 14 files changed, 368 insertions(+), 61 deletions(-)
 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c
 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8200.c
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v4 1/6 dt-bindings: display: verisilicon,dc: generalize for single-output variants

The existing schema hard-codes the five-clock/three-reset/dual-port topology of the DC8200 IP block, preventing reuse for single-output variants such as the Verisilicon DCUltraLite used in the Nuvoton MA35D1 SoC.

Rework the schema so that variant-specific constraints are expressed via allOf/if blocks:

- Add nuvoton,ma35d1-dcu to the SoC-specific compatible enum. The generic verisilicon,dc fallback remains the driver-binding string.
- Move clock and reset items descriptions into the per-variant allOf/if blocks; keep only minItems/maxItems at the top level so the base schema accepts all variants.
- Restore full items lists for clock-names and reset-names at the top level with minItems so the names are validated against the descriptions.
- Keep ports in the global required list and keep additionalProperties: false.
- Add an allOf/if block for thead,th1520-dc8200: five-clock (core, axi, ahb, pix0, pix1), three-reset (core, axi, ahb), required resets.
- Add an allOf/if block for nuvoton,ma35d1-dcu: two-clock (core, pix0), one-reset (core), required resets.

---
 .../bindings/display/verisilicon,dc.yaml      | 80 +++++++++++++++++--
 1 file changed, 73 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +73 -7
index 9dc35ab973f2..0c41286b8223 100644
@@ -17,6 +17,7 @@ properties:
     items:
       - enum:
           - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
       - const: verisilicon,dc # DC IPs have discoverable ID/revision registers
 
   reg:
@@ -26,14 +27,12 @@ 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:
+    minItems: 2
+    maxItems: 5
     items:
       - const: core
       - const: axi
@@ -42,12 +41,16 @@ properties:
       - const: pix1
 
   resets:
+    minItems: 1
+    maxItems: 3
     items:
       - description: DC Core reset
       - description: DMA AXI bus reset
       - description: Configuration AHB bus reset
 
   reset-names:
+    minItems: 1
+    maxItems: 3
     items:
       - const: core
       - const: axi
@@ -59,7 +62,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.
 
@@ -77,6 +80,69 @@ required:
   - clock-names
   - ports
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: thead,th1520-dc8200
+    then:
+      properties:
+        clocks:
+          minItems: 5
+          maxItems: 5
+          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
+
+        clock-names:
+          minItems: 5
+          maxItems: 5
+
+        resets:
+          minItems: 3
+          maxItems: 3
+
+        reset-names:
+          minItems: 3
+          maxItems: 3
+
+      required:
+        - resets
+        - reset-names
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nuvoton,ma35d1-dcu
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          maxItems: 2
+          items:
+            - description: DC Core clock
+            - description: Pixel clock of output 0
+
+        clock-names:
+          minItems: 2
+          maxItems: 2
+
+        resets:
+          minItems: 1
+          maxItems: 1
+
+        reset-names:
+          maxItems: 1
+
+      required:
+        - resets
+        - reset-names
+
 additionalProperties: false
 
 examples:
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v4 1/6] dt-bindings: display: verisilicon,dc: generalize for single-output variants

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The top-level `clock-names` property enforces a strict positional sequence (`core`, `axi`…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The top-level clock-names property enforces a strict positional sequence (core, axi, ahb, pix0, pix1) that conflicts with the nuvoton,ma35d1-dcu variant, causing valid device trees to fail schema validation. --

commit 644d6513333f2ad52d35609ed1c0190fdeaa8192
Author: Joey Lu <[email protected]>

dt-bindings: display: verisilicon,dc: generalize for single-output variants

This commit generalizes the verisilicon,dc schema to support single-output variants. It extracts variant-specific constraints into allOf/if blocks and adds support for the Nuvoton MA35D1 SoC.

Quoted 3 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0

[ ... ]

Quoted 9 lines

clock-names:

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +2 -0
+    minItems: 2
+    maxItems: 5
     items:
       - const: core
       - const: axi
       - const: ahb
       - const: pix0
       - const: pix1

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +7 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nuvoton,ma35d1-dcu
+    then:
+      properties:

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

Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10 -0
+        clocks:
+          minItems: 2
+          maxItems: 2
+          items:
+            - description: DC Core clock
+            - description: Pixel clock of output 0
+
+        clock-names:
+          minItems: 2
+          maxItems: 2

[Severity: Medium]
Will this cause validation failures for valid device trees?

The top-level clock-names defines a strict positional sequence where the second item must be "axi". However, the clocks definition for the nuvoton,ma35d1-dcu variant indicates it uses "core" and "pix0".

Since the variant's clock-names block doesn't redefine the items array, won't dt-schema evaluate "pix0" against the inherited "axi" constraint at index 1 and fail?

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

Re: [PATCH v4 1/6] dt-bindings: display: verisilicon, dc: generalize for single-output variants

In reply to Joey Lu
Quoted 52 lines · 在 2026-06-15一的 14:49 +0800,Joey Lu写道:

The existing schema hard-codes the five-clock/three-reset/dual-port topology of the DC8200 IP block, preventing reuse for single-output variants such as the Verisilicon DCUltraLite used in the Nuvoton MA35D1
SoC.

Rework the schema so that variant-specific constraints are expressed via
allOf/if blocks:

- Add nuvoton,ma35d1-dcu to the SoC-specific compatible enum.  The generic verisilicon,dc fallback remains the driver-binding string.
- Move clock and reset items descriptions into the per-variant allOf/if
  blocks; keep only minItems/maxItems at the top level so the base schema
  accepts all variants.
- Restore full items lists for clock-names and reset-names at the top level with minItems so the names are validated against the descriptions.
- Keep ports in the global required list and keep
additionalProperties: false.
- Add an allOf/if block for thead,th1520-dc8200: five-clock (core, axi,
  ahb, pix0, pix1), three-reset (core, axi, ahb), required resets.
- Add an allOf/if block for nuvoton,ma35d1-dcu: two-clock (core, pix0),
  one-reset (core), required resets.

---
 .../bindings/display/verisilicon,dc.yaml      | 80
+++++++++++++++++--

 1 file changed, 73 insertions(+), 7 deletions(-)

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

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

     items:
       - enum:
           - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
       - const: verisilicon,dc # DC IPs have discoverable ID/revision registers

   reg:

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -26,14 +27,12 @@ properties:

     maxItems: 1

Quoted 8 lines


   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

Clock descriptions should still be in the global part instead of the per-compatible part.

In the per-compatible part, clock-names should be constraint for SoCs.

Quoted 27 lines

+    minItems: 2
+    maxItems: 5

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

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -42,12 +41,16 @@ properties:

       - const: pix1

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

   reset-names:
+    minItems: 1
+    maxItems: 3
     items:
       - const: core
       - const: axi

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -59,7 +62,7 @@ properties:
Quoted 5 lines

     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

If you really want to fix this, please make it a separated patch instead of doing it here, for commit atomicity.

Thanks,
Icenowy

Quoted 73 lines

           used for DPI format output and endpoint 1 should be used for DP format output.

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -0
@@ -77,6 +80,69 @@ required:

   - clock-names
   - ports

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +63 -0
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: thead,th1520-dc8200
+    then:
+      properties:
+        clocks:
+          minItems: 5
+          maxItems: 5
+          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
+
+        clock-names:
+          minItems: 5
+          maxItems: 5
+
+        resets:
+          minItems: 3
+          maxItems: 3
+
+        reset-names:
+          minItems: 3
+          maxItems: 3
+
+      required:
+        - resets
+        - reset-names
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nuvoton,ma35d1-dcu
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          maxItems: 2
+          items:
+            - description: DC Core clock
+            - description: Pixel clock of output 0
+
+        clock-names:
+          minItems: 2
+          maxItems: 2
+
+        resets:
+          minItems: 1
+          maxItems: 1
+
+        reset-names:
+          maxItems: 1
+
+      required:
+        - resets
+        - reset-names
+

 additionalProperties: false

 examples:

author
#4 lore raw

Re: [PATCH v4 1/6] dt-bindings: display: verisilicon, dc: generalize for single-output variants

Quoted 64 lines · Icenowy Zheng
Quoted 51 lines · 在 2026-06-15一的 14:49 +0800,Joey Lu写道:

The existing schema hard-codes the five-clock/three-reset/dual-port topology of the DC8200 IP block, preventing reuse for single-output variants such as the Verisilicon DCUltraLite used in the Nuvoton MA35D1
SoC.

Rework the schema so that variant-specific constraints are expressed via
allOf/if blocks:

- Add nuvoton,ma35d1-dcu to the SoC-specific compatible enum.  The generic verisilicon,dc fallback remains the driver-binding string.
- Move clock and reset items descriptions into the per-variant allOf/if
  blocks; keep only minItems/maxItems at the top level so the base
schema
  accepts all variants.
- Restore full items lists for clock-names and reset-names at the top level with minItems so the names are validated against the
descriptions.
- Keep ports in the global required list and keep
additionalProperties: false.
- Add an allOf/if block for thead,th1520-dc8200: five-clock (core, axi,
  ahb, pix0, pix1), three-reset (core, axi, ahb), required resets.
- Add an allOf/if block for nuvoton,ma35d1-dcu: two-clock (core, pix0),
  one-reset (core), required resets.

---
  .../bindings/display/verisilicon,dc.yaml      | 80
+++++++++++++++++--
  1 file changed, 73 insertions(+), 7 deletions(-)

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

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +1 -0
@@ -17,6 +17,7 @@ properties:
      items:
        - enum:
            - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
        - const: verisilicon,dc # DC IPs have discoverable ID/revision

registers

   reg:

Documentation/devicetree/bindings/display/verisilicon,dc.yaml properties: · line 34

Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -6
@@ -26,14 +27,12 @@ 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

Clock descriptions should still be in the global part instead of the per-compatible part.

Quoted 1 line

In the per-compatible part, clock-names should be constraint for SoCs.

I will move the items: clock descriptions back into the global clocks: property, covering all five possible clocks. In the per-compatible sections I will remove the description items and only constrain clocks: minItems/maxItems and clock-names: minItems/maxItems; for nuvoton,ma35d1-dcu I will additionally override clock-names: items: to the two names actually used (core, pix0).

Quoted 35 lines
Quoted 27 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8 -0
+    minItems: 2
+    maxItems: 5
 
    clock-names:
+    minItems: 2
+    maxItems: 5
      items:
        - const: core
        - const: axi
@@ -42,12 +41,16 @@ properties:
        - const: pix1
 
    resets:
+    minItems: 1
+    maxItems: 3
      items:
        - description: DC Core reset
        - description: DMA AXI bus reset
        - description: Configuration AHB bus reset
 
    reset-names:
+    minItems: 1
+    maxItems: 3
      items:
        - const: core
        - const: axi

Documentation/devicetree/bindings/display/verisilicon,dc.yaml properties: · line 65

Quoted 5 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +1 -1
@@ -59,7 +62,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

If you really want to fix this, please make it a separated patch instead of doing it here, for commit atomicity.

Quoted 2 lines

Thanks,
Icenowy

I’ll drop this change and keep it as is

Quoted 73 lines
Quoted 73 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +63 -0
            used for DPI format output and endpoint 1 should be used
            for DP format output.
 
@@ -77,6 +80,69 @@ required:
    - clock-names
    - ports
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: thead,th1520-dc8200
+    then:
+      properties:
+        clocks:
+          minItems: 5
+          maxItems: 5
+          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
+
+        clock-names:
+          minItems: 5
+          maxItems: 5
+
+        resets:
+          minItems: 3
+          maxItems: 3
+
+        reset-names:
+          minItems: 3
+          maxItems: 3
+
+      required:
+        - resets
+        - reset-names
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nuvoton,ma35d1-dcu
+    then:
+      properties:
+        clocks:
+          minItems: 2
+          maxItems: 2
+          items:
+            - description: DC Core clock
+            - description: Pixel clock of output 0
+
+        clock-names:
+          minItems: 2
+          maxItems: 2
+
+        resets:
+          minItems: 1
+          maxItems: 1
+
+        reset-names:
+          maxItems: 1
+
+      required:
+        - resets
+        - reset-names
+
  additionalProperties: false
 
  examples:
maintainer
#5 lore raw

Re: [PATCH v4 1/6] dt-bindings: display: verisilicon, dc: generalize for single-output variants

Quoted 81 lines · 在 2026-06-17三的 18:25 +0800,Joey Lu写道:
Quoted 77 lines · Icenowy Zheng
Quoted 64 lines · 在 2026-06-15一的 14:49 +0800,Joey Lu写道:

The existing schema hard-codes the five-clock/three-reset/dual- port
topology of the DC8200 IP block, preventing reuse for single- output
variants such as the Verisilicon DCUltraLite used in the Nuvoton MA35D1
SoC.

Rework the schema so that variant-specific constraints are expressed
via
allOf/if blocks:

- Add nuvoton,ma35d1-dcu to the SoC-specific compatible enum. The
   generic verisilicon,dc fallback remains the driver-binding string.
- Move clock and reset items descriptions into the per-variant allOf/if
   blocks; keep only minItems/maxItems at the top level so the base
schema
   accepts all variants.
- Restore full items lists for clock-names and reset-names at the top
   level with minItems so the names are validated against the descriptions.
- Keep ports in the global required list and keep
additionalProperties: false.
- Add an allOf/if block for thead,th1520-dc8200: five-clock (core,
axi,
   ahb, pix0, pix1), three-reset (core, axi, ahb), required resets.
- Add an allOf/if block for nuvoton,ma35d1-dcu: two-clock (core, pix0),
   one-reset (core), required resets.

---
  .../bindings/display/verisilicon,dc.yaml      | 80
+++++++++++++++++--

  1 file changed, 73 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml index 9dc35ab973f2..0c41286b8223 100644
---
a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml
+++
b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml

(quoted diff) +0 -0
@@ -17,6 +17,7 @@ properties:

      items:
        - enum:
            - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
        - const: verisilicon,dc # DC IPs have discoverable ID/revision
registers

    reg:

(quoted diff) +0 -0
@@ -26,14 +27,12 @@ properties:

      maxItems: 1

Quoted 8 lines


    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

Clock descriptions should still be in the global part instead of the
per-compatible part.

Quoted 2 lines

In the per-compatible part, clock-names should be constraint for SoCs.

Quoted 7 lines

I will move the items: clock descriptions back into the global clocks: property, covering all five possible clocks. In the per-compatible sections I will remove the description items and only constrain clocks: minItems/maxItems and `clock-names:
minItems/maxItems`; for nuvoton,ma35d1-dcu I will additionally override
clock-names: items: to the two names actually used (core, pix0).

Yes, this should be the correct practice, although I wonder whether the minItems and maxItems properties are needed globally (because these two seem to have default implicit value).

BTW the MA35D1 manual in fact shows 4 clocks for "DCUltra" in the clock tree, maybe the DT binding needs to be reconsidered?

Thanks,
Icenowy

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

+    minItems: 2
+    maxItems: 5

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

author
#6 lore raw

Re: [PATCH v4 1/6] dt-bindings: display: verisilicon, dc: generalize for single-output variants

Quoted 92 lines · Icenowy Zheng
Quoted 80 lines · 在 2026-06-17三的 18:25 +0800,Joey Lu写道:
Quoted 77 lines · Icenowy Zheng
Quoted 63 lines · 在 2026-06-15一的 14:49 +0800,Joey Lu写道:

The existing schema hard-codes the five-clock/three-reset/dual- port
topology of the DC8200 IP block, preventing reuse for single- output
variants such as the Verisilicon DCUltraLite used in the Nuvoton MA35D1
SoC.

Rework the schema so that variant-specific constraints are expressed
via
allOf/if blocks:

- Add nuvoton,ma35d1-dcu to the SoC-specific compatible enum. The
   generic verisilicon,dc fallback remains the driver-binding
string.
- Move clock and reset items descriptions into the per-variant allOf/if
   blocks; keep only minItems/maxItems at the top level so the
base
schema
   accepts all variants.
- Restore full items lists for clock-names and reset-names at the top
   level with minItems so the names are validated against the
descriptions.
- Keep ports in the global required list and keep
additionalProperties: false.
- Add an allOf/if block for thead,th1520-dc8200: five-clock (core,
axi,
   ahb, pix0, pix1), three-reset (core, axi, ahb), required
resets.
- Add an allOf/if block for nuvoton,ma35d1-dcu: two-clock (core, pix0),
   one-reset (core), required resets.

---
   .../bindings/display/verisilicon,dc.yaml      | 80
+++++++++++++++++--
   1 file changed, 73 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml index 9dc35ab973f2..0c41286b8223 100644
---
a/Documentation/devicetree/bindings/display/verisilicon,dc.yaml
+++
b/Documentation/devicetree/bindings/display/verisilicon,dc.yaml

Documentation/devicetree/bindings/display/verisilicon,dc.yaml +1 -0
@@ -17,6 +17,7 @@ properties:
       items:
         - enum:
             - thead,th1520-dc8200
+          - nuvoton,ma35d1-dcu
         - const: verisilicon,dc # DC IPs have discoverable

ID/revision
registers

    reg:

Documentation/devicetree/bindings/display/verisilicon,dc.yaml properties: · line 34

Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0 -6
@@ -26,14 +27,12 @@ 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

Clock descriptions should still be in the global part instead of the
per-compatible part.

Quoted 2 lines

In the per-compatible part, clock-names should be constraint for SoCs.

Quoted 7 lines

I will move the items: clock descriptions back into the global clocks: property, covering all five possible clocks. In the per-compatible sections I will remove the description items and only constrain clocks: minItems/maxItems and `clock-names:
minItems/maxItems`; for nuvoton,ma35d1-dcu I will additionally override
clock-names: items: to the two names actually used (core, pix0).

Yes, this should be the correct practice, although I wonder whether the minItems and maxItems properties are needed globally (because these two seem to have default implicit value).

Quoted 5 lines

BTW the MA35D1 manual in fact shows 4 clocks for "DCUltra" in the clock tree, maybe the DT binding needs to be reconsidered?

Thanks,
Icenowy

I will drop the global minItems/maxItems on clocks and clock-names in v5, as they are redundant with the implicit defaults.

Regarding the 4-clock question: the TRM clock tree diagram does show four paths reaching DCUltra (display core mux/gate, AXI ACLK, AHB HCLK, and the pixel clock divider). However, the MA35D1 hardware provides only one software-controllable enable bit (SYSCLK0[26]) that gates the core clock together with the AXI and AHB bus clocks through shared ICG cells; there are no separate register bits for the bus clocks alone. Due to this hardware design constraint, the clk-ma35d1 driver is intentionally designed to register only three DCU-related CCF nodes: dcu_mux (ID 61, an internal routing mux), dcu_gate (ID 62, the single gate at SYSCLK0 bit 26), and dcup_div (ID 63, the pixel divider from VPLL at CLKDIV0[18:16]), with no independent AXI or AHB gate entries for DCU. Since the DT binding can only reference clock handles that the platform clock driver actually provides, the MA35D1 binding will remain at two clock entries: "core" mapped to DCU_GATE and "pix0" mapped to DCUP_DIV.

Thanks.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +4 -0
+    minItems: 2
+    maxItems: 5
 
     clock-names:
+    minItems: 2
+    maxItems: 5
       items:
         - const: core
         - const: axi
author
#7 lore raw

PATCH v4 2/6 drm/verisilicon: add register-level macros for DC8000

In reply to Joey Lu

Add register-level constants needed by the forthcoming DC8000 (DCUltraLite) hardware ops:

VSDC_DISP_IRQ_VSYNC(n) in vs_crtc_regs.h: bit mask for per-output VSYNC interrupt bits in DISP_IRQ_STA (0x147C) / DISP_IRQ_EN (0x1480), which are the IRQ registers used by DCUltraLite in place of the DC8200 TOP_IRQ_ACK / TOP_IRQ_EN registers.

VSDC_FB_CONFIG_ENABLE (bit 0), VSDC_FB_CONFIG_VALID (bit 3) and VSDC_FB_CONFIG_RESET (bit 4) in vs_primary_plane_regs.h: control bits in the FB_CONFIG register used by DCUltraLite for framebuffer enable and per-frame commit handshake.

No behaviour change for existing DC8200 platforms.

---
 drivers/gpu/drm/verisilicon/vs_crtc_regs.h          | 1 +
 drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h | 3 +++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/verisilicon/vs_crtc_regs.h +1 -0
index c7930e817635..d4da22b08cd5 100644
@@ -54,6 +54,7 @@
 #define VSDC_DISP_GAMMA_DATA(n)			(0x1460 + 0x4 * (n))
 
 #define VSDC_DISP_IRQ_STA			0x147C
+#define VSDC_DISP_IRQ_VSYNC(n)			BIT(n)
 
 #define VSDC_DISP_IRQ_EN			0x1480
 
drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +3 -0
index cbb125c46b39..67d4b00f294e 100644
@@ -16,6 +16,9 @@
 #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_VALID			BIT(3)
+#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 Reviewed-by on v4 2/6
#8 lore raw

Re: [PATCH v4 2/6] drm/verisilicon: add register-level macros for DC8000

Quoted 11 lines · 在 2026-06-15一的 14:49 +0800,Joey Lu写道:

Add register-level constants needed by the forthcoming DC8000 (DCUltraLite)
hardware ops:

  VSDC_DISP_IRQ_VSYNC(n) in vs_crtc_regs.h: bit mask for per-output VSYNC interrupt bits in DISP_IRQ_STA (0x147C) / DISP_IRQ_EN (0x1480),
  which are the IRQ registers used by DCUltraLite in place of the DC8200
  TOP_IRQ_ACK / TOP_IRQ_EN registers.

Quoted 6 lines

  VSDC_FB_CONFIG_ENABLE (bit 0), VSDC_FB_CONFIG_VALID (bit 3) and VSDC_FB_CONFIG_RESET (bit 4) in vs_primary_plane_regs.h: control bits
  in the FB_CONFIG register used by DCUltraLite for framebuffer enable
  and per-frame commit handshake.

Validated against DC8000 register list.

Quoted 39 lines

No behaviour change for existing DC8200 platforms.

---
 drivers/gpu/drm/verisilicon/vs_crtc_regs.h          | 1 + drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h | 3 +++

 2 files changed, 4 insertions(+)
drivers/gpu/drm/verisilicon/vs_crtc_regs.h +0 -0
index c7930e817635..d4da22b08cd5 100644
@@ -54,6 +54,7 @@
  #define VSDC_DISP_GAMMA_DATA(n)			(0x1460 +
 0x4 * (n))


 #define VSDC_DISP_IRQ_STA 0x147C
+#define VSDC_DISP_IRQ_VSYNC(n) BIT(n)

 #define VSDC_DISP_IRQ_EN 0x1480

drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +0 -0
index cbb125c46b39..67d4b00f294e 100644
@@ -16,6 +16,9 @@
  #define VSDC_FB_STRIDE(n)			(0x1408 + 0x4 * (n))


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

drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h +3 -0
+#define VSDC_FB_CONFIG_ENABLE			BIT(0)
+#define VSDC_FB_CONFIG_VALID			BIT(3)
+#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
#9 lore raw

PATCH v4 3/6 drm/verisilicon: introduce per-variant hardware ops table

In reply to Joey Lu

The DC8200 and DCUltraLite share a broadly similar register layout but differ in how the bridge, CRTC, primary plane and IRQ paths are driven. Introduce a vs_dc_funcs vtable so each variant can supply its own implementation without scattering conditionals across multiple files.

Add enum vs_dc_generation (VSDC_GEN_DC8000 / VSDC_GEN_DC8200) to vs_hwdb.h and a generation field to struct vs_chip_identity. Annotate all four existing DC8200 HWDB entries with VSDC_GEN_DC8200.

Extract the DC8200-specific hardware ops into a new vs_dc8200.c:
panel_enable_ex / panel_disable_ex - PANEL_CONFIG/START + CONFIG_EX commit enable_vblank / disable_vblank - TOP_IRQ_EN VSYNC bit primary_plane_enable_ex / disable_ex / update_ex - FB_CONFIG_EX path irq_ack - reads TOP_IRQ_ACK

Update vs_bridge.c, vs_crtc.c, vs_primary_plane.c and vs_dc.c to dispatch through dc->funcs instead of directly touching registers. vs_crtc.c gains atomic_begin and atomic_flush hooks to allow variants to gate per-frame commit cycles.

No behaviour change for existing DC8200 platforms.

---
 drivers/gpu/drm/verisilicon/Makefile          |   2 +-
 drivers/gpu/drm/verisilicon/vs_bridge.c       |  20 +---
 drivers/gpu/drm/verisilicon/vs_crtc.c         |  38 ++++++-
 drivers/gpu/drm/verisilicon/vs_dc.c           |   6 +-
 drivers/gpu/drm/verisilicon/vs_dc.h           |  32 ++++++
 drivers/gpu/drm/verisilicon/vs_dc8200.c       | 107 ++++++++++++++++++
 drivers/gpu/drm/verisilicon/vs_hwdb.c         |   4 +
 drivers/gpu/drm/verisilicon/vs_hwdb.h         |   6 +
 .../gpu/drm/verisilicon/vs_primary_plane.c    |  32 +-----
 9 files changed, 196 insertions(+), 51 deletions(-)
 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8200.c
drivers/gpu/drm/verisilicon/Makefile +1 -1
index 426f4bcaa834..9d4cd16452fa 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_drm.o vs_hwdb.o \
 	vs_plane.o vs_primary_plane.o vs_cursor_plane.o
 
 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o
drivers/gpu/drm/verisilicon/vs_bridge.c +3 -17
index 7a93049368db..6ff2ac745b15 100644
@@ -162,15 +162,8 @@ static void vs_bridge_enable_common(struct vs_crtc *crtc,
 			VSDC_DISP_PANEL_CONFIG_DE_EN |
 			VSDC_DISP_PANEL_CONFIG_DAT_EN |
 			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);
+
+	dc->funcs->panel_enable_ex(dc, output);
 }
 
 static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,
@@ -228,14 +221,7 @@ 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);
+	dc->funcs->panel_disable_ex(dc, output);
 }
 
 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {
drivers/gpu/drm/verisilicon/vs_crtc.c +34 -4
index 0b8a35d09cd2..679d6541ba1b 100644
@@ -16,10 +16,33 @@
 #include "vs_crtc_regs.h"
 #include "vs_crtc.h"
 #include "vs_dc.h"
-#include "vs_dc_top_regs.h"
 #include "vs_drm.h"
 #include "vs_plane.h"
 
+static void vs_crtc_atomic_begin(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_begin)
+		dc->funcs->crtc_begin(dc, output);
+}
+
+static void vs_crtc_atomic_flush(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_flush)
+		dc->funcs->crtc_flush(dc, output);
+
+	drm_crtc_vblank_atomic_flush(crtc, state);
+}
+
 static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
 				   struct drm_atomic_commit *state)
 {
@@ -30,6 +53,9 @@ static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 
 	clk_disable_unprepare(dc->pix_clk[output]);
+
+	if (dc->funcs->crtc_disable)
+		dc->funcs->crtc_disable(dc, output);
 }
 
 static void vs_crtc_atomic_enable(struct drm_crtc *crtc,
@@ -42,6 +68,9 @@ static void vs_crtc_atomic_enable(struct drm_crtc *crtc,
 	drm_WARN_ON(&dc->drm_dev->base,
 		    clk_prepare_enable(dc->pix_clk[output]));
 
+	if (dc->funcs->crtc_enable)
+		dc->funcs->crtc_enable(dc, output);
+
 	drm_crtc_vblank_on(crtc);
 }
 
@@ -119,7 +148,8 @@ static bool vs_crtc_mode_fixup(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_helper_funcs vs_crtc_helper_funcs = {
-	.atomic_flush	= drm_crtc_vblank_atomic_flush,
+	.atomic_begin	= vs_crtc_atomic_begin,
+	.atomic_flush	= vs_crtc_atomic_flush,
 	.atomic_enable	= vs_crtc_atomic_enable,
 	.atomic_disable	= vs_crtc_atomic_disable,
 	.mode_set_nofb	= vs_crtc_mode_set_nofb,
@@ -132,7 +162,7 @@ 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));
+	dc->funcs->enable_vblank(dc, vcrtc->id);
 
 	return 0;
 }
@@ -142,7 +172,7 @@ 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));
+	dc->funcs->disable_vblank(dc, vcrtc->id);
 }
 
 static const struct drm_crtc_funcs vs_crtc_funcs = {
drivers/gpu/drm/verisilicon/vs_dc.c +3 -3
index dad9967bc10b..9729b693d360 100644
@@ -8,9 +8,7 @@
 #include <linux/of.h>
 #include <linux/of_graph.h>
 
-#include "vs_crtc.h"
 #include "vs_dc.h"
-#include "vs_dc_top_regs.h"
 #include "vs_drm.h"
 #include "vs_hwdb.h"
 
@@ -33,7 +31,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void *private)
 	struct vs_dc *dc = private;
 	u32 irqs;
 
-	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	irqs = dc->funcs->irq_ack(dc);
 
 	vs_drm_handle_irq(dc, irqs);
 
@@ -136,6 +134,8 @@ static int vs_dc_probe(struct platform_device *pdev)
 	dev_info(dev, "Found DC%x rev %x customer %x\n", dc->identity.model,
 		 dc->identity.revision, dc->identity.customer_id);
 
+	dc->funcs = &vs_dc8200_funcs;
+
 	if (port_count > dc->identity.display_count) {
 		dev_err(dev, "too many downstream ports than HW capability\n");
 		ret = -EINVAL;
drivers/gpu/drm/verisilicon/vs_dc.h +32 -0
index ed1016f18758..544e1a37065b 100644
@@ -14,6 +14,7 @@
 #include <linux/reset.h>
 
 #include <drm/drm_device.h>
+#include <drm/drm_plane.h>
 
 #include "vs_hwdb.h"
 
@@ -22,6 +23,34 @@
 
 struct vs_drm_dev;
 struct vs_crtc;
+struct vs_dc;
+
+struct vs_dc_funcs {
+	/* Bridge: atomic_enable, atomic_disable */
+	void (*panel_enable_ex)(struct vs_dc *dc, unsigned int output);
+	void (*panel_disable_ex)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: atomic_begin, atomic_flush */
+	void (*crtc_begin)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_flush)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: atomic_enable, atomic_disable */
+	void (*crtc_enable)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_disable)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: enable_vblank, disable_vblank */
+	void (*enable_vblank)(struct vs_dc *dc, unsigned int output);
+	void (*disable_vblank)(struct vs_dc *dc, unsigned int output);
+
+	/* Primary plane: atomic_enable, atomic_disable, atomic_update */
+	void (*primary_plane_enable_ex)(struct vs_dc *dc, unsigned int output);
+	void (*primary_plane_disable_ex)(struct vs_dc *dc, unsigned int output);
+	void (*primary_plane_update_ex)(struct vs_dc *dc, unsigned int output,
+					struct drm_plane_state *state);
+
+	/* IRQ acknowledge */
+	u32 (*irq_ack)(struct vs_dc *dc);
+};
 
 struct vs_dc {
 	struct regmap *regs;
@@ -33,6 +62,9 @@ struct vs_dc {
 
 	struct vs_drm_dev *drm_dev;
 	struct vs_chip_identity identity;
+	const struct vs_dc_funcs *funcs;
 };
 
+extern const struct vs_dc_funcs vs_dc8200_funcs;
+
 #endif /* _VS_DC_H_ */
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +107 -0

107 lines not on this page · raw message

drivers/gpu/drm/verisilicon/vs_hwdb.c +4 -0
index 2a0f7c59afa3..91524d16f778 100644
@@ -94,6 +94,7 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.revision = 0x5720,
 		.customer_id = ~0U,
 
+		.generation = VSDC_GEN_DC8200,
 		.display_count = 2,
 		.max_cursor_size = 64,
 		.formats = &vs_formats_no_yuv444,
@@ -103,6 +104,7 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.revision = 0x5721,
 		.customer_id = 0x30B,
 
+		.generation = VSDC_GEN_DC8200,
 		.display_count = 2,
 		.max_cursor_size = 64,
 		.formats = &vs_formats_no_yuv444,
@@ -112,6 +114,7 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.revision = 0x5720,
 		.customer_id = 0x310,
 
+		.generation = VSDC_GEN_DC8200,
 		.display_count = 2,
 		.max_cursor_size = 64,
 		.formats = &vs_formats_with_yuv444,
@@ -121,6 +124,7 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.revision = 0x5720,
 		.customer_id = 0x311,
 
+		.generation = VSDC_GEN_DC8200,
 		.display_count = 2,
 		.max_cursor_size = 64,
 		.formats = &vs_formats_no_yuv444,
drivers/gpu/drm/verisilicon/vs_hwdb.h +6 -0
index 2065ecb73043..a15c8b565604 100644
@@ -9,6 +9,11 @@
 #include <linux/regmap.h>
 #include <linux/types.h>
 
+enum vs_dc_generation {
+	VSDC_GEN_DC8000,
+	VSDC_GEN_DC8200,
+};
+
 struct vs_formats {
 	const u32 *array;
 	unsigned int num;
@@ -19,6 +24,7 @@ struct vs_chip_identity {
 	u32 revision;
 	u32 customer_id;
 
+	enum vs_dc_generation generation;
 	u32 display_count;
 	/*
 	 * The hardware only supports square cursor planes, so this field
drivers/gpu/drm/verisilicon/vs_primary_plane.c +6 -26
index 1f2be41ae496..f992cb277f61 100644
@@ -53,12 +53,6 @@ static int vs_primary_plane_atomic_check(struct drm_plane *plane,
 	return 0;
 }
 
-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);
-}
-
 static void vs_primary_plane_atomic_enable(struct drm_plane *plane,
 					   struct drm_atomic_commit *atomic_state)
 {
@@ -69,13 +63,8 @@ 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));
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_enable_ex)
+		dc->funcs->primary_plane_enable_ex(dc, output);
 }
 
 static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
@@ -88,10 +77,8 @@ 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);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_disable_ex)
+		dc->funcs->primary_plane_disable_ex(dc, output);
 }
 
 static void vs_primary_plane_atomic_update(struct drm_plane *plane,
@@ -133,18 +120,11 @@ 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);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_update_ex)
+		dc->funcs->primary_plane_update_ex(dc, output, state);
 }
 
 static const struct drm_plane_helper_funcs vs_primary_plane_helper_funcs = {
Signature · 1 line
2.43.0
#10 lore raw

Re: [PATCH v4 3/6] drm/verisilicon: introduce per-variant hardware ops table

Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider:

New issues:
- [High] The newly introduced crtc_disable hardware hook is invoked after disabling the pixel clock, which will cause unclocked hardware accesses and potential bus hangs.
- [High] The disable sequence for the display panel incorrectly swaps the order of clearing PANEL_START and PANEL_CONFIG, violating the required reverse-enable hardware sequence.

Pre-existing issues:
- [High] Sleepable clock control functions (clk_prepare_enable and clk_disable_unprepare) are called inside DRM atomic commit callbacks where sleeping is strictly forbidden.
- [High] The primary plane disable logic incorrectly sets the VSDC_FB_CONFIG_EX_FB_EN bit instead of clearing it, failing to actually disable the plane.
- [High] Calling regmap_read in a hardirq handler uses a standard spinlock which maps to a sleeping rt_mutex on PREEMPT_RT.
- [High] Primary plane update programs hardware registers with unclipped destination coordinates (state->crtc_x / state->crtc_y) which can be negative. --

commit 7db852133467fb896e651ada4802a06233540439
Author: Joey Lu <[email protected]> drm/verisilicon: introduce per-variant hardware ops table

This commit introduces a hardware operations table for different variants of the Verisilicon display controller. It extracts DC8200-specific ops into a new file and updates the bridge, CRTC, and plane code to use the new vtable instead of direct register access.

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
index 0b8a35d09cd2e..679d6541ba1b9 100644

[ ... ]

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_disable(struct drm_crtc *crtc, · line 54

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -26,10 +49,16 @@ static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
 	struct vs_dc *dc = vcrtc->dc;
 	unsigned int output = vcrtc->id;
 
 	drm_crtc_vblank_off(crtc);
 
 	clk_disable_unprepare(dc->pix_clk[output]);

[Severity: High]
This is a pre-existing issue, but does calling clk_disable_unprepare() here and clk_prepare_enable() in vs_crtc_atomic_enable() cause a sleep in atomic context?

Since atomic_enable and atomic_disable callbacks execute in an atomic context during non-blocking commits, calling sleepable clock control functions could lead to deadlocks or kernel panics.

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_disable(struct drm_crtc *crtc, · line 59

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -0
+
+	if (dc->funcs->crtc_disable)
+		dc->funcs->crtc_disable(dc, output);
 }

[Severity: High]
Does this sequence write to hardware registers while the pixel clock is disabled?

Calling dc->funcs->crtc_disable(dc, output) after clk_disable_unprepare() means we are performing register accesses without a running clock, which could lead to bus hangs or failed writes.

Should the order be reversed to match the symmetric enable sequence?

[ ... ]

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +0 -0
new file mode 100644
index 0000000000000..800df9279e9b6

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8200.c line 37

Quoted 11 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +11 -0
+static void vs_dc8200_panel_disable_ex(struct vs_dc *dc, unsigned int output)
+{
+	regmap_clear_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 |
+			  VSDC_DISP_PANEL_START_RUNNING(output));
+
+	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(output),
+			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+}

[Severity: High]
Does this swap the order of clearing the panel registers compared to the original vs_bridge_atomic_disable() code?

The original code correctly cleared VSDC_DISP_PANEL_START before VSDC_DISP_PANEL_CONFIG.

Clearing CONFIG while the display pipeline is still actively running could cause an unprotected hardware state transition, leading to pipeline underflows or hardware hangs.

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8200.c line 74

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +7 -0
+static void vs_dc8200_primary_plane_disable_ex(struct vs_dc *dc, unsigned int output)
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			VSDC_FB_CONFIG_EX_FB_EN);
+
+	vs_dc8200_plane_commit(dc, output);
+}

[Severity: High]
This is a pre-existing issue, but does this function actually disable the plane?

It looks like regmap_set_bits() is used on VSDC_FB_CONFIG_EX_FB_EN, which would keep the plane enabled in hardware.

Should this use regmap_clear_bits() instead to properly clear the bit and disable the plane?

drivers/gpu/drm/verisilicon/vs_dc8200.c line 83

Quoted 8 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +8 -0
+static void vs_dc8200_primary_plane_update_ex(struct vs_dc *dc, unsigned int output,
+				       struct drm_plane_state *state)
+{
+	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));

[Severity: High]
This is a pre-existing issue, but what happens if the user provides negative coordinates when a plane is partially off-screen?

Because state->crtc_x and state->crtc_y are unclipped, a negative value passed to VSDC_MAKE_PLANE_POS() might be bitwise ANDed with 0x7fff, producing a massive positive value (for example, -10 becomes 32758).

Should clipped coordinates be used here instead to avoid incorrect display output?

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8200.c line 96

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +7 -0
+static u32 vs_dc8200_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	return irqs;
+}

[Severity: High]
This is a pre-existing issue, but could this regmap_read() cause a sleep-in-atomic panic on PREEMPT_RT systems?

Since this is invoked from vs_dc_irq_handler() in hardirq context, and the regmap configuration does not seem to set use_raw_spinlock = true, the regmap infrastructure uses a standard spinlock.

On PREEMPT_RT, this maps to a sleepable rt_mutex.

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

Re: [PATCH v4 3/6] drm/verisilicon: introduce per-variant hardware ops table

In reply to Joey Lu
Quoted 145 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The DC8200 and DCUltraLite share a broadly similar register layout but
differ in how the bridge, CRTC, primary plane and IRQ paths are driven.
Introduce a vs_dc_funcs vtable so each variant can supply its own implementation without scattering conditionals across multiple files.

Add enum vs_dc_generation (VSDC_GEN_DC8000 / VSDC_GEN_DC8200) to vs_hwdb.h and a generation field to struct vs_chip_identity. Annotate
all four existing DC8200 HWDB entries with VSDC_GEN_DC8200.

Extract the DC8200-specific hardware ops into a new vs_dc8200.c:
  panel_enable_ex / panel_disable_ex - PANEL_CONFIG/START + CONFIG_EX commit
  enable_vblank / disable_vblank - TOP_IRQ_EN VSYNC bit primary_plane_enable_ex / disable_ex / update_ex - FB_CONFIG_EX path
  irq_ack - reads TOP_IRQ_ACK

Update vs_bridge.c, vs_crtc.c, vs_primary_plane.c and vs_dc.c to dispatch through dc->funcs instead of directly touching registers. vs_crtc.c gains atomic_begin and atomic_flush hooks to allow variants to gate per-frame commit cycles.

No behaviour change for existing DC8200 platforms.

---
 drivers/gpu/drm/verisilicon/Makefile          |   2 +- drivers/gpu/drm/verisilicon/vs_bridge.c       |  20 +--- drivers/gpu/drm/verisilicon/vs_crtc.c         |  38 ++++++- drivers/gpu/drm/verisilicon/vs_dc.c           |   6 +- drivers/gpu/drm/verisilicon/vs_dc.h           |  32 ++++++ drivers/gpu/drm/verisilicon/vs_dc8200.c       | 107
++++++++++++++++++
 drivers/gpu/drm/verisilicon/vs_hwdb.c         |   4 + drivers/gpu/drm/verisilicon/vs_hwdb.h         |   6 + .../gpu/drm/verisilicon/vs_primary_plane.c    |  32 +-----

 9 files changed, 196 insertions(+), 51 deletions(-)

 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8200.c

drivers/gpu/drm/verisilicon/Makefile +0 -0
index 426f4bcaa834..9d4cd16452fa 100644
@@ -1,6 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0-only


-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_drm.o vs_hwdb.o \
  vs_plane.o vs_primary_plane.o vs_cursor_plane.o
 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
index 7a93049368db..6ff2ac745b15 100644
@@ -162,15 +162,8 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,

  VSDC_DISP_PANEL_CONFIG_DE_EN | VSDC_DISP_PANEL_CONFIG_DAT_EN | VSDC_DISP_PANEL_CONFIG_CLK_EN);

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -8
-	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);
+
+	dc->funcs->panel_enable_ex(dc, output);

 }

 static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,

drivers/gpu/drm/verisilicon/vs_bridge.c +0 -0
@@ -228,14 +221,7 @@ 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 -7
-	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-
Quoted 1 line

id),

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -1
-			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+	dc->funcs->panel_disable_ex(dc, output);

 }

 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -1
index 0b8a35d09cd2..679d6541ba1b 100644
@@ -16,10 +16,33 @@
  #include "vs_crtc_regs.h"
  #include "vs_crtc.h"
  #include "vs_dc.h"
-#include "vs_dc_top_regs.h"
  #include "vs_drm.h"
  #include "vs_plane.h"

drivers/gpu/drm/verisilicon/vs_crtc.c +24 -0
+static void vs_crtc_atomic_begin(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_begin)
+		dc->funcs->crtc_begin(dc, output);
+}
+
+static void vs_crtc_atomic_flush(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_flush)
+		dc->funcs->crtc_flush(dc, output);
+
+	drm_crtc_vblank_atomic_flush(crtc, state);
+}
+

 static void vs_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_commit *state) {

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -30,6 +53,9 @@ static void vs_crtc_atomic_disable(struct drm_crtc
 *crtc,
  	drm_crtc_vblank_off(crtc);

clk_disable_unprepare(dc->pix_clk[output]);

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_disable(struct drm_crtc *crtc, · line 58

Quoted 3 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -0
+
+	if (dc->funcs->crtc_disable)
+		dc->funcs->crtc_disable(dc, output);

Should this be crtc_disable_ex ? Because the clock-related operation is shared.

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_enable(struct drm_crtc *crtc, · line 72

Quoted 10 lines

 }

 static void vs_crtc_atomic_enable(struct drm_crtc *crtc,

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -42,6 +68,9 @@ static void vs_crtc_atomic_enable(struct drm_crtc
 *crtc,
  	drm_WARN_ON(&dc->drm_dev->base,
  		    clk_prepare_enable(dc->pix_clk[output]));

drivers/gpu/drm/verisilicon/vs_crtc.c +2 -0
+	if (dc->funcs->crtc_enable)
+		dc->funcs->crtc_enable(dc, output);

Ditto for appending _ex .

Quoted 57 lines

+
  drm_crtc_vblank_on(crtc);
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -119,7 +148,8 @@ static bool vs_crtc_mode_fixup(struct drm_crtc
 *crtc,
  }


 static const struct drm_crtc_helper_funcs vs_crtc_helper_funcs = {

drivers/gpu/drm/verisilicon/vs_crtc.c +2 -1
-	.atomic_flush	= drm_crtc_vblank_atomic_flush,
+	.atomic_begin	= vs_crtc_atomic_begin,
+	.atomic_flush	= vs_crtc_atomic_flush,

  .atomic_enable = vs_crtc_atomic_enable,
  .atomic_disable = vs_crtc_atomic_disable,
  .mode_set_nofb = vs_crtc_mode_set_nofb,

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -132,7 +162,7 @@ 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 +1 -0
+	dc->funcs->enable_vblank(dc, vcrtc->id);


  return 0;
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
@@ -142,7 +172,7 @@ 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 +1 -0
+	dc->funcs->disable_vblank(dc, vcrtc->id);

 }

 static const struct drm_crtc_funcs vs_crtc_funcs = {

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index dad9967bc10b..9729b693d360 100644
@@ -8,9 +8,7 @@
  #include <linux/of.h>
  #include <linux/of_graph.h>


-#include "vs_crtc.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 +0 -0
@@ -33,7 +31,7 @@ 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 static irqreturn_t vs_dc_irq_handler(int irq, void *private) · line 34

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	irqs = dc->funcs->irq_ack(dc);

The definition of bits in 0x0010 seems to be different to ones in 0x147C, although the first 2 bits are the same. (e.g. BIT(2) is "cursor interrupt" in DC8000 0x147C but "secure reset done" in DC8200 0x0010).

Should some kind of translation be done in irq_ack ? (and add a unified interrupt definition that aims to be the translation target).

Thanks,
Icenowy

Quoted 360 lines


  vs_drm_handle_irq(dc, irqs);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -136,6 +134,8 @@ static int vs_dc_probe(struct platform_device
 *pdev)

  dev_info(dev, "Found DC%x rev %x customer %x\n", dc-

Quoted 1 line

identity.model,

  dc->identity.revision, dc->identity.customer_id);

drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	dc->funcs = &vs_dc8200_funcs;
+

  if (port_count > dc->identity.display_count) { dev_err(dev, "too many downstream ports than HW capability\n");
  ret = -EINVAL;

drivers/gpu/drm/verisilicon/vs_dc.h +0 -0
index ed1016f18758..544e1a37065b 100644
@@ -14,6 +14,7 @@
  #include <linux/reset.h>


 #include <drm/drm_device.h>
+#include <drm/drm_plane.h>

 #include "vs_hwdb.h"

drivers/gpu/drm/verisilicon/vs_dc.h +0 -0
@@ -22,6 +23,34 @@


 struct vs_drm_dev;
 struct vs_crtc;

drivers/gpu/drm/verisilicon/vs_dc.h +5 -0
+struct vs_dc;
+
+struct vs_dc_funcs {
+	/* Bridge: atomic_enable, atomic_disable */
+	void (*panel_enable_ex)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*panel_disable_ex)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +11 -0
+
+	/* CRTC: atomic_begin, atomic_flush */
+	void (*crtc_begin)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_flush)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: atomic_enable, atomic_disable */
+	void (*crtc_enable)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_disable)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: enable_vblank, disable_vblank */
+	void (*enable_vblank)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*disable_vblank)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +2 -0
+
+	/* Primary plane: atomic_enable, atomic_disable,

atomic_update */

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_enable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_disable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_update_ex)(struct vs_dc *dc, unsigned

int output,

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+					struct drm_plane_state

*state);

drivers/gpu/drm/verisilicon/vs_dc.h +4 -0
+
+	/* IRQ acknowledge */
+	u32 (*irq_ack)(struct vs_dc *dc);
+};


 struct vs_dc {
  struct regmap *regs;

drivers/gpu/drm/verisilicon/vs_dc.h +0 -0
@@ -33,6 +62,9 @@ struct vs_dc {


  struct vs_drm_dev *drm_dev;
  struct vs_chip_identity identity;

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

 };

drivers/gpu/drm/verisilicon/vs_dc.h +2 -0
+extern const struct vs_dc_funcs vs_dc8200_funcs;
+

 #endif /* _VS_DC_H_ */

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +14 -0
new file mode 100644
index 000000000000..800df9279e9b
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2025 Icenowy Zheng <[email protected]>
+ */
+
+#include <linux/regmap.h>
+
+#include "vs_bridge_regs.h"
+#include "vs_dc.h"
+#include "vs_dc_top_regs.h"
+#include "vs_plane.h"
+#include "vs_primary_plane_regs.h"
+
+static void vs_dc8200_panel_enable_ex(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +13 -0
+{
+	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(output),
+			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_panel_disable_ex(struct vs_dc *dc, unsigned

int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +12 -0
+{
+	regmap_clear_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 |
+			  VSDC_DISP_PANEL_START_RUNNING(output));
+
+	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(output),
+			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_enable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+			VSDC_TOP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8200_disable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+			  VSDC_TOP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8200_plane_commit(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			VSDC_FB_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_primary_plane_enable_ex(struct vs_dc *dc,

unsigned int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +11 -0
+{
+	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_dc8200_plane_commit(dc, output);
+}
+
+static void vs_dc8200_primary_plane_disable_ex(struct vs_dc *dc,

unsigned int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +8 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			VSDC_FB_CONFIG_EX_FB_EN);
+
+	vs_dc8200_plane_commit(dc, output);
+}
+
+static void vs_dc8200_primary_plane_update_ex(struct vs_dc *dc,

unsigned int output,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+				       struct drm_plane_state

*state)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +3 -0
+{
+	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_dc8200.c new file +2 -0
+	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_dc8200.c new file +1 -0
+					 state->crtc_y + state-
Quoted 1 line

crtc_h));

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +17 -0
+	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
+		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+
+	vs_dc8200_plane_commit(dc, output);
+}
+
+static u32 vs_dc8200_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	return irqs;
+}
+
+const struct vs_dc_funcs vs_dc8200_funcs = {
+	.panel_enable_ex		= vs_dc8200_panel_enable_ex,
+	.panel_disable_ex		=

vs_dc8200_panel_disable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +2 -0
+	.enable_vblank			= vs_dc8200_enable_vblank,
+	.disable_vblank			=

vs_dc8200_disable_vblank,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_enable_ex	=

vs_dc8200_primary_plane_enable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_disable_ex	=

vs_dc8200_primary_plane_disable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_update_ex	=

vs_dc8200_primary_plane_update_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +2 -0
+	.irq_ack			= vs_dc8200_irq_ack,
+};
drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
index 2a0f7c59afa3..91524d16f778 100644
@@ -94,6 +94,7 @@ static struct vs_chip_identity vs_chip_identities[]
 = {
  		.revision = 0x5720,
  		.customer_id = ~0U,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
+		.generation = VSDC_GEN_DC8200,

  .display_count = 2,
  .max_cursor_size = 64,
  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
@@ -103,6 +104,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5721,
  		.customer_id = 0x30B,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
+		.generation = VSDC_GEN_DC8200,

  .display_count = 2,
  .max_cursor_size = 64,
  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
@@ -112,6 +114,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5720,
  		.customer_id = 0x310,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
+		.generation = VSDC_GEN_DC8200,

  .display_count = 2, .max_cursor_size = 64, .formats = &vs_formats_with_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
@@ -121,6 +124,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5720,
  		.customer_id = 0x311,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
+		.generation = VSDC_GEN_DC8200,

  .display_count = 2,
  .max_cursor_size = 64,
  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.h +0 -0
index 2065ecb73043..a15c8b565604 100644
@@ -9,6 +9,11 @@
  #include <linux/regmap.h>
  #include <linux/types.h>

drivers/gpu/drm/verisilicon/vs_hwdb.h +5 -0
+enum vs_dc_generation {
+	VSDC_GEN_DC8000,
+	VSDC_GEN_DC8200,
+};
+

 struct vs_formats {
  const u32 *array;
  unsigned int num;

drivers/gpu/drm/verisilicon/vs_hwdb.h +0 -0
@@ -19,6 +24,7 @@ struct vs_chip_identity {
  	u32 revision;
  	u32 customer_id;

drivers/gpu/drm/verisilicon/vs_hwdb.h +1 -0
+	enum vs_dc_generation generation;

  u32 display_count;
  /*
  * The hardware only supports square cursor planes, so this field

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
index 1f2be41ae496..f992cb277f61 100644
@@ -53,12 +53,6 @@ static int vs_primary_plane_atomic_check(struct
 drm_plane *plane,
  	return 0;
  }


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

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -5
-{
-	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, struct drm_atomic_commit *atomic_state)
 {

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -69,13 +63,8 @@ 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 +2 -7
-	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);
+	if (dc->funcs->primary_plane_enable_ex)
+		dc->funcs->primary_plane_enable_ex(dc, output);

 }

 static void vs_primary_plane_atomic_disable(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -88,10 +77,8 @@ 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 +2 -4
-	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-			VSDC_FB_CONFIG_EX_FB_EN);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_disable_ex)
+		dc->funcs->primary_plane_disable_ex(dc, output);

 }

 static void vs_primary_plane_atomic_update(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -0
@@ -133,18 +120,11 @@ 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 +2 -4
-	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
-		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_update_ex)
+		dc->funcs->primary_plane_update_ex(dc, output,

state);
 }

 static const struct drm_plane_helper_funcs
vs_primary_plane_helper_funcs = {

author
#12 lore raw

Re: [PATCH v4 3/6] drm/verisilicon: introduce per-variant hardware ops table

Quoted 145 lines · Icenowy Zheng
Quoted 144 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The DC8200 and DCUltraLite share a broadly similar register layout but
differ in how the bridge, CRTC, primary plane and IRQ paths are driven.
Introduce a vs_dc_funcs vtable so each variant can supply its own implementation without scattering conditionals across multiple files.

Add enum vs_dc_generation (VSDC_GEN_DC8000 / VSDC_GEN_DC8200) to vs_hwdb.h and a generation field to struct vs_chip_identity. Annotate
all four existing DC8200 HWDB entries with VSDC_GEN_DC8200.

Extract the DC8200-specific hardware ops into a new vs_dc8200.c:
  panel_enable_ex / panel_disable_ex - PANEL_CONFIG/START + CONFIG_EX
commit
  enable_vblank / disable_vblank - TOP_IRQ_EN VSYNC bit primary_plane_enable_ex / disable_ex / update_ex - FB_CONFIG_EX
path
  irq_ack - reads TOP_IRQ_ACK

Update vs_bridge.c, vs_crtc.c, vs_primary_plane.c and vs_dc.c to dispatch through dc->funcs instead of directly touching registers. vs_crtc.c gains atomic_begin and atomic_flush hooks to allow variants to gate per-frame commit cycles.

No behaviour change for existing DC8200 platforms.

---
  drivers/gpu/drm/verisilicon/Makefile          |   2 +-
  drivers/gpu/drm/verisilicon/vs_bridge.c       |  20 +---
  drivers/gpu/drm/verisilicon/vs_crtc.c         |  38 ++++++-
  drivers/gpu/drm/verisilicon/vs_dc.c           |   6 +-
  drivers/gpu/drm/verisilicon/vs_dc.h           |  32 ++++++
  drivers/gpu/drm/verisilicon/vs_dc8200.c       | 107
++++++++++++++++++
  drivers/gpu/drm/verisilicon/vs_hwdb.c         |   4 +
  drivers/gpu/drm/verisilicon/vs_hwdb.h         |   6 +
  .../gpu/drm/verisilicon/vs_primary_plane.c    |  32 +-----
  9 files changed, 196 insertions(+), 51 deletions(-)

 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8200.c

drivers/gpu/drm/verisilicon/Makefile +1 -1
index 426f4bcaa834..9d4cd16452fa 100644
@@ -1,6 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0-only
 
-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_drm.o
 vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o
 vs_drm.o vs_hwdb.o \
  	vs_plane.o vs_primary_plane.o vs_cursor_plane.o

 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_bridge.c +2 -9
index 7a93049368db..6ff2ac745b15 100644
@@ -162,15 +162,8 @@ static void vs_bridge_enable_common(struct
 vs_crtc *crtc,
  			VSDC_DISP_PANEL_CONFIG_DE_EN |
  			VSDC_DISP_PANEL_CONFIG_DAT_EN |
  			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);
+
+	dc->funcs->panel_enable_ex(dc, output);
  }

 static void vs_bridge_atomic_enable_dpi(struct drm_bridge *bridge,

drivers/gpu/drm/verisilicon/vs_bridge.c +1 -8
@@ -228,14 +221,7 @@ 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);
+	dc->funcs->panel_disable_ex(dc, output);
  }

 static const struct drm_bridge_funcs vs_dpi_bridge_funcs = {

drivers/gpu/drm/verisilicon/vs_crtc.c +24 -1
index 0b8a35d09cd2..679d6541ba1b 100644
@@ -16,10 +16,33 @@
  #include "vs_crtc_regs.h"
  #include "vs_crtc.h"
  #include "vs_dc.h"
-#include "vs_dc_top_regs.h"
  #include "vs_drm.h"
  #include "vs_plane.h"
 
+static void vs_crtc_atomic_begin(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_begin)
+		dc->funcs->crtc_begin(dc, output);
+}
+
+static void vs_crtc_atomic_flush(struct drm_crtc *crtc,
+				  struct drm_atomic_commit *state)
+{
+	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
+	struct vs_dc *dc = vcrtc->dc;
+	unsigned int output = vcrtc->id;
+
+	if (dc->funcs->crtc_flush)
+		dc->funcs->crtc_flush(dc, output);
+
+	drm_crtc_vblank_atomic_flush(crtc, state);
+}
+
  static void vs_crtc_atomic_disable(struct drm_crtc *crtc,
  				   struct drm_atomic_commit *state)
  {
@@ -30,6 +53,9 @@ static void vs_crtc_atomic_disable(struct drm_crtc
 *crtc,
  	drm_crtc_vblank_off(crtc);
 
Quoted 6 lines

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_disable(struct drm_crtc *crtc, · line 58

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -0
  	clk_disable_unprepare(dc->pix_clk[output]);
+
+	if (dc->funcs->crtc_disable)
+		dc->funcs->crtc_disable(dc, output);

Should this be crtc_disable_ex ? Because the clock-related operation is shared.

I will rename crtc_disable to crtc_disable_ex and crtc_enable to crtc_enable_ex in v5 to make clear these hooks extend the shared clock operations rather than replace them.

Quoted 11 lines

drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_enable(struct drm_crtc · line 73

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +0 -0
  }
 

 static void vs_crtc_atomic_enable(struct drm_crtc *crtc,

drivers/gpu/drm/verisilicon/vs_crtc.c +2 -0
@@ -42,6 +68,9 @@ static void vs_crtc_atomic_enable(struct drm_crtc
 *crtc,
  	drm_WARN_ON(&dc->drm_dev->base,
  		    clk_prepare_enable(dc->pix_clk[output]));
 
+	if (dc->funcs->crtc_enable)
+		dc->funcs->crtc_enable(dc, output);

Ditto for appending _ex .

Addressed above.

Quoted 430 lines
Quoted 53 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -1
+
  	drm_crtc_vblank_on(crtc);
  }
@@ -119,7 +148,8 @@ static bool vs_crtc_mode_fixup(struct drm_crtc
 *crtc,
  }
 
  static const struct drm_crtc_helper_funcs vs_crtc_helper_funcs = {
-	.atomic_flush	= drm_crtc_vblank_atomic_flush,
+	.atomic_begin	= vs_crtc_atomic_begin,
+	.atomic_flush	= vs_crtc_atomic_flush,
  	.atomic_enable	= vs_crtc_atomic_enable,
  	.atomic_disable	= vs_crtc_atomic_disable,

  .mode_set_nofb = vs_crtc_mode_set_nofb,

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -1
@@ -132,7 +162,7 @@ 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));
+	dc->funcs->enable_vblank(dc, vcrtc->id);
 

  return 0;
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -1
@@ -142,7 +172,7 @@ 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));
+	dc->funcs->disable_vblank(dc, vcrtc->id);
  }

 static const struct drm_crtc_funcs vs_crtc_funcs = {

drivers/gpu/drm/verisilicon/vs_dc.c +0 -2
index dad9967bc10b..9729b693d360 100644
@@ -8,9 +8,7 @@
  #include <linux/of.h>
  #include <linux/of_graph.h>
 
-#include "vs_crtc.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 static irqreturn_t vs_dc_irq_handler(int irq, void · line 35

Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
@@ -33,7 +31,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  	struct vs_dc *dc = private;
  	u32 irqs;
 
-	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	irqs = dc->funcs->irq_ack(dc);

The definition of bits in 0x0010 seems to be different to ones in 0x147C, although the first 2 bits are the same. (e.g. BIT(2) is "cursor interrupt" in DC8000 0x147C but "secure reset done" in DC8200 0x0010).

Should some kind of translation be done in irq_ack ? (and add a unified interrupt definition that aims to be the translation target).

Thanks,
Icenowy

Quoted 360 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
  	vs_drm_handle_irq(dc, irqs);
 
@@ -136,6 +134,8 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	dev_info(dev, "Found DC%x rev %x customer %x\n", dc-
 > identity.model,
  		 dc->identity.revision, dc->identity.customer_id);
 
+	dc->funcs = &vs_dc8200_funcs;
+
  	if (port_count > dc->identity.display_count) {

  dev_err(dev, "too many downstream ports than HW
capability\n");
  ret = -EINVAL;

drivers/gpu/drm/verisilicon/vs_dc.h +19 -0
index ed1016f18758..544e1a37065b 100644
@@ -14,6 +14,7 @@
  #include <linux/reset.h>
 
  #include <drm/drm_device.h>
+#include <drm/drm_plane.h>
 
  #include "vs_hwdb.h"
 
@@ -22,6 +23,34 @@
 
  struct vs_drm_dev;
  struct vs_crtc;
+struct vs_dc;
+
+struct vs_dc_funcs {
+	/* Bridge: atomic_enable, atomic_disable */
+	void (*panel_enable_ex)(struct vs_dc *dc, unsigned int
 output);
+	void (*panel_disable_ex)(struct vs_dc *dc, unsigned int
 output);
+
+	/* CRTC: atomic_begin, atomic_flush */
+	void (*crtc_begin)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_flush)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: atomic_enable, atomic_disable */
+	void (*crtc_enable)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_disable)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: enable_vblank, disable_vblank */
+	void (*enable_vblank)(struct vs_dc *dc, unsigned int
 output);
+	void (*disable_vblank)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +2 -0
+
+	/* Primary plane: atomic_enable, atomic_disable,

atomic_update */

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_enable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_disable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_update_ex)(struct vs_dc *dc, unsigned

int output,

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+					struct drm_plane_state

*state);

drivers/gpu/drm/verisilicon/vs_dc.h +7 -0
+
+	/* IRQ acknowledge */
+	u32 (*irq_ack)(struct vs_dc *dc);
+};
 
  struct vs_dc {
  	struct regmap *regs;
@@ -33,6 +62,9 @@ struct vs_dc {
 
  	struct vs_drm_dev *drm_dev;
  	struct vs_chip_identity identity;
+	const struct vs_dc_funcs *funcs;
  };
 
+extern const struct vs_dc_funcs vs_dc8200_funcs;
+
  #endif /* _VS_DC_H_ */
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +14 -0
new file mode 100644
index 000000000000..800df9279e9b
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2025 Icenowy Zheng <[email protected]>
+ */
+
+#include <linux/regmap.h>
+
+#include "vs_bridge_regs.h"
+#include "vs_dc.h"
+#include "vs_dc_top_regs.h"
+#include "vs_plane.h"
+#include "vs_primary_plane_regs.h"
+
+static void vs_dc8200_panel_enable_ex(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +13 -0
+{
+	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(output),
+			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_panel_disable_ex(struct vs_dc *dc, unsigned

int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +12 -0
+{
+	regmap_clear_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 |
+			  VSDC_DISP_PANEL_START_RUNNING(output));
+
+	regmap_set_bits(dc->regs, VSDC_DISP_PANEL_CONFIG_EX(output),
+			VSDC_DISP_PANEL_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_enable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_TOP_IRQ_EN,
+			VSDC_TOP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8200_disable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_TOP_IRQ_EN,
+			  VSDC_TOP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8200_plane_commit(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			VSDC_FB_CONFIG_EX_COMMIT);
+}
+
+static void vs_dc8200_primary_plane_enable_ex(struct vs_dc *dc,

unsigned int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +11 -0
+{
+	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_dc8200_plane_commit(dc, output);
+}
+
+static void vs_dc8200_primary_plane_disable_ex(struct vs_dc *dc,

unsigned int output)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +8 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+			VSDC_FB_CONFIG_EX_FB_EN);
+
+	vs_dc8200_plane_commit(dc, output);
+}
+
+static void vs_dc8200_primary_plane_update_ex(struct vs_dc *dc,

unsigned int output,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+				       struct drm_plane_state

*state)

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +3 -0
+{
+	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_dc8200.c new file +2 -0
+	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_dc8200.c new file +1 -0
+					 state->crtc_y + state-
Quoted 1 line

crtc_h));

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +17 -0
+	regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
+		     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
+
+	vs_dc8200_plane_commit(dc, output);
+}
+
+static u32 vs_dc8200_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	return irqs;
+}
+
+const struct vs_dc_funcs vs_dc8200_funcs = {
+	.panel_enable_ex		= vs_dc8200_panel_enable_ex,
+	.panel_disable_ex		=

vs_dc8200_panel_disable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +2 -0
+	.enable_vblank			= vs_dc8200_enable_vblank,
+	.disable_vblank			=

vs_dc8200_disable_vblank,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_enable_ex	=

vs_dc8200_primary_plane_enable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_disable_ex	=

vs_dc8200_primary_plane_disable_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +1 -0
+	.primary_plane_update_ex	=

vs_dc8200_primary_plane_update_ex,

drivers/gpu/drm/verisilicon/vs_dc8200.c new file +2 -0
+	.irq_ack			= vs_dc8200_irq_ack,
+};
drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
index 2a0f7c59afa3..91524d16f778 100644
@@ -94,6 +94,7 @@ static struct vs_chip_identity vs_chip_identities[]
 = {
  		.revision = 0x5720,
  		.customer_id = ~0U,
 
+		.generation = VSDC_GEN_DC8200,
  		.display_count = 2,
  		.max_cursor_size = 64,

  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
@@ -103,6 +104,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5721,
  		.customer_id = 0x30B,
 
+		.generation = VSDC_GEN_DC8200,
  		.display_count = 2,
  		.max_cursor_size = 64,

  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
@@ -112,6 +114,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5720,
  		.customer_id = 0x310,
 
+		.generation = VSDC_GEN_DC8200,
  		.display_count = 2,
  		.max_cursor_size = 64,

  .formats = &vs_formats_with_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.c +1 -0
@@ -121,6 +124,7 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.revision = 0x5720,
  		.customer_id = 0x311,
 
+		.generation = VSDC_GEN_DC8200,
  		.display_count = 2,
  		.max_cursor_size = 64,

  .formats = &vs_formats_no_yuv444,

drivers/gpu/drm/verisilicon/vs_hwdb.h +6 -0
index 2065ecb73043..a15c8b565604 100644
@@ -9,6 +9,11 @@
  #include <linux/regmap.h>
  #include <linux/types.h>
 
+enum vs_dc_generation {
+	VSDC_GEN_DC8000,
+	VSDC_GEN_DC8200,
+};
+
  struct vs_formats {
  	const u32 *array;
  	unsigned int num;
@@ -19,6 +24,7 @@ struct vs_chip_identity {
  	u32 revision;
  	u32 customer_id;
 
+	enum vs_dc_generation generation;
  	u32 display_count;
  	/*
  	 * The hardware only supports square cursor planes, so this

field

drivers/gpu/drm/verisilicon/vs_primary_plane.c +0 -6
index 1f2be41ae496..f992cb277f61 100644
@@ -53,12 +53,6 @@ static int vs_primary_plane_atomic_check(struct
 drm_plane *plane,
  	return 0;
  }
 
-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);
-}
-
  static void vs_primary_plane_atomic_enable(struct drm_plane *plane,

     struct drm_atomic_commit
*atomic_state)
 {

drivers/gpu/drm/verisilicon/vs_primary_plane.c +2 -7
@@ -69,13 +63,8 @@ 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));
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_enable_ex)
+		dc->funcs->primary_plane_enable_ex(dc, output);
  }
 

 static void vs_primary_plane_atomic_disable(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +2 -4
@@ -88,10 +77,8 @@ 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);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_disable_ex)
+		dc->funcs->primary_plane_disable_ex(dc, output);
  }
 

 static void vs_primary_plane_atomic_update(struct drm_plane *plane,

drivers/gpu/drm/verisilicon/vs_primary_plane.c +2 -9
@@ -133,18 +120,11 @@ 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);
-
-	vs_primary_plane_commit(dc, output);
+	if (dc->funcs->primary_plane_update_ex)
+		dc->funcs->primary_plane_update_ex(dc, output,

state);
 }

 static const struct drm_plane_helper_funcs
vs_primary_plane_helper_funcs = {

author
#13 lore raw

Re: [PATCH v4 3/6] drm/verisilicon: introduce per-variant hardware ops table

In reply to Icenowy Zheng
Quoted 66 lines · Icenowy Zheng
Quoted 53 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:
drivers/gpu/drm/verisilicon/vs_crtc.c +3 -1
+
  	drm_crtc_vblank_on(crtc);
  }
@@ -119,7 +148,8 @@ static bool vs_crtc_mode_fixup(struct drm_crtc
 *crtc,
  }
 
  static const struct drm_crtc_helper_funcs vs_crtc_helper_funcs = {
-	.atomic_flush	= drm_crtc_vblank_atomic_flush,
+	.atomic_begin	= vs_crtc_atomic_begin,
+	.atomic_flush	= vs_crtc_atomic_flush,
  	.atomic_enable	= vs_crtc_atomic_enable,
  	.atomic_disable	= vs_crtc_atomic_disable,

  .mode_set_nofb = vs_crtc_mode_set_nofb,

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -1
@@ -132,7 +162,7 @@ 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));
+	dc->funcs->enable_vblank(dc, vcrtc->id);
 

  return 0;
 }

drivers/gpu/drm/verisilicon/vs_crtc.c +1 -1
@@ -142,7 +172,7 @@ 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));
+	dc->funcs->disable_vblank(dc, vcrtc->id);
  }

 static const struct drm_crtc_funcs vs_crtc_funcs = {

drivers/gpu/drm/verisilicon/vs_dc.c +0 -2
index dad9967bc10b..9729b693d360 100644
@@ -8,9 +8,7 @@
  #include <linux/of.h>
  #include <linux/of_graph.h>
 
-#include "vs_crtc.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 static irqreturn_t vs_dc_irq_handler(int irq, void · line 35

Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
@@ -33,7 +31,7 @@ static irqreturn_t vs_dc_irq_handler(int irq, void
 *private)
  	struct vs_dc *dc = private;
  	u32 irqs;
 
-	regmap_read(dc->regs, VSDC_TOP_IRQ_ACK, &irqs);
+	irqs = dc->funcs->irq_ack(dc);

The definition of bits in 0x0010 seems to be different to ones in 0x147C, although the first 2 bits are the same. (e.g. BIT(2) is "cursor interrupt" in DC8000 0x147C but "secure reset done" in DC8200 0x0010).

Quoted 5 lines

Should some kind of translation be done in irq_ack ? (and add a unified interrupt definition that aims to be the translation target).

Thanks,
Icenowy

I will add a set of unified IRQ bit definitions (e.g. VSDC_IRQ_VSYNC(n)) in a shared header. Each irq_ack implementation will translate its hardware-specific register bits into those unified bits before returning, so vs_drm_handle_irq can use the unified definitions without knowing which register layout was used. Currently the VSYNC bits (BIT(0)/BIT(1)) coincide between DC8200 0x0010 and DC8000 0x147C, so the translation is trivial; this change will prevent future confusion from diverging bit meanings (such as BIT(2)).

Quoted 84 lines
Quoted 84 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
  	vs_drm_handle_irq(dc, irqs);
 
@@ -136,6 +134,8 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	dev_info(dev, "Found DC%x rev %x customer %x\n", dc-
 > identity.model,
  		 dc->identity.revision, dc->identity.customer_id);
 
+	dc->funcs = &vs_dc8200_funcs;
+
  	if (port_count > dc->identity.display_count) {

  dev_err(dev, "too many downstream ports than HW
capability\n");
  ret = -EINVAL;

drivers/gpu/drm/verisilicon/vs_dc.h +19 -0
index ed1016f18758..544e1a37065b 100644
@@ -14,6 +14,7 @@
  #include <linux/reset.h>
 
  #include <drm/drm_device.h>
+#include <drm/drm_plane.h>
 
  #include "vs_hwdb.h"
 
@@ -22,6 +23,34 @@
 
  struct vs_drm_dev;
  struct vs_crtc;
+struct vs_dc;
+
+struct vs_dc_funcs {
+	/* Bridge: atomic_enable, atomic_disable */
+	void (*panel_enable_ex)(struct vs_dc *dc, unsigned int
 output);
+	void (*panel_disable_ex)(struct vs_dc *dc, unsigned int
 output);
+
+	/* CRTC: atomic_begin, atomic_flush */
+	void (*crtc_begin)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_flush)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: atomic_enable, atomic_disable */
+	void (*crtc_enable)(struct vs_dc *dc, unsigned int output);
+	void (*crtc_disable)(struct vs_dc *dc, unsigned int output);
+
+	/* CRTC: enable_vblank, disable_vblank */
+	void (*enable_vblank)(struct vs_dc *dc, unsigned int
 output);
+	void (*disable_vblank)(struct vs_dc *dc, unsigned int

output);

drivers/gpu/drm/verisilicon/vs_dc.h +2 -0
+
+	/* Primary plane: atomic_enable, atomic_disable,

atomic_update */

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_enable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_disable_ex)(struct vs_dc *dc, unsigned

int output);

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+	void (*primary_plane_update_ex)(struct vs_dc *dc, unsigned

int output,

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
+					struct drm_plane_state

*state);

drivers/gpu/drm/verisilicon/vs_dc.h +7 -0
+
+	/* IRQ acknowledge */
+	u32 (*irq_ack)(struct vs_dc *dc);
+};
 
  struct vs_dc {
  	struct regmap *regs;
@@ -33,6 +62,9 @@ struct vs_dc {
 
  	struct vs_drm_dev *drm_dev;
  	struct vs_chip_identity identity;
+	const struct vs_dc_funcs *funcs;
  };
 
+extern const struct vs_dc_funcs vs_dc8200_funcs;
+
  #endif /* _VS_DC_H_ */
author
#14 lore raw

PATCH v4 4/6 drm/verisilicon: add DC8000 (DCUltraLite) display controller support

In reply to Joey Lu

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller whose register layout differs from the DC8200 in several important ways:

1. No CONFIG_EX commit path: framebuffer updates use the enable (bit 0) and reset (bit 4) bits in FB_CONFIG instead of the DC8200 staging registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX).

2. No PANEL_START register: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync start register.

3. Different IRQ registers: DCUltraLite uses DISP_IRQ_STA (0x147C) / DISP_IRQ_EN (0x1480) versus DC8200's TOP_IRQ_ACK (0x0010) / TOP_IRQ_EN (0x0014).

4. Per-frame commit cycle: DCUltraLite requires the VALID bit in FB_CONFIG to be set at the start of each atomic commit (crtc_begin) and cleared after (crtc_flush).

5. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required. Make axi_clk and ahb_clk optional (devm_clk_get_optional_enabled) so DC8000 nodes without those clocks are handled gracefully.

Add vs_dc8000.c implementing the vs_dc_funcs vtable for the above differences. The probe now selects vs_dc8000_funcs when the identified generation is VSDC_GEN_DC8000 (DCUltraLite reads model 0x0, revision 0x5560, customer_id 0x305).

---
 drivers/gpu/drm/verisilicon/Makefile    |  2 +-
 drivers/gpu/drm/verisilicon/vs_dc.c     |  9 ++-
 drivers/gpu/drm/verisilicon/vs_dc.h     |  1 +
 drivers/gpu/drm/verisilicon/vs_dc8000.c | 78 +++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c
drivers/gpu/drm/verisilicon/Makefile +1 -1
index 9d4cd16452fa..d2fd8e4dff24 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_dc8000.o vs_drm.o vs_hwdb.o \
 	vs_plane.o vs_primary_plane.o vs_cursor_plane.o
 
 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o
drivers/gpu/drm/verisilicon/vs_dc.c +6 -3
index 9729b693d360..9499fffbca58 100644
@@ -90,13 +90,13 @@ static int vs_dc_probe(struct platform_device *pdev)
 		return PTR_ERR(dc->core_clk);
 	}
 
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+	dc->axi_clk = devm_clk_get_optional_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");
+	dc->ahb_clk = devm_clk_get_optional_enabled(dev, "ahb");
 	if (IS_ERR(dc->ahb_clk)) {
 		dev_err(dev, "can't get ahb clock\n");
 		return PTR_ERR(dc->ahb_clk);
@@ -134,7 +134,10 @@ static int vs_dc_probe(struct platform_device *pdev)
 	dev_info(dev, "Found DC%x rev %x customer %x\n", dc->identity.model,
 		 dc->identity.revision, dc->identity.customer_id);
 
-	dc->funcs = &vs_dc8200_funcs;
+	if (dc->identity.generation == VSDC_GEN_DC8200)
+		dc->funcs = &vs_dc8200_funcs;
+	else
+		dc->funcs = &vs_dc8000_funcs;
 
 	if (port_count > dc->identity.display_count) {
 		dev_err(dev, "too many downstream ports than HW capability\n");
drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
index 544e1a37065b..5218e8cf63e2 100644
@@ -66,5 +66,6 @@ struct vs_dc {
 };
 
 extern const struct vs_dc_funcs vs_dc8200_funcs;
+extern const struct vs_dc_funcs vs_dc8000_funcs;
 
 #endif /* _VS_DC_H_ */
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer
#15 lore raw

Re: [PATCH v4 4/6] drm/verisilicon: add DC8000 (DCUltraLite) display controller support

Quoted 76 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller whose register layout differs from the DC8200 in several important ways:

1. No CONFIG_EX commit path: framebuffer updates use the enable (bit
0)
   and reset (bit 4) bits in FB_CONFIG instead of the DC8200 staging registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX).

2. No PANEL_START register: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync start register.

3. Different IRQ registers: DCUltraLite uses DISP_IRQ_STA (0x147C) / DISP_IRQ_EN (0x1480) versus DC8200's TOP_IRQ_ACK (0x0010) / TOP_IRQ_EN (0x0014).

4. Per-frame commit cycle: DCUltraLite requires the VALID bit in FB_CONFIG to be set at the start of each atomic commit (crtc_begin)
   and cleared after (crtc_flush).

5. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.  Make axi_clk and ahb_clk optional (devm_clk_get_optional_enabled) so DC8000 nodes without those clocks are handled gracefully.

Add vs_dc8000.c implementing the vs_dc_funcs vtable for the above differences.  The probe now selects vs_dc8000_funcs when the identified
generation is VSDC_GEN_DC8000 (DCUltraLite reads model 0x0, revision 0x5560, customer_id 0x305).

---
 drivers/gpu/drm/verisilicon/Makefile    |  2 +-
 drivers/gpu/drm/verisilicon/vs_dc.c     |  9 ++-
 drivers/gpu/drm/verisilicon/vs_dc.h     |  1 +
 drivers/gpu/drm/verisilicon/vs_dc8000.c | 78
+++++++++++++++++++++++++

 4 files changed, 86 insertions(+), 4 deletions(-)

 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c

drivers/gpu/drm/verisilicon/Makefile +0 -0
index 9d4cd16452fa..d2fd8e4dff24 100644
@@ -1,6 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0-only


-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_dc8000.o vs_drm.o vs_hwdb.o \
  vs_plane.o vs_primary_plane.o vs_cursor_plane.o
 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index 9729b693d360..9499fffbca58 100644
@@ -90,13 +90,13 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return PTR_ERR(dc->core_clk);
  	}

drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+	dc->axi_clk = devm_clk_get_optional_enabled(dev, "axi");

  if (IS_ERR(dc->axi_clk)) { dev_err(dev, "can't get axi clock\n"); return PTR_ERR(dc->axi_clk); }

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

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
+	dc->ahb_clk = devm_clk_get_optional_enabled(dev, "ahb");

Please make the clock change a separated patch for atomicity.

BTW the MA35D1 manual's clock tree shows that DCUltra appears on AXI2 ACLK, AHB_HCLK2, behind a mux of SYS-PLL/EPLL-DIV2 (which seems to be the core clock), and behind a divider (which seems to be the pixel clock).

However it's weird that only one DCUltra Clock Enable Bit exists despite both bus clocks have "ICG" (I think it means "Integrated Clock Gating"). In addition the linux clk-ma35d1 driver assigns "dcu_gate" as a downstream of "dcu_mux", although the Figure 6.5-2 in the TRM shows no ICG after the "Display core CLK" mux.

Is the two bus clocks controlled by a single gate bit, and is the bit also gating DC core clock?

Thanks,
Icenowy

Quoted 123 lines

  if (IS_ERR(dc->ahb_clk)) { dev_err(dev, "can't get ahb clock\n"); return PTR_ERR(dc->ahb_clk);

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
@@ -134,7 +134,10 @@ static int vs_dc_probe(struct platform_device
 *pdev)

  dev_info(dev, "Found DC%x rev %x customer %x\n", dc-

Quoted 1 line

identity.model,

  dc->identity.revision, dc->identity.customer_id);

drivers/gpu/drm/verisilicon/vs_dc.c +4 -1
-	dc->funcs = &vs_dc8200_funcs;
+	if (dc->identity.generation == VSDC_GEN_DC8200)
+		dc->funcs = &vs_dc8200_funcs;
+	else
+		dc->funcs = &vs_dc8000_funcs;


  if (port_count > dc->identity.display_count) { dev_err(dev, "too many downstream ports than HW capability\n");

drivers/gpu/drm/verisilicon/vs_dc.h +0 -0
index 544e1a37065b..5218e8cf63e2 100644
@@ -66,5 +66,6 @@ struct vs_dc {
  };


 extern const struct vs_dc_funcs vs_dc8200_funcs;
+extern const struct vs_dc_funcs vs_dc8000_funcs;

 #endif /* _VS_DC_H_ */

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +12 -0
new file mode 100644
index 000000000000..be0c0d7baf52
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 Joey Lu <[email protected]>
+ */
+
+#include <linux/regmap.h>
+
+#include "vs_crtc_regs.h"
+#include "vs_dc.h"
+#include "vs_primary_plane_regs.h"
+
+static void vs_dc8000_panel_enable_ex(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_RESET);
+}
+
+static void vs_dc8000_panel_disable_ex(struct vs_dc *dc, unsigned

int output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_RESET);
+}
+
+static void vs_dc8000_crtc_begin(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_VALID);
+}
+
+static void vs_dc8000_crtc_flush(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_VALID);
+}
+
+static void vs_dc8000_crtc_enable(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_ENABLE);
+}
+
+static void vs_dc8000_crtc_disable(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_ENABLE);
+}
+
+static void vs_dc8000_enable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_DISP_IRQ_EN,
+			VSDC_DISP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8000_disable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +24 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_DISP_IRQ_EN,
+			  VSDC_DISP_IRQ_VSYNC(output));
+}
+
+static u32 vs_dc8000_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);
+	return irqs;
+}
+
+const struct vs_dc_funcs vs_dc8000_funcs = {
+	.panel_enable_ex	= vs_dc8000_panel_enable_ex,
+	.panel_disable_ex	= vs_dc8000_panel_disable_ex,
+	.crtc_begin		= vs_dc8000_crtc_begin,
+	.crtc_flush		= vs_dc8000_crtc_flush,
+	.crtc_enable		= vs_dc8000_crtc_enable,
+	.crtc_disable		= vs_dc8000_crtc_disable,
+	.enable_vblank		= vs_dc8000_enable_vblank,
+	.disable_vblank		= vs_dc8000_disable_vblank,
+	.irq_ack		= vs_dc8000_irq_ack,
+};
author
#16 lore raw

Re: [PATCH v4 4/6] drm/verisilicon: add DC8000 (DCUltraLite) display controller support

Quoted 92 lines · Icenowy Zheng
Quoted 68 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller whose register layout differs from the DC8200 in several important ways:

1. No CONFIG_EX commit path: framebuffer updates use the enable (bit
0)
   and reset (bit 4) bits in FB_CONFIG instead of the DC8200 staging registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX).

2. No PANEL_START register: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync start register.

3. Different IRQ registers: DCUltraLite uses DISP_IRQ_STA (0x147C) / DISP_IRQ_EN (0x1480) versus DC8200's TOP_IRQ_ACK (0x0010) / TOP_IRQ_EN (0x0014).

4. Per-frame commit cycle: DCUltraLite requires the VALID bit in FB_CONFIG to be set at the start of each atomic commit
(crtc_begin)
   and cleared after (crtc_flush).

5. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.  Make axi_clk and ahb_clk optional (devm_clk_get_optional_enabled) so DC8000 nodes without those clocks are handled gracefully.

Add vs_dc8000.c implementing the vs_dc_funcs vtable for the above differences.  The probe now selects vs_dc8000_funcs when the identified
generation is VSDC_GEN_DC8000 (DCUltraLite reads model 0x0, revision 0x5560, customer_id 0x305).

---
  drivers/gpu/drm/verisilicon/Makefile    |  2 +-
  drivers/gpu/drm/verisilicon/vs_dc.c     |  9 ++-
  drivers/gpu/drm/verisilicon/vs_dc.h     |  1 +
  drivers/gpu/drm/verisilicon/vs_dc8000.c | 78
+++++++++++++++++++++++++
  4 files changed, 86 insertions(+), 4 deletions(-)

 create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c

drivers/gpu/drm/verisilicon/Makefile +1 -1
index 9d4cd16452fa..d2fd8e4dff24 100644
@@ -1,6 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0-only
 
-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o
 vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o
 vs_dc8000.o vs_drm.o vs_hwdb.o \
  	vs_plane.o vs_primary_plane.o vs_cursor_plane.o

 obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index 9729b693d360..9499fffbca58 100644
@@ -90,13 +90,13 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  		return PTR_ERR(dc->core_clk);
  	}

drivers/gpu/drm/verisilicon/vs_dc.c static int vs_dc_probe(struct platform_device · line 100

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -2
 
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+	dc->axi_clk = devm_clk_get_optional_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");
+	dc->ahb_clk = devm_clk_get_optional_enabled(dev, "ahb");

Please make the clock change a separated patch for atomicity.

BTW the MA35D1 manual's clock tree shows that DCUltra appears on AXI2 ACLK, AHB_HCLK2, behind a mux of SYS-PLL/EPLL-DIV2 (which seems to be the core clock), and behind a divider (which seems to be the pixel clock).

However it's weird that only one DCUltra Clock Enable Bit exists despite both bus clocks have "ICG" (I think it means "Integrated Clock Gating"). In addition the linux clk-ma35d1 driver assigns "dcu_gate" as a downstream of "dcu_mux", although the Figure 6.5-2 in the TRM shows no ICG after the "Display core CLK" mux.

Quoted 5 lines

Is the two bus clocks controlled by a single gate bit, and is the bit also gating DC core clock?

Thanks,
Icenowy

I will split the axi/ahb optional-clock change into its own patch in v5 for atomicity.
Regarding the MA35D1 clock tree: from the TRM, the single "dcu_gate" bit gates both bus clocks (AXI ACLK and AHB HCLK) together with the display core clock through the same ICG cell. The clk-ma35d1 driver exposes only "dcu_gate" (downstream of "dcu_mux") and does not provide separate axi/ahb clock entries. Therefore the MA35D1 DT binding will use only two clocks ("core" and "pix0"); making axi and ahb optional in the driver is the correct approach, and this will be stated clearly in the split-out patch.

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

  return PTR_ERR(dc->ahb_clk);

drivers/gpu/drm/verisilicon/vs_dc.c +4 -1
@@ -134,7 +134,10 @@ static int vs_dc_probe(struct platform_device
 *pdev)
  	dev_info(dev, "Found DC%x rev %x customer %x\n", dc-
 > identity.model,
  		 dc->identity.revision, dc->identity.customer_id);
 
-	dc->funcs = &vs_dc8200_funcs;
+	if (dc->identity.generation == VSDC_GEN_DC8200)
+		dc->funcs = &vs_dc8200_funcs;
+	else
+		dc->funcs = &vs_dc8000_funcs;
 

  if (port_count > dc->identity.display_count) { dev_err(dev, "too many downstream ports than HW
capability\n");

drivers/gpu/drm/verisilicon/vs_dc.h +1 -0
index 544e1a37065b..5218e8cf63e2 100644
@@ -66,5 +66,6 @@ struct vs_dc {
  };
 
  extern const struct vs_dc_funcs vs_dc8200_funcs;
+extern const struct vs_dc_funcs vs_dc8000_funcs;
 
  #endif /* _VS_DC_H_ */
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +12 -0
new file mode 100644
index 000000000000..be0c0d7baf52
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 Joey Lu <[email protected]>
+ */
+
+#include <linux/regmap.h>
+
+#include "vs_crtc_regs.h"
+#include "vs_dc.h"
+#include "vs_primary_plane_regs.h"
+
+static void vs_dc8000_panel_enable_ex(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_RESET);
+}
+
+static void vs_dc8000_panel_disable_ex(struct vs_dc *dc, unsigned

int output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_RESET);
+}
+
+static void vs_dc8000_crtc_begin(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_VALID);
+}
+
+static void vs_dc8000_crtc_flush(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_VALID);
+}
+
+static void vs_dc8000_crtc_enable(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_ENABLE);
+}
+
+static void vs_dc8000_crtc_disable(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_ENABLE);
+}
+
+static void vs_dc8000_enable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6 -0
+{
+	regmap_set_bits(dc->regs, VSDC_DISP_IRQ_EN,
+			VSDC_DISP_IRQ_VSYNC(output));
+}
+
+static void vs_dc8000_disable_vblank(struct vs_dc *dc, unsigned int

output)

drivers/gpu/drm/verisilicon/vs_dc8000.c new file +24 -0
+{
+	regmap_clear_bits(dc->regs, VSDC_DISP_IRQ_EN,
+			  VSDC_DISP_IRQ_VSYNC(output));
+}
+
+static u32 vs_dc8000_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);
+	return irqs;
+}
+
+const struct vs_dc_funcs vs_dc8000_funcs = {
+	.panel_enable_ex	= vs_dc8000_panel_enable_ex,
+	.panel_disable_ex	= vs_dc8000_panel_disable_ex,
+	.crtc_begin		= vs_dc8000_crtc_begin,
+	.crtc_flush		= vs_dc8000_crtc_flush,
+	.crtc_enable		= vs_dc8000_crtc_enable,
+	.crtc_disable		= vs_dc8000_crtc_disable,
+	.enable_vblank		= vs_dc8000_enable_vblank,
+	.disable_vblank		= vs_dc8000_disable_vblank,
+	.irq_ack		= vs_dc8000_irq_ack,
+};
maintainer
#17 lore raw

Re: [PATCH v4 4/6] drm/verisilicon: add DC8000 (DCUltraLite) display controller support

(CC'ed clk maintainers for weird clock gate bit)

Quoted 114 lines · 在 2026-06-17三的 18:35 +0800,Joey Lu写道:
Quoted 106 lines · Icenowy Zheng
Quoted 85 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display
controller whose register layout differs from the DC8200 in several
important ways:

1. No CONFIG_EX commit path: framebuffer updates use the enable (bit
0)
    and reset (bit 4) bits in FB_CONFIG instead of the DC8200 staging
    registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX).

2. No PANEL_START register: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync start
    register.

3. Different IRQ registers: DCUltraLite uses DISP_IRQ_STA (0x147C) /
    DISP_IRQ_EN (0x1480) versus DC8200's TOP_IRQ_ACK (0x0010) / TOP_IRQ_EN (0x0014).

4. Per-frame commit cycle: DCUltraLite requires the VALID bit in FB_CONFIG to be set at the start of each atomic commit (crtc_begin)
    and cleared after (crtc_flush).

5. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel
    divider) clocks; no axi or ahb clocks required.  Make axi_clk and
    ahb_clk optional (devm_clk_get_optional_enabled) so DC8000 nodes
    without those clocks are handled gracefully.

Add vs_dc8000.c implementing the vs_dc_funcs vtable for the above differences.  The probe now selects vs_dc8000_funcs when the identified
generation is VSDC_GEN_DC8000 (DCUltraLite reads model 0x0, revision 0x5560, customer_id 0x305).

---
  drivers/gpu/drm/verisilicon/Makefile    |  2 +- drivers/gpu/drm/verisilicon/vs_dc.c     |  9 ++- drivers/gpu/drm/verisilicon/vs_dc.h     |  1 + drivers/gpu/drm/verisilicon/vs_dc8000.c | 78
+++++++++++++++++++++++++

  4 files changed, 86 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c

drivers/gpu/drm/verisilicon/Makefile +0 -0
index 9d4cd16452fa..d2fd8e4dff24 100644
@@ -1,6 +1,6 @@
   # SPDX-License-Identifier: GPL-2.0-only


-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o vs_dc8000.o vs_drm.o vs_hwdb.o \
   vs_plane.o vs_primary_plane.o vs_cursor_plane.o
  obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index 9729b693d360..9499fffbca58 100644
@@ -90,13 +90,13 @@ static int vs_dc_probe(struct platform_device
 *pdev)
   		return PTR_ERR(dc->core_clk);
   	}

drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+	dc->axi_clk = devm_clk_get_optional_enabled(dev, "axi");

   if (IS_ERR(dc->axi_clk)) { dev_err(dev, "can't get axi clock\n"); return PTR_ERR(dc->axi_clk); }

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

Quoted 2 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1 -1
-	dc->ahb_clk = devm_clk_get_enabled(dev, "ahb");
+	dc->ahb_clk = devm_clk_get_optional_enabled(dev, "ahb");

Please make the clock change a separated patch for atomicity.

BTW the MA35D1 manual's clock tree shows that DCUltra appears on AXI2
ACLK, AHB_HCLK2, behind a mux of SYS-PLL/EPLL-DIV2 (which seems to be
the core clock), and behind a divider (which seems to be the pixel clock).

However it's weird that only one DCUltra Clock Enable Bit exists despite both bus clocks have "ICG" (I think it means "Integrated Clock
Gating"). In addition the linux clk-ma35d1 driver assigns "dcu_gate" as
a downstream of "dcu_mux", although the Figure 6.5-2 in the TRM shows
no ICG after the "Display core CLK" mux.

Quoted 6 lines

Is the two bus clocks controlled by a single gate bit, and is the bit
also gating DC core clock?

Thanks,
Icenowy

Quoted 10 lines

I will split the axi/ahb optional-clock change into its own patch in v5
for atomicity.
Regarding the MA35D1 clock tree: from the TRM, the single "dcu_gate" bit
gates both bus clocks (AXI ACLK and AHB HCLK) together with the display
core clock through the same ICG cell. The clk-ma35d1 driver exposes only
"dcu_gate" (downstream of "dcu_mux") and does not provide separate

Then it's one of the case that the clock tree doesn't properly represent the hardware, which is bad. However, as three gates share the same bit, I am not sure how to represent such kind of thing in the common clk framework.

Quoted 5 lines

axi/ahb clock entries. Therefore the MA35D1 DT binding will use only two
clocks ("core" and "pix0"); making axi and ahb optional in the driver is the correct approach, and this will be stated clearly in the
split-out patch.

I agree to make them optional, although these two clocks do exist in the hardware of MA35D1.

Thanks,
Icenowy

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

   if (IS_ERR(dc->ahb_clk)) { dev_err(dev, "can't get ahb clock\n"); return PTR_ERR(dc->ahb_clk);

author
#18 lore raw

Re: [PATCH v4 4/6] drm/verisilicon: add DC8000 (DCUltraLite) display controller support

Quoted 136 lines · Icenowy Zheng

(CC'ed clk maintainers for weird clock gate bit)

Quoted 113 lines · 在 2026-06-17三的 18:35 +0800,Joey Lu写道:
Quoted 106 lines · Icenowy Zheng
Quoted 77 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display
controller whose register layout differs from the DC8200 in several
important ways:

1. No CONFIG_EX commit path: framebuffer updates use the enable (bit
0)
    and reset (bit 4) bits in FB_CONFIG instead of the DC8200
staging
    registers (FB_CONFIG_EX, FB_TOP_LEFT, FB_BOTTOM_RIGHT, FB_BLEND_CONFIG, PANEL_CONFIG_EX).

2. No PANEL_START register: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync
start
    register.

3. Different IRQ registers: DCUltraLite uses DISP_IRQ_STA (0x147C) /
    DISP_IRQ_EN (0x1480) versus DC8200's TOP_IRQ_ACK (0x0010) / TOP_IRQ_EN (0x0014).

4. Per-frame commit cycle: DCUltraLite requires the VALID bit in FB_CONFIG to be set at the start of each atomic commit
(crtc_begin)
    and cleared after (crtc_flush).

5. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel
    divider) clocks; no axi or ahb clocks required.  Make axi_clk
and
    ahb_clk optional (devm_clk_get_optional_enabled) so DC8000
nodes
    without those clocks are handled gracefully.

Add vs_dc8000.c implementing the vs_dc_funcs vtable for the above differences.  The probe now selects vs_dc8000_funcs when the identified
generation is VSDC_GEN_DC8000 (DCUltraLite reads model 0x0, revision 0x5560, customer_id 0x305).

---
   drivers/gpu/drm/verisilicon/Makefile    |  2 +-
   drivers/gpu/drm/verisilicon/vs_dc.c     |  9 ++-
   drivers/gpu/drm/verisilicon/vs_dc.h     |  1 +
   drivers/gpu/drm/verisilicon/vs_dc8000.c | 78
+++++++++++++++++++++++++
   4 files changed, 86 insertions(+), 4 deletions(-)

  create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c

drivers/gpu/drm/verisilicon/Makefile +1 -1
index 9d4cd16452fa..d2fd8e4dff24 100644
@@ -1,6 +1,6 @@
   # SPDX-License-Identifier: GPL-2.0-only
 
-verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o
 vs_drm.o vs_hwdb.o \
+verisilicon-dc-objs := vs_bridge.o vs_crtc.o vs_dc.o vs_dc8200.o
 vs_dc8000.o vs_drm.o vs_hwdb.o \
   	vs_plane.o vs_primary_plane.o vs_cursor_plane.o

  obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o

drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index 9729b693d360..9499fffbca58 100644
@@ -90,13 +90,13 @@ static int vs_dc_probe(struct platform_device
 *pdev)
   		return PTR_ERR(dc->core_clk);
   	}

drivers/gpu/drm/verisilicon/vs_dc.c static int vs_dc_probe(struct platform_device · line 100

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -2
 
-	dc->axi_clk = devm_clk_get_enabled(dev, "axi");
+	dc->axi_clk = devm_clk_get_optional_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");
+	dc->ahb_clk = devm_clk_get_optional_enabled(dev, "ahb");

Please make the clock change a separated patch for atomicity.

BTW the MA35D1 manual's clock tree shows that DCUltra appears on AXI2
ACLK, AHB_HCLK2, behind a mux of SYS-PLL/EPLL-DIV2 (which seems to be
the core clock), and behind a divider (which seems to be the pixel clock).

However it's weird that only one DCUltra Clock Enable Bit exists despite both bus clocks have "ICG" (I think it means "Integrated Clock
Gating"). In addition the linux clk-ma35d1 driver assigns "dcu_gate" as
a downstream of "dcu_mux", although the Figure 6.5-2 in the TRM shows
no ICG after the "Display core CLK" mux.

Quoted 6 lines

Is the two bus clocks controlled by a single gate bit, and is the bit
also gating DC core clock?

Thanks,
Icenowy

Quoted 10 lines

I will split the axi/ahb optional-clock change into its own patch in v5
for atomicity.
Regarding the MA35D1 clock tree: from the TRM, the single "dcu_gate" bit
gates both bus clocks (AXI ACLK and AHB HCLK) together with the display
core clock through the same ICG cell. The clk-ma35d1 driver exposes only
"dcu_gate" (downstream of "dcu_mux") and does not provide separate

Then it's one of the case that the clock tree doesn't properly represent the hardware, which is bad. However, as three gates share the same bit, I am not sure how to represent such kind of thing in the common clk framework.

Quoted 5 lines

axi/ahb clock entries. Therefore the MA35D1 DT binding will use only two
clocks ("core" and "pix0"); making axi and ahb optional in the driver is the correct approach, and this will be stated clearly in the
split-out patch.

Quoted 5 lines

I agree to make them optional, although these two clocks do exist in the hardware of MA35D1.

Thanks,
Icenowy

As mentioned in the DT binding reply, the absence of separate AXI/AHB clock entries for DCU in clk driver is due to the hardware design constraint of a single shared enable bit, not a driver oversight. In v5, the axi and ahb clock fetches in vs_dc_probe will be split into their own patch and made optional via devm_clk_get_optional_enabled, with a comment explaining that on MA35D1 the AXI and AHB bus clocks share the single dcu_gate enable bit and are therefore not separately exposed by the clock driver.

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

   return PTR_ERR(dc->ahb_clk);

#19 lore raw

Re: [PATCH v4 4/6] drm/verisilicon: add DC8000 (DCUltraLite) display controller support

In reply to Joey Lu
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:

New issues:
- [High] Missing RUNNING bit configuration in panel_enable_ex prevents panel output.
- [High] Framebuffer enable bit placed in CRTC callbacks prevents independent plane disablement, causing Use-After-Free.
- [High] Pixel clock is disabled before writing to CRTC registers during disablement.
- [High] Uninitialized stack memory leak when reading IRQ status registers.
- [Medium] Positional clock-names array causes schema validation failure for abbreviated clock topologies.

Pre-existing issues:
- [High] DC8200 primary plane disable hook erroneously sets the enable bit.
- [High] IRQ handler registration races with drm_dev initialization, causing NULL pointer dereference. --

commit 7f62f89410b84fe09c3b006e2a2c8a7c5dedfeaa
Author: Joey Lu <[email protected]>

drm/verisilicon: add DC8000 (DCUltraLite) display controller support

This commit adds support for the Verisilicon DC8000 (DCUltraLite) display controller found on the Nuvoton MA35D1 SoC. It handles differences in register layout, commit cycles, and clock topology by introducing a new vs_dc8000_funcs structure.

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc.c +0 -0
index 9729b693d360e..9499fffbca58e 100644

[ ... ]

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

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -1
@@ -134,7 +134,10 @@ static int vs_dc_probe(struct platform_device *pdev)
 	dev_info(dev, "Found DC%x rev %x customer %x\n", dc->identity.model,
 		 dc->identity.revision, dc->identity.customer_id);
 
-	dc->funcs = &vs_dc8200_funcs;
+	if (dc->identity.generation == VSDC_GEN_DC8200)
+		dc->funcs = &vs_dc8200_funcs;

[Severity: High]
This is a pre-existing issue, but does vs_dc8200_primary_plane_disable_ex() fail to disable the hardware plane?

It uses regmap_set_bits() for VSDC_FB_CONFIG_EX_FB_EN instead of clearing it:

vs_dc8200.c:vs_dc8200_primary_plane_disable_ex() {
    regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
                    VSDC_FB_CONFIG_EX_FB_EN);
    ...
}

Will the display controller continue accessing the freed memory when DRM frees the framebuffer after the atomic commit, leading to a use-after-free?

[Severity: High]
This is also a pre-existing issue, but does vs_dc_probe() register the IRQ handler before the DRM device is fully initialized?

If an interrupt fires immediately after devm_request_irq(), could vs_drm_handle_irq() dereference dc->drm_dev->crtcs[i] and dc->drm_dev->base before vs_drm_initialize() has allocated dc->drm_dev?

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc.c +2 -0
+	else
+		dc->funcs = &vs_dc8000_funcs;
 
 	if (port_count > dc->identity.display_count) {
 		dev_err(dev, "too many downstream ports than HW capability\n");

[ ... ]

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +1 -0
new file mode 100644
index 0000000000000..be0c0d7baf52e
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-only

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8000.c line 16

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +5 -0
+static void vs_dc8000_panel_enable_ex(struct vs_dc *dc, unsigned int output)
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_RESET);
+}

[Severity: High]
Does this function miss configuring the RUNNING bit?

The commit message states that panel output starts when PANEL_CONFIG.RUNNING is set, but this implementation only sets VSDC_FB_CONFIG_RESET. Will the display controller fail to output pixels to the panel without setting VSDC_DISP_PANEL_CONFIG_RUNNING?

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8000.c line 40

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +5 -0
+static void vs_dc8000_crtc_enable(struct vs_dc *dc, unsigned int output)
+{
+	regmap_set_bits(dc->regs, VSDC_FB_CONFIG(output),
+			VSDC_FB_CONFIG_ENABLE);
+}

[Severity: High]
Does placing the framebuffer enable bit in the CRTC enable callback prevent independent plane disablement?

If the DRM core disables the primary plane while keeping the CRTC active, vs_primary_plane_atomic_disable() will act as a no-op because the plane disable hook is NULL in vs_dc8000_funcs. Will the hardware continue scanning out from the freed framebuffer, resulting in a use-after-free and potential IOMMU faults?

drivers/gpu/drm/verisilicon/vs_dc8000.c line 46

Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +5 -0
+static void vs_dc8000_crtc_disable(struct vs_dc *dc, unsigned int output)
+{
+	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG(output),
+			  VSDC_FB_CONFIG_ENABLE);
+}

[Severity: High]
Will writing to the CRTC register during disablement cause a bus fault?

In vs_crtc_atomic_disable(), clk_disable_unprepare() is called on the pixel clock before invoking the crtc_disable hook:

vs_crtc.c:vs_crtc_atomic_disable() {
    clk_disable_unprepare(dc->pix_clk[output]);

    if (dc->funcs->crtc_disable)
        dc->funcs->crtc_disable(dc, output);
    ...
}

Does this cause vs_dc8000_crtc_disable() to access hardware registers after their corresponding clock is disabled?

[ ... ]

drivers/gpu/drm/verisilicon/vs_dc8000.c line 66

Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +7 -0
+static u32 vs_dc8000_irq_ack(struct vs_dc *dc)
+{
+	u32 irqs;
+
+	regmap_read(dc->regs, VSDC_DISP_IRQ_STA, &irqs);
+	return irqs;
+}

[Severity: High]
Can this leak uninitialized stack memory?

If regmap_read() fails, the irqs variable remains uninitialized. Will this cause the function to return garbage data that is then passed to vs_drm_handle_irq(), potentially causing an information leak when logged by drm_warn_once or spurious execution of VBLANK handlers?

[ ... ]

[Severity: Medium]
Will the abbreviated clock topology cause device tree validation failures?

Since the commit makes the axi and ahb clocks optional, the device tree could use a simpler topology with just core and pix0. However, the DT binding schema in verisilicon,dc.yaml uses a rigid positional items array for clock-names (expecting axi at index 1). Would a node using clock-names = "core", "pix0" fail validation because pix0 is evaluated against the const: axi requirement?

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

PATCH v4 5/6 drm/verisilicon: add DCUltraLite chip identity to HWDB

In reply to Joey Lu

Register the Nuvoton MA35D1 DCUltraLite chip identity in vs_chip_identities[]:
model = 0x0 (DCUltraLite; Verisilicon uses 0 for this IP)
revision = 0x5560
customer_id = 0x305
generation = VSDC_GEN_DC8000
display_count = 1
max_cursor_size = 32

Placing this entry last makes it the gate that enables MA35D1 hardware recognition only after all the supporting ops and DT binding changes are in place.

---
 drivers/gpu/drm/verisilicon/vs_hwdb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/verisilicon/vs_hwdb.c +10 -0
index 91524d16f778..7d630a667a3f 100644
@@ -129,6 +129,16 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.max_cursor_size = 64,
 		.formats = &vs_formats_no_yuv444,
 	},
+	{
+		.model = 0x0,		/* DCUltraLite */
+		.revision = 0x5560,
+		.customer_id = 0x305,
+
+		.generation = VSDC_GEN_DC8000,
+		.display_count = 1,
+		.max_cursor_size = 32,
+		.formats = &vs_formats_no_yuv444,
+	},
 };
 
 int vs_fill_chip_identity(struct regmap *regs,
Signature · 1 line
2.43.0
#21 lore raw

Re: [PATCH v4 5/6] drm/verisilicon: add DCUltraLite chip identity to HWDB

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] A wildcard entry in vs_chip_identities shadows specific customer ID entries, making them unreachable.
- [High] The function vs_fill_chip_identity() ignores the return values of regmap_read() calls, leading to potential use of uninitialized stack memory. --

commit a6a5d6f3773180ae44a10c5525c46667d81239fe
Author: Joey Lu <[email protected]>

drm/verisilicon: add DCUltraLite chip identity to HWDB

Register the Nuvoton MA35D1 DCUltraLite chip identity in vs_chip_identities[]:
model = 0x0 (DCUltraLite; Verisilicon uses 0 for this IP)
[ ... ]

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
index 91524d16f7785..7d630a667a3f0 100644

[ ... ]

Quoted 17 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +10 -0
@@ -129,6 +129,16 @@ static struct vs_chip_identity vs_chip_identities[] = {
 		.max_cursor_size = 64,
 		.formats = &vs_formats_no_yuv444,
 	},
+	{
+		.model = 0x0,		/* DCUltraLite */
+		.revision = 0x5560,
+		.customer_id = 0x305,
+
+		.generation = VSDC_GEN_DC8000,
+		.display_count = 1,
+		.max_cursor_size = 32,
+		.formats = &vs_formats_no_yuv444,
+	},
 };
 
 int vs_fill_chip_identity(struct regmap *regs,

drivers/gpu/drm/verisilicon/vs_hwdb.c

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
 			  struct vs_chip_identity *ident)
 {
 	u32 model;
 	u32 revision;
 	u32 customer_id;
 	int i;
 
 	regmap_read(regs, VSDC_TOP_CHIP_MODEL, &model);
 	regmap_read(regs, VSDC_TOP_CHIP_REV, &revision);
 	regmap_read(regs, VSDC_TOP_CHIP_CUSTOMER_ID, &customer_id);

[Severity: High]
This isn't a bug introduced by this patch, but does vs_fill_chip_identity() ignore the return values of these regmap_read() calls?

The regmap_read() API returns an integer error code on failure and leaves the output pointer's target unmodified.

If any of these reads fail due to bus errors or unmapped I/O, will the function proceed to use uninitialized stack memory in the loop to compare against the vs_chip_identities array?

drivers/gpu/drm/verisilicon/vs_hwdb.c

Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
 	for (i = 0; i < ARRAY_SIZE(vs_chip_identities); i++) {
 		if (vs_chip_identities[i].model == model &&
 		    vs_chip_identities[i].revision == revision &&
 		    (vs_chip_identities[i].customer_id == customer_id ||
 		     vs_chip_identities[i].customer_id == ~0U)) {
 			memcpy(ident, &vs_chip_identities[i], sizeof(*ident));
 			ident->customer_id = customer_id;
 			return 0;
 		}

[Severity: High]
This is a pre-existing issue, but does the wildcard entry in vs_chip_identities[] shadow specific customer ID entries?

Looking at vs_chip_identities[] in drivers/gpu/drm/verisilicon/vs_hwdb.c, there is a wildcard entry at the beginning of the array:

	{
		.model = 0x8200,
		.revision = 0x5720,
		.customer_id = ~0U,
		...
	}

Since vs_fill_chip_identity() searches sequentially and returns on the first match, will any hardware with model 0x8200 and revision 0x5720 instantly match this wildcard entry?

If so, the specific configurations for customer IDs 0x310 and 0x311 defined later in the array might be completely shadowed and never reached. This would cause customer ID 0x310 to incorrectly use vs_formats_no_yuv444 instead of its intended vs_formats_with_yuv444.

Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +0 -0
 	}
 
 	return -EINVAL;
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
maintainer
#22 lore raw

Re: [PATCH v4 5/6] drm/verisilicon: add DCUltraLite chip identity to HWDB

In reply to Joey Lu
Quoted 8 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

Register the Nuvoton MA35D1 DCUltraLite chip identity in vs_chip_identities[]:
  model       = 0x0   (DCUltraLite; Verisilicon uses 0 for this IP) revision    = 0x5560
  customer_id = 0x305
  generation  = VSDC_GEN_DC8000
  display_count = 1
  max_cursor_size = 32

I suggest make this more human-readable instead of replicating the machine-readable data of HWDB.

My proposal here:

```
The Nuvoton MA35D1 chip contains a DCUltraLite display controller with
model number 0x0 (sic, the model name contains no number either),
revision 0x5560 and customer ID 0x305. It has a similar register map
with DC8000, only one display output and only 32x32 cursor supported.
```
Quoted 6 lines

Placing this entry last makes it the gate that enables MA35D1 hardware
recognition only after all the supporting ops and DT binding changes are
in place.

It's a little ambiguous that "last" here means whether the last in the patchset or the last in the HWDB array, although I think it's not so needed to explain the reason of the place in the patchset.

I propose just say Adding it to the HWDB to enable it to be usable with the verisilicon driver. .

Quoted 29 lines

---
 drivers/gpu/drm/verisilicon/vs_hwdb.c | 10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/gpu/drm/verisilicon/vs_hwdb.c +10 -0
index 91524d16f778..7d630a667a3f 100644
@@ -129,6 +129,16 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.max_cursor_size = 64,
  		.formats = &vs_formats_no_yuv444,
  	},
+	{
+		.model = 0x0,		/* DCUltraLite */
+		.revision = 0x5560,
+		.customer_id = 0x305,
+
+		.generation = VSDC_GEN_DC8000,
+		.display_count = 1,
+		.max_cursor_size = 32,
+		.formats = &vs_formats_no_yuv444,
+	},
  };


 int vs_fill_chip_identity(struct regmap *regs,

author
#23 lore raw

Re: [PATCH v4 5/6] drm/verisilicon: add DCUltraLite chip identity to HWDB

Quoted 12 lines · Icenowy Zheng
Quoted 8 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

Register the Nuvoton MA35D1 DCUltraLite chip identity in vs_chip_identities[]:
  model       = 0x0   (DCUltraLite; Verisilicon uses 0 for this IP) revision    = 0x5560
  customer_id = 0x305
  generation  = VSDC_GEN_DC8000
  display_count = 1
  max_cursor_size = 32

I suggest make this more human-readable instead of replicating the machine-readable data of HWDB.

Quoted 8 lines

My proposal here:

```
The Nuvoton MA35D1 chip contains a DCUltraLite display controller with
model number 0x0 (sic, the model name contains no number either),
revision 0x5560 and customer ID 0x305. It has a similar register map
with DC8000, only one display output and only 32x32 cursor supported.
```

Thanks. I will use your proposed wording for the commit message in v5

Quoted 11 lines
Quoted 5 lines

Placing this entry last makes it the gate that enables MA35D1 hardware
recognition only after all the supporting ops and DT binding changes are
in place.

It's a little ambiguous that "last" here means whether the last in the patchset or the last in the HWDB array, although I think it's not so needed to explain the reason of the place in the patchset.

I propose just say Adding it to the HWDB to enable it to be usable with the verisilicon driver. .

I will simplify the placement sentence to "Adding it to the HWDB to enable it to be usable with the verisilicon driver." in v5.

Quoted 28 lines
Quoted 28 lines
---
  drivers/gpu/drm/verisilicon/vs_hwdb.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/gpu/drm/verisilicon/vs_hwdb.c +10 -0
index 91524d16f778..7d630a667a3f 100644
@@ -129,6 +129,16 @@ static struct vs_chip_identity
 vs_chip_identities[] = {
  		.max_cursor_size = 64,
  		.formats = &vs_formats_no_yuv444,
  	},
+	{
+		.model = 0x0,		/* DCUltraLite */
+		.revision = 0x5560,
+		.customer_id = 0x305,
+
+		.generation = VSDC_GEN_DC8000,
+		.display_count = 1,
+		.max_cursor_size = 32,
+		.formats = &vs_formats_no_yuv444,
+	},
  };
 

 int vs_fill_chip_identity(struct regmap *regs,

author
#24 lore raw

PATCH v4 6/6 drm/verisilicon: extend Kconfig to support ARCH_MA35 platforms

In reply to Joey Lu

The DCUltraLite hardware ops and HWDB entry added in the preceding commits enable the driver to work on Nuvoton MA35D1 hardware. Allow the driver to be built when ARCH_MA35 is selected; this dependency is meaningful only now that all supporting code is in place.

---
 drivers/gpu/drm/verisilicon/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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
Signature · 1 line
2.43.0
maintainer
#25 lore raw

Re: [PATCH v4 6/6] drm/verisilicon: extend Kconfig to support ARCH_MA35 platforms

Quoted 7 lines · 在 2026-06-15一的 14:50 +0800,Joey Lu写道:

The DCUltraLite hardware ops and HWDB entry added in the preceding commits
enable the driver to work on Nuvoton MA35D1 hardware.  Allow the driver
to be built when ARCH_MA35 is selected; this dependency is meaningful only
now that all supporting code is in place.

The explaination of patch sequence is not needed, but anyway,

Reviewed-by: Icenowy Zheng <[email protected]>

Thanks,
Icenowy

Quoted 21 lines

---
 drivers/gpu/drm/verisilicon/Kconfig | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
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