drm/verisilicon: add Nuvoton MA35D1 DCU Lite support
Subsystems (4)
v5 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; making axi/ahb clocks optional as a separate atomic change; and the DC8000 ops in vs_dc8000.c. Patch 6 adds the DCUltraLite HWDB entry that gates hardware recognition once all support is in place.
Patch 7 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 v4:
- [dt-bindings] Kept clock and reset item descriptions in the global clocks:/resets: properties; per-compatible sections only constrain minItems/maxItems and override clock-names items for nuvoton,ma35d1-dcu.
- [dt-bindings] Dropped redundant global minItems/maxItems on clocks:
and clock-names:.
- [dt-bindings] Dropped the extra-space typo fix in port@0 description to keep the patch atomic; left for a separate patch later.
- [ops] Renamed crtc_enable/crtc_disable hooks to crtc_enable_ex/ crtc_disable_ex.
- [ops] Added unified IRQ bit definitions; each irq_ack() implementation now translates hardware-specific bits before returning.
- [clocks] Split the axi/ahb optional-clock change into its own patch for atomicity.
- [hwdb] Simplified the commit message for patch 6.
- [kconfig] Simplified the commit message for patch 7.
Joey Lu (7):
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: make axi and ahb clocks optional 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 | 57 +++++++++ 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 | 86 +++++++++++++ drivers/gpu/drm/verisilicon/vs_dc8200.c | 115 ++++++++++++++++++ drivers/gpu/drm/verisilicon/vs_drm.c | 5 +- drivers/gpu/drm/verisilicon/vs_drm.h | 8 ++ 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 + 16 files changed, 378 insertions(+), 57 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
PATCH v5 1/7 dt-bindings: display: verisilicon,dc: generalize for single-output variants
The verisilicon,dc binding was originally written for the T-Head TH1520 SoC carrying a DC8200, and hard-codes five clocks, three resets and two output ports.
Add the Nuvoton MA35D1 DCUltraLite (nuvoton,ma35d1-dcu) to the binding. The DCUltraLite uses only two clocks (core, pix0) and one reset (core), with a single output port.
Use allOf/if blocks to express per-variant constraints rather than hard-coding the DC8200 topology at the top level. Each compatible's block constrains the clock and reset item counts; the nuvoton block additionally overrides clock-names to the two names it actually uses.
--- .../bindings/display/verisilicon,dc.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+)
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +57 -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:
@@ -77,6 +78,62 @@ required: - clock-names - ports +allOf: + - if: + properties: + compatible: + contains: + const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + 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 + + clock-names: + items: + - const: core + - const: pix0 + + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: core + + required: + - resets + - reset-names + additionalProperties: false examples:
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The Nuvoton MA35D1 conditional schema block logically conflicts with top-level constraints…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The Nuvoton MA35D1 conditional schema block logically conflicts with top-level constraints, causing validation of valid Nuvoton device trees to unconditionally fail.
- [Medium] The Nuvoton MA35D1 conditional block fails to restrict the ports property to a single output port, contradicting the hardware description. --
commit 6779aa6e54db7988d8c51ba66d2a7972829a44e6
Author: Joey Lu <[email protected]>
dt-bindings: display: verisilicon,dc: generalize for single-output variants
This commit adds the Nuvoton MA35D1 DCUltraLite to the verisilicon,dc binding. It introduces conditional blocks to express per-variant constraints for clocks and resets rather than hard-coding the DC8200 topology at the top level.
Quoted 4 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +0
-0
[ ... ]
Quoted 1 line
+allOf:
[ ... ]
Quoted 5 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+ - if: + properties: + compatible: + contains: + const: nuvoton,ma35d1-dcu
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 123
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ then: + properties: + clocks: + minItems: 2 + maxItems: 2 + + clock-names: + items: + - const: core + - const: pix0
[Severity: High]
Does this conditional schema conflict with the top-level constraints?
Any device tree node containing the compatible string for the Nuvoton variant is evaluated against both the top-level schema and this conditional block concurrently.
The top-level definitions strictly enforce a 5-item array and specific constant values for clock-names (such as the second item being axi). This block attempts to override those with a maximum of 2 items and restricts the second item to pix0.
Since a length cannot be both exactly 5 and a maximum of 2, and an element cannot be both axi and pix0, this creates an unsatisfiable constraint.
Will this cause validation of valid Nuvoton device trees to unconditionally fail?
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 135
Quoted 12 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: core + + required: + - resets + - reset-names
[Severity: Medium]
Does this block need to explicitly restrict the ports property to a single output port?
The commit message states that the Nuvoton MA35D1 DCUltraLite has a single output port. However, because this conditional block does not explicitly disallow the second port, it inherits the top-level allowances.
Will malformed device trees incorrectly specifying two output ports for the Nuvoton variant silently pass schema validation, bypassing the hardware topology checks?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
In reply to Joey LuQuoted 39 lines · Joey Lu
The verisilicon,dc binding was originally written for the T-Head TH1520 SoC carrying a DC8200, and hard-codes five clocks, three resets and two output ports.
Add the Nuvoton MA35D1 DCUltraLite (nuvoton,ma35d1-dcu) to the binding. The DCUltraLite uses only two clocks (core, pix0) and one reset (core), with a single output port.
Use allOf/if blocks to express per-variant constraints rather than hard-coding the DC8200 topology at the top level. Each compatible's block constrains the clock and reset item counts; the nuvoton block additionally overrides clock-names to the two names it actually uses.
Signed-off-by Joey Lu <[email protected]>--- .../bindings/display/verisilicon,dc.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+)Documentation/devicetree/bindings/display/verisilicon,dc.yaml +6
-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:@@ -77,6 +78,62 @@ required: - clock-names - ports +allOf: + - if: + properties: + compatible: + contains:
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5
All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your minItems also do nothing.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 107
Quoted 12 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-names
Both conditional sections have this, but the original binding doesn't require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for single ended variants".
FWIW, adding your new compatible shouldn't really be in a patch with that subject either, it really should say "add support for nuvoton ma35d1" or something.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 117
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ + - if: + properties: + compatible: + contains: + const: nuvoton,ma35d1-dcu + then: + properties: + clocks: + minItems: 2
Anything that updates the minimum constraint should be done at the top level of this schema. The conditional section should then tighten the constraint, in this case that means only having maxItems.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 123
Quoted 6 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +6
-0+ maxItems: 2 + + clock-names: + items: + - const: core + - const: pix0
Does this even work when the top level schema thinks clock 2 should be called axi?
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 8 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: core
This is just maxItems: 1.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+ + required: + - resets + - reset-names + additionalProperties: false examples:Signature · 1 line
2.43.0
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 75 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 49 lines · Joey Lu
The verisilicon,dc binding was originally written for the T-Head TH1520
SoC carrying a DC8200, and hard-codes five clocks, three resets and two
output ports.Add the Nuvoton MA35D1 DCUltraLite (nuvoton,ma35d1-dcu) to the binding.
The DCUltraLite uses only two clocks (core, pix0) and one reset (core),
with a single output port.Use allOf/if blocks to express per-variant constraints rather than hard-coding the DC8200 topology at the top level. Each compatible's
block constrains the clock and reset item counts; the nuvoton block additionally overrides clock-names to the two names it actually uses.Signed-off-by Joey Lu <[email protected]>---
.../bindings/display/verisilicon,dc.yaml | 57
+++++++++++++++++++1 file changed, 57 insertions(+)diff --git
a/Documentation/devicetree/bindings/display/verisilicon,dc.yamlb/Documentation/devicetree/bindings/display/verisilicon,dc.yamlindex9dc35ab973f2..1e751f3c7ce8100644Documentation/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@@ -77,6 +78,62 @@ required:- clock-names
- portsDocumentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your minItems also do nothing.
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +9
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 +
Quoted 8 lines
Quoted 3 lines
+ required:
+ - resets
+ - reset-namesBoth conditional sections have this, but the original binding doesn't require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for single ended variants".
Well yes they're required.
Should I send a patch adding the thead,th1520-dc8200 part of the schema?
Quoted 32 lines
FWIW, adding your new compatible shouldn't really be in a patch with that subject either, it really should say "add support for nuvoton ma35d1" or something.
Quoted 10 lines
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: nuvoton,ma35d1-dcu
+ then:
+ properties:
+ clocks:
+ minItems: 2Anything that updates the minimum constraint should be done at the top
level of this schema. The conditional section should then tighten the constraint, in this case that means only having maxItems.Quoted 6 lines
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: pix0Does this even work when the top level schema thinks clock 2 should be
called axi?
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 8 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Well the implicit rules of DT binding schemas are quite weird...
Thanks,
Icenowy
Quoted 17 lines
pw-bot: changes-requested
Thanks,
Conor.Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+ + required: + - resets + - reset-names +additionalProperties: false
examples:Signature · 1 line
2.43.0
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 41 lines · Icenowy Zheng
Quoted 31 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your minItems also do nothing.
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +9
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 +Quoted 8 lines
Quoted 3 lines
+ required:
+ - resets
+ - reset-namesBoth conditional sections have this, but the original binding doesn't require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for single ended variants".
Quoted 4 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of the schema?
If you mean the code above, no. Adding a conditional section when there's only that compatible doesn't make sense.
What you could do is just add it at the top level though, which would also benefit this patch since it'd not have to be conditionally added for the new nuvoton device.
Just note in your commit message about what the ABI impact of the change to required properties is (effectively nothing because it's optional in the driver and the only user has the properties).
Quoted 11 lines
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 8 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 1 line
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has
reset-names:
items:
- const: core
- const: axi
- const: ahb
so just constraining to one item is the simplest way to do this without duplication.
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 54 lines · 在 2026-06-26五的 08:19 +0100,Conor Dooley写道:
Quoted 45 lines · Icenowy Zheng
Quoted 35 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your
minItems also do nothing.Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +11
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resetsQuoted 8 lines
Quoted 1 line
+ - reset-names
Both conditional sections have this, but the original binding doesn't
require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for
single ended variants".Quoted 4 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of the schema?If you mean the code above, no. Adding a conditional section when there's only that compatible doesn't make sense.
Quoted 8 lines
What you could do is just add it at the top level though, which would also benefit this patch since it'd not have to be conditionally added for the new nuvoton device.
Just note in your commit message about what the ABI impact of the change
to required properties is (effectively nothing because it's optional in
the driver and the only user has the properties).
Okay, I will craft such a patch and send it.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 8 lines
Quoted 1 line
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahb
Ah does the list constraint the order of items? If it constrains the order, it partly breaks the intention of having names; if it does not constrain the order, it needs to be clarified that the required 1 reset is core instead of the other two.
Thanks,
Icenowy
Quoted 3 lines
so just constraining to one item is the simplest way to do this without
duplication.
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 80 lines · Icenowy Zheng
Quoted 54 lines · 在 2026-06-26五的 08:19 +0100,Conor Dooley写道:
Quoted 45 lines · Icenowy Zheng
Quoted 35 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your
minItems also do nothing.Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +11
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resetsQuoted 8 lines
Quoted 1 line
+ - reset-names
Both conditional sections have this, but the original binding doesn't
require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for
single ended variants".Quoted 4 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of the schema?If you mean the code above, no. Adding a conditional section when there's only that compatible doesn't make sense.
Quoted 8 lines
What you could do is just add it at the top level though, which would also benefit this patch since it'd not have to be conditionally added for the new nuvoton device.
Just note in your commit message about what the ABI impact of the change
to required properties is (effectively nothing because it's optional in
the driver and the only user has the properties).Okay, I will craft such a patch and send it.
Quoted 14 lines
Quoted 13 lines
Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Well the implicit rules of DT binding schemas are quite weird...
Quoted 8 lines
Quoted 6 lines
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains the
It does, yes.
Alternatively, using an enum permits free ordering.
Quoted 3 lines
order, it partly breaks the intention of having names; if it does not constrain the order, it needs to be clarified that the required 1 reset is core instead of the other two.
Given the discussion we're having on the clocks, I wonder if this is also an oversimplification and the IP has three resets inputs hooked up to one output of the reset controller (or 3 outputs controlled by one bit..).
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 96 lines · 在 2026-06-26五的 10:26 +0100,Conor Dooley写道:
Quoted 95 lines · Icenowy Zheng
Quoted 58 lines · 在 2026-06-26五的 08:19 +0100,Conor Dooley写道:
Quoted 48 lines · Icenowy Zheng
Quoted 38 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level,
your
minItems also do nothing.Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 107
Quoted 12 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-namesQuoted 8 lines
Both conditional sections have this, but the original binding doesn't
require these for the thead device. This is a functional change
therefore and shouldn't be in a patch calling itself "generalise
for
single ended variants".Quoted 5 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of the
schema?If you mean the code above, no. Adding a conditional section when there's only that compatible doesn't make sense.
Quoted 11 lines
What you could do is just add it at the top level though, which would
also benefit this patch since it'd not have to be conditionally added
for the new nuvoton device.
Just note in your commit message about what the ABI impact of the change
to required properties is (effectively nothing because it's optional
in
the driver and the only user has the properties).Okay, I will craft such a patch and send it.
Quoted 21 lines
Quoted 12 lines
Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahb
Quoted 5 lines
Quoted 2 lines
Ah does the list constraint the order of items? If it constrains the
It does, yes.
Alternatively, using an enum permits free ordering.
Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Thanks,
Icenowy
Quoted 12 lines
Quoted 6 lines
order, it partly breaks the intention of having names; if it does not
constrain the order, it needs to be clarified that the required 1 reset
is core instead of the other two.Given the discussion we're having on the clocks, I wonder if this is also an oversimplification and the IP has three resets inputs hooked up
to one output of the reset controller (or 3 outputs controlled by one bit..).
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 25 lines · Icenowy Zheng
Quoted 25 lines
Quoted 24 lines
Quoted 15 lines
Quoted 12 lines
Quoted 11 lines
Review
Quoted 9 lines
(quoted diff) +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
Quoted 6 lines
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains the
Quoted 6 lines
Quoted 2 lines
It does, yes.
Alternatively, using an enum permits free ordering.Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Why do you think it should be an enum? We don't currently have any users of this that only provide no core or no axi reset.
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
In reply to Icenowy ZhengQuoted 89 lines · Icenowy Zheng
Quoted 88 lines · 在 2026-06-26五的 10:26 +0100,Conor Dooley写道:
Quoted 87 lines · Icenowy Zheng
Quoted 54 lines · 在 2026-06-26五的 08:19 +0100,Conor Dooley写道:
Quoted 45 lines · Icenowy Zheng
Quoted 36 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
(quoted diff) +5
-0+allOf: + - if: + properties: + compatible: + contains:Review
Quoted 10 lines
(quoted diff) +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level,
your
minItems also do nothing.Review
Quoted 12 lines
(quoted diff) +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-namesQuoted 8 lines
Both conditional sections have this, but the original binding doesn't
require these for the thead device. This is a functional change
therefore and shouldn't be in a patch calling itself "generalise
for
single ended variants".Quoted 5 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of the
schema?If you mean the code above, no. Adding a conditional section when there's only that compatible doesn't make sense.
Quoted 11 lines
What you could do is just add it at the top level though, which would
also benefit this patch since it'd not have to be conditionally added
for the new nuvoton device.
Just note in your commit message about what the ABI impact of the change
to required properties is (effectively nothing because it's optional
in
the driver and the only user has the properties).Okay, I will craft such a patch and send it.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 8 lines
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has
reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains the
Quoted 8 lines
Quoted 2 lines
It does, yes.
Alternatively, using an enum permits free ordering.Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Thanks,
Icenowy
Thank you all for the detailed review and discussion, it really helped clarify the right approach.
Since I will supply all four clocks with the same phandle for core/axi/ahb, and only one reset "core" for MA35D1, the ordering constraint in the items list is not a problem, "core" is already the first entry. There is no need to convert to an enum.
Regarding the clock situation for the MA35D1: I agree with supplying all four clocks (core, axi, ahb, pix0) in the devicetree, even though the MA35D1 clock controller gates core/axi/ahb with a single bit. The DT will use the same clock phandle for core, axi, and ahb:
clocks = <&clk X>, <&clk X>, <&clk X>, <&pix_clk Y>; clock-names = "core", "axi", "ahb", "pix0";
This correctly models the hardware topology. Since all three names resolve to the same underlying clock node, the CCF's standard enable refcounting handles the shared gate correctly without any custom implementation needed. I will also revert the change in patch 4/7 that made axi and ahb clocks optional, since they will now always be provided in the devicetree.
Regarding moving resets and reset-names to the top-level required:, I will wait for Icenowy's patch to land before sending v6 to avoid duplicating the work.
In v6 I will update patch 1/7 with:
- Update the subject to "dt-bindings: display: verisilicon,dc: add support for nuvoton,ma35d1-dcu"
- Lower clocks/clock-names minItems to 4 at the top level
- Remove the thead,th1520-dc8200 conditional block entirely
- Keep only the nuvoton,ma35d1-dcu conditional block, using only maxItems: 4 for clocks/clock-names and maxItems: 1 for resets/reset-names to tighten the top-level constraints
BR,
Joey
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
order, it partly breaks the intention of having names; if it does not
constrain the order, it needs to be clarified that the required 1 reset
is core instead of the other two.Given the discussion we're having on the clocks, I wonder if this is also an oversimplification and the IP has three resets inputs hooked up
to one output of the reset controller (or 3 outputs controlled by one bit..).
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 126 lines · 在 2026-06-29一的 11:47 +0800,Joey Lu写道:
Quoted 98 lines · Icenowy Zheng
Quoted 97 lines · 在 2026-06-26五的 10:26 +0100,Conor Dooley写道:
Quoted 96 lines · Icenowy Zheng
Quoted 59 lines · 在 2026-06-26五的 08:19 +0100,Conor Dooley写道:
Quoted 47 lines · Icenowy Zheng
Quoted 38 lines · 在 2026-06-25四的 17:33 +0100,Conor Dooley写道:
Quoted 5 lines · Joey Lu
(quoted diff) +5
-0+allOf: + - if: + properties: + compatible: + contains:Review
Quoted 10 lines
(quoted diff) +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do
nothing.Since you didn't change the minimum constraint at the top level,
your
minItems also do nothing.Review
Quoted 12 lines
(quoted diff) +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-namesBoth conditional sections have this, but the original
Quoted 8 lines
binding
doesn't
require these for the thead device. This is a functional change
therefore and shouldn't be in a patch calling itself "generalise
for
single ended variants".Quoted 6 lines
Well yes they're required.
Should I send a patch adding the
thead,th1520-dc8200part of
the
schema?If you mean the code above, no. Adding a conditional section when
there's only that compatible doesn't make sense.Quoted 14 lines
What you could do is just add it at the top level though, which
would
also benefit this patch since it'd not have to be conditionally
added
for the new nuvoton device.
Just note in your commit message about what the ABI impact of the
change
to required properties is (effectively nothing because it's optional
in
the driver and the only user has the properties).Okay, I will craft such a patch and send it.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 8 lines
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains
theQuoted 8 lines
Quoted 2 lines
It does, yes.
Alternatively, using an enum permits free ordering.Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Thanks,
IcenowyThank you all for the detailed review and discussion, it really helped
clarify the right approach.Since I will supply all four clocks with the same phandle for core/axi/ahb,
and only one reset "core" for MA35D1, the ordering constraint in theitemslist is not a problem, "core" is already the first entry. There
is no need to convert to an enum.Regarding the clock situation for the MA35D1: I agree with supplying all
four clocks (core, axi, ahb, pix0) in the devicetree, even though the MA35D1 clock controller gates core/axi/ahb with a single bit. The DT will
use the same clock phandle for core, axi, and ahb:
Quoted 4 lines
clocks = <&clk X>, <&clk X>, <&clk X>, <
&pix_clkY>; clock-names = "core", "axi", "ahb", "pix0";This correctly models the hardware topology. Since all three names
No, this doesn't correctly model the hardware topology -- this will lead to clk_get_rate() return the rate of DC core clock when checking the AXI clock rate, which is problematic because both clocks are limiting the performance of the DC.
Quoted 9 lines
resolve
to the same underlying clock node, the CCF's standard enable refcounting
handles the shared gate correctly without any custom implementation needed.
I will also revert the change in patch 4/7 that made axi and ahb clocks
optional, since they will now always be provided in the devicetree.
Quoted 4 lines
Regarding moving
resetsandreset-namesto the top-levelrequired:,
I will wait for Icenowy's patch to land before sending v6 to avoid duplicating the work.
The patch is sent.
Quoted 6 lines
In v6 I will update patch 1/7 with:
- Update the subject to "dt-bindings: display: verisilicon,dc: add support for nuvoton,ma35d1-dcu"
- Lowerclocks/clock-namesminItemsto 4 at the top level
- Remove thethead,th1520-dc8200conditional block entirely
I think this conditional block will still be needed, because it will need to constrain the minItems to ensure all clocks / resets are populated.
Thanks,
Icenowy
Quoted 21 lines
- Keep only the
nuvoton,ma35d1-dcuconditional block, using onlymaxItems: 4for clocks/clock-names andmaxItems: 1for resets/reset-names to tighten the top-level constraintsBR,
JoeyQuoted 15 lines
Quoted 15 lines
Quoted 7 lines
order, it partly breaks the intention of having names; if it does
not
constrain the order, it needs to be clarified that the required 1
reset
is core instead of the other two.Given the discussion we're having on the clocks, I wonder if this is
also an oversimplification and the IP has three resets inputs hooked
up
to one output of the reset controller (or 3 outputs controlled by one
bit..).
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 79 lines · Icenowy Zheng
Quoted 46 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 8 lines
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains
theQuoted 8 lines
Quoted 2 lines
It does, yes.
Alternatively, using an enum permits free ordering.Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Thanks,
IcenowyThank you all for the detailed review and discussion, it really helped
clarify the right approach.Since I will supply all four clocks with the same phandle for core/axi/ahb,
and only one reset "core" for MA35D1, the ordering constraint in theitemslist is not a problem, "core" is already the first entry. There
is no need to convert to an enum.Regarding the clock situation for the MA35D1: I agree with supplying all
four clocks (core, axi, ahb, pix0) in the devicetree, even though the MA35D1 clock controller gates core/axi/ahb with a single bit. The DT will
use the same clock phandle for core, axi, and ahb:Quoted 4 lines
clocks = <&clk X>, <&clk X>, <&clk X>, <
&pix_clkY>; clock-names = "core", "axi", "ahb", "pix0";This correctly models the hardware topology. Since all three names
No, this doesn't correctly model the hardware topology -- this will lead to
clk_get_rate()return the rate of DC core clock when checking the AXI clock rate, which is problematic because both clocks are limiting the performance of the DC.Quoted 9 lines
resolve
to the same underlying clock node, the CCF's standard enable refcounting
handles the shared gate correctly without any custom implementation needed.
I will also revert the change in patch 4/7 that made axi and ahb clocks
optional, since they will now always be provided in the devicetree.Quoted 4 lines
Regarding moving
resetsandreset-namesto the top-levelrequired:,
I will wait for Icenowy's patch to land before sending v6 to avoid duplicating the work.The patch is sent.
Quoted 6 lines
In v6 I will update patch 1/7 with:
- Update the subject to "dt-bindings: display: verisilicon,dc: add support for nuvoton,ma35d1-dcu"
- Lowerclocks/clock-namesminItemsto 4 at the top level
- Remove thethead,th1520-dc8200conditional block entirely
Quoted 3 lines
I think this conditional block will still be needed, because it will need to constrain the minItems to ensure all clocks / resets are populated.
Correct. When the outer constraints are relaxed to deal with the new device the conditional block for the th1520 becomes required. Or having an else, but if all devices are likely to be different in terms of configuration specific conditional blocks is better.
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Icenowy Zheng
Quoted 46 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
Quoted 8 lines
Quoted 2 lines
Well the implicit rules of DT binding schemas are quite weird...
I don't think it is that strange, as the binding has
reset-names:
items:
- const: core
- const: axi
- const: ahbAh does the list constraint the order of items? If it constrains
theQuoted 8 lines
Quoted 2 lines
It does, yes.
Alternatively, using an enum permits free ordering.Ah in this case this should be converted to an enum, I think.
Should I send a patch for converting it?
Thanks,
IcenowyThank you all for the detailed review and discussion, it really helped
clarify the right approach.Since I will supply all four clocks with the same phandle for core/axi/ahb,
and only one reset "core" for MA35D1, the ordering constraint in theitemslist is not a problem, "core" is already the first entry. There
is no need to convert to an enum.Regarding the clock situation for the MA35D1: I agree with supplying all
four clocks (core, axi, ahb, pix0) in the devicetree, even though the MA35D1 clock controller gates core/axi/ahb with a single bit. The DT will
use the same clock phandle for core, axi, and ahb:
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
clocks = <&clk X>, <&clk X>, <&clk X>, <
&pix_clkY>; clock-names = "core", "axi", "ahb", "pix0";This correctly models the hardware topology. Since all three names
No, this doesn't correctly model the hardware topology -- this will lead to
clk_get_rate()return the rate of DC core clock when checking the AXI clock rate, which is problematic because both clocks are limiting the performance of the DC.
You are right. The current MA35D1 clock driver does not correctly reflect the real AXI/AHB clock rates, and I think it needs a more comprehensive review and rework. I will address this in a separate clock driver patch series in the future.
For this DRM patch series, the AXI and AHB clocks are shared system bus clocks fixed by the SoC clock tree and are not managed by the display driver. The driver does not query their frequencies for mode validation or bandwidth decisions. Therefore, driver correctness is independent of the reported AXI/AHB clock rates, meaning it will remain unaffected when the clock driver is later reworked.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
resolve
to the same underlying clock node, the CCF's standard enable refcounting
handles the shared gate correctly without any custom implementation needed.
I will also revert the change in patch 4/7 that made axi and ahb clocks
optional, since they will now always be provided in the devicetree.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Regarding moving
resetsandreset-namesto the top-levelrequired:,
I will wait for Icenowy's patch to land before sending v6 to avoid duplicating the work.The patch is sent.
Got it.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
In v6 I will update patch 1/7 with:
- Update the subject to "dt-bindings: display: verisilicon,dc: add support for nuvoton,ma35d1-dcu"
- Lowerclocks/clock-namesminItemsto 4 at the top level
- Remove thethead,th1520-dc8200conditional block entirely
Quoted 7 lines
Quoted 3 lines
I think this conditional block will still be needed, because it will need to constrain the minItems to ensure all clocks / resets are populated.
Correct. When the outer constraints are relaxed to deal with the new device the conditional block for the th1520 becomes required. Or having an else, but if all devices are likely to be different in terms of configuration specific conditional blocks is better.
Understood. I will keep the thead,th1520-dc8200 conditional block.
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
In reply to Conor DooleyQuoted 100 lines · Conor Dooley
Quoted 39 lines · Joey Lu
The verisilicon,dc binding was originally written for the T-Head TH1520 SoC carrying a DC8200, and hard-codes five clocks, three resets and two output ports.
Add the Nuvoton MA35D1 DCUltraLite (nuvoton,ma35d1-dcu) to the binding. The DCUltraLite uses only two clocks (core, pix0) and one reset (core), with a single output port.
Use allOf/if blocks to express per-variant constraints rather than hard-coding the DC8200 topology at the top level. Each compatible's block constrains the clock and reset item counts; the nuvoton block additionally overrides clock-names to the two names it actually uses.
Signed-off-by Joey Lu <[email protected]>--- .../bindings/display/verisilicon,dc.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+)Documentation/devicetree/bindings/display/verisilicon,dc.yaml +6
-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:@@ -77,6 +78,62 @@ required: - clock-names - ports +allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your minItems also do nothing.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 107
Quoted 12 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-namesBoth conditional sections have this, but the original binding doesn't require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for single ended variants".
FWIW, adding your new compatible shouldn't really be in a patch with that subject either, it really should say "add support for nuvoton ma35d1" or something.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 117
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ + - if: + properties: + compatible: + contains: + const: nuvoton,ma35d1-dcu + then: + properties: + clocks: + minItems: 2Anything that updates the minimum constraint should be done at the top level of this schema. The conditional section should then tighten the constraint, in this case that means only having maxItems.
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 123
Quoted 6 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +6
-0+ maxItems: 2 + + clock-names: + items: + - const: core + - const: pix0
Quoted 2 lines
Does this even work when the top level schema thinks clock 2 should be called axi?
Additionally here, only have core and pix0 seems like it might be an oversimplification. I doubt removing the second output port means that the axi and ahb clocks are no longer needed.
Is it the case that your device supplies the same clock to core, ahb and axi? If so, then you should fill those clocks in in your devicetree and this can just constrain the number of clocks/clock-names to 4.
Quoted 28 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 9 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
pw-bot: changes-requested
Thanks,
Conor.Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+ + required: + - resets + - reset-names + additionalProperties: false examples:Signature · 1 line
2.43.0
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 125 lines · 在 2026-06-26五的 08:22 +0100,Conor Dooley写道:
Quoted 120 lines · Conor Dooley
Quoted 53 lines · Joey Lu
The verisilicon,dc binding was originally written for the T-Head TH1520
SoC carrying a DC8200, and hard-codes five clocks, three resets and two
output ports.Add the Nuvoton MA35D1 DCUltraLite (nuvoton,ma35d1-dcu) to the binding.
The DCUltraLite uses only two clocks (core, pix0) and one reset (core),
with a single output port.Use allOf/if blocks to express per-variant constraints rather than
hard-coding the DC8200 topology at the top level. Each compatible's
block constrains the clock and reset item counts; the nuvoton block
additionally overrides clock-names to the two names it actually uses.Signed-off-by Joey Lu <[email protected]>---
.../bindings/display/verisilicon,dc.yaml | 57
+++++++++++++++++++1 file changed, 57 insertions(+)diff --git
a/Documentation/devicetree/bindings/display/verisilicon,dc.yamlb/Documentation/devicetree/bindings/display/verisilicon,dc.yamlindex9dc35ab973f2..1e751f3c7ce8100644
---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@@ -77,6 +78,62 @@ required:- clock-names
- portsDocumentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+allOf: + - if: + properties: + compatible: + contains:Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 95
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +10
-0+ const: thead,th1520-dc8200 + then: + properties: + clocks: + minItems: 5 + maxItems: 5 + + clock-names: + minItems: 5 + maxItems: 5All the maxItems here repeat the maximum constraint and do nothing.
Since you didn't change the minimum constraint at the top level, your
minItems also do nothing.Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 107
Quoted 12 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +12
-0+ + resets: + minItems: 3 + maxItems: 3 + + reset-names: + minItems: 3 + maxItems: 3 + + required: + - resets + - reset-namesBoth conditional sections have this, but the original binding doesn't
require these for the thead device. This is a functional change therefore and shouldn't be in a patch calling itself "generalise for
single ended variants".FWIW, adding your new compatible shouldn't really be in a patch with
that subject either, it really should say "add support for nuvoton ma35d1" or something.Quoted 10 lines
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: nuvoton,ma35d1-dcu
+ then:
+ properties:
+ clocks:
+ minItems: 2Anything that updates the minimum constraint should be done at the top
level of this schema. The conditional section should then tighten the
constraint, in this case that means only having maxItems.Quoted 6 lines
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: pix0Quoted 3 lines
Does this even work when the top level schema thinks clock 2 should be
called axi?
Quoted 9 lines
Additionally here, only have core and pix0 seems like it might be an oversimplification. I doubt removing the second output port means that
the axi and ahb clocks are no longer needed.
Is it the case that your device supplies the same clock to core, ahb and
axi? If so, then you should fill those clocks in in your devicetree and
this can just constrain the number of clocks/clock-names to 4.
The clock controller of that SoC is quite weird -- it has only a single gate bit, but controlling 3 clock gates. All core, ahb and axi clocks have gates controlled by this single bit, so it's why currently it's modelled as only core clock supplied.
Well it might be worthful to supply the bus clock before the gate as ahb/axi, especially axi, because both the AXI clock and the core clock constraints the maximum pixel clock.
Thanks,
Icenowy
Quoted 30 lines
Quoted 29 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml required: · line 131
Quoted 10 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +8
-0+ + resets: + minItems: 1 + maxItems: 1 + + reset-names: + items: + - const: coreThis is just maxItems: 1.
pw-bot: changes-requested
Thanks,
Conor.Quoted 11 lines
Documentation/devicetree/bindings/display/verisilicon,dc.yaml +5
-0+ + required: + - resets + - reset-names +additionalProperties: false
examples:Signature · 1 line
2.43.0
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 41 lines · Icenowy Zheng
Quoted 30 lines · 在 2026-06-26五的 08:22 +0100,Conor Dooley写道:
Quoted 25 lines · Conor Dooley
Quoted 10 lines · Joey Lu
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: nuvoton,ma35d1-dcu
+ then:
+ properties:
+ clocks:
+ minItems: 2Anything that updates the minimum constraint should be done at the top
level of this schema. The conditional section should then tighten the
constraint, in this case that means only having maxItems.Quoted 6 lines
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: pix0Quoted 3 lines
Does this even work when the top level schema thinks clock 2 should be
called axi?Quoted 9 lines
Additionally here, only have core and pix0 seems like it might be an oversimplification. I doubt removing the second output port means that
the axi and ahb clocks are no longer needed.
Is it the case that your device supplies the same clock to core, ahb and
axi? If so, then you should fill those clocks in in your devicetree and
this can just constrain the number of clocks/clock-names to 4.
Quoted 4 lines
The clock controller of that SoC is quite weird -- it has only a single gate bit, but controlling 3 clock gates. All core, ahb and axi clocks have gates controlled by this single bit, so it's why currently it's modelled as only core clock supplied.
Yeah, then what's in the binding is definitely wrong.
Even if the same clock was provided to all clock inputs in the IP, all individual clock should be listed in the devicetree - although it will look a little silly to see clocks = <&foo 2>, <&foo 2>, <&foo 2>, <&foo 2>; In this case, 3 clocks controlled by 1 gate bit is an implementation detail of the SoC's clocking hardware, and not relevant to how the dc instance should be described.
Quoted 3 lines
Well it might be worthful to supply the bus clock before the gate as ahb/axi, especially axi, because both the AXI clock and the core clock constraints the maximum pixel clock.
Right. And looking at patch 4/7, and the wording:
| The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose | AXI and AHB bus clocks share a single gate enable bit with the display | core clock, so the clock driver does not expose them separately. This | patch makes the axi and ahb clocks optional in the probe.
It sounds like there's probably some issues with how things are modelled clock wise in this device, unless this is not an accurate statement and there's actually one clock provided to all three inputs. If they're distinct clocks, with different rates, only having one exposed has a lot of potential to be problematic!
Icenowy Zheng
maintainerRe: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 84 lines · 在 2026-06-26五的 09:57 +0100,Conor Dooley写道:
Quoted 47 lines · Icenowy Zheng
Quoted 33 lines · 在 2026-06-26五的 08:22 +0100,Conor Dooley写道:
Quoted 27 lines · Conor Dooley
Quoted 10 lines · Joey Lu
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: nuvoton,ma35d1-dcu
+ then:
+ properties:
+ clocks:
+ minItems: 2Anything that updates the minimum constraint should be done at the
top
level of this schema. The conditional section should then tighten
the
constraint, in this case that means only having maxItems.Quoted 6 lines
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: pix0Quoted 4 lines
Does this even work when the top level schema thinks clock 2 should
be
called axi?Quoted 12 lines
Additionally here, only have core and pix0 seems like it might be an
oversimplification. I doubt removing the second output port means that
the axi and ahb clocks are no longer needed.
Is it the case that your device supplies the same clock to core, ahb
and
axi? If so, then you should fill those clocks in in your devicetree
and
this can just constrain the number of clocks/clock-names to 4.Quoted 7 lines
The clock controller of that SoC is quite weird -- it has only a single
gate bit, but controlling 3 clock gates. All core, ahb and axi clocks
have gates controlled by this single bit, so it's why currently it's
modelled as only core clock supplied.Yeah, then what's in the binding is definitely wrong. Even if the same clock was provided to all clock inputs in the IP, all
individual clock should be listed in the devicetree - although it will
look a little silly to see clocks = <&foo 2>, <&foo 2>, <&foo 2>, <&foo 2>;
In this case, 3 clocks controlled by 1 gate bit is an implementation detail
of the SoC's clocking hardware, and not relevant to how the dc instance
should be described.Quoted 5 lines
Well it might be worthful to supply the bus clock before the gate as
ahb/axi, especially axi, because both the AXI clock and the core clock
constraints the maximum pixel clock.Right. And looking at patch 4/7, and the wording:
Quoted 7 lines
The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose
AXI and AHB bus clocks share a single gate enable bit with the display
core clock, so the clock driver does not expose them separately. This
patch makes the axi and ahb clocks optional in the probe.
Quoted 8 lines
It sounds like there's probably some issues with how things are modelled
clock wise in this device, unless this is not an accurate statement and
there's actually one clock provided to all three inputs. If they're distinct clocks, with different rates, only having one exposed has a lot
of potential to be problematic!
Yes, I agree with this, they're different clocks according to the manual.
I added the clk people to the CC list in a reply of the previous revision, but they didn't react yet. I don't know how to represent multiple clock gates sharing a single control bit in the clock framework...
Maybe just supplying the ungated AXI/AHB clocks here, and let the core clock manage the gate?
Thanks,
Icenowy
Re: [PATCH v5 1/7] dt-bindings: display: verisilicon,dc: generalize for single-output variants
Quoted 94 lines · Icenowy Zheng
Quoted 84 lines · 在 2026-06-26五的 09:57 +0100,Conor Dooley写道:
Quoted 47 lines · Icenowy Zheng
Quoted 33 lines · 在 2026-06-26五的 08:22 +0100,Conor Dooley写道:
Quoted 27 lines · Conor Dooley
Quoted 10 lines · Joey Lu
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: nuvoton,ma35d1-dcu
+ then:
+ properties:
+ clocks:
+ minItems: 2Anything that updates the minimum constraint should be done at the
top
level of this schema. The conditional section should then tighten
the
constraint, in this case that means only having maxItems.Quoted 6 lines
+ maxItems: 2
+
+ clock-names:
+ items:
+ - const: core
+ - const: pix0Quoted 4 lines
Does this even work when the top level schema thinks clock 2 should
be
called axi?Quoted 12 lines
Additionally here, only have core and pix0 seems like it might be an
oversimplification. I doubt removing the second output port means that
the axi and ahb clocks are no longer needed.
Is it the case that your device supplies the same clock to core, ahb
and
axi? If so, then you should fill those clocks in in your devicetree
and
this can just constrain the number of clocks/clock-names to 4.Quoted 7 lines
The clock controller of that SoC is quite weird -- it has only a single
gate bit, but controlling 3 clock gates. All core, ahb and axi clocks
have gates controlled by this single bit, so it's why currently it's
modelled as only core clock supplied.Yeah, then what's in the binding is definitely wrong. Even if the same clock was provided to all clock inputs in the IP, all
individual clock should be listed in the devicetree - although it will
look a little silly to see clocks = <&foo 2>, <&foo 2>, <&foo 2>, <&foo 2>;
In this case, 3 clocks controlled by 1 gate bit is an implementation detail
of the SoC's clocking hardware, and not relevant to how the dc instance
should be described.Quoted 5 lines
Well it might be worthful to supply the bus clock before the gate as
ahb/axi, especially axi, because both the AXI clock and the core clock
constraints the maximum pixel clock.Right. And looking at patch 4/7, and the wording:
Quoted 7 lines
The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose
AXI and AHB bus clocks share a single gate enable bit with the display
core clock, so the clock driver does not expose them separately. This
patch makes the axi and ahb clocks optional in the probe.Quoted 8 lines
It sounds like there's probably some issues with how things are modelled
clock wise in this device, unless this is not an accurate statement and
there's actually one clock provided to all three inputs. If they're distinct clocks, with different rates, only having one exposed has a lot
of potential to be problematic!
Quoted 7 lines
Yes, I agree with this, they're different clocks according to the manual.
I added the clk people to the CC list in a reply of the previous revision, but they didn't react yet. I don't know how to represent multiple clock gates sharing a single control bit in the clock framework...
Yeah, I have absolutely no idea. Maybe it requires custom refcounting? Surely this cannot be the only device that does something like this though.
Quoted 2 lines
Maybe just supplying the ungated AXI/AHB clocks here, and let the core clock manage the gate?
I guess, but that seems incorrect and would require commentary about why it's being done. Feel like they (the missing axi/ahb clocks) should be added to the clock driver and binding, and any special workarounds done there.
Of course letting the core clock manage the gate and making the enable method for the gated AXI/AHB clocks be a NOP is one way of handling it in the clock driver. Still a bit of a hack compared to refcounting it, but it makes me happier to have the correct clock tree modelled in DT.
PATCH v5 2/7 drm/verisilicon: add register-level macros for DC8000
In reply to Joey LuAdd 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
@@ -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
@@ -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
PATCH v5 3/7 drm/verisilicon: introduce per-variant hardware ops table
In reply to Joey LuThe 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 a generation field to struct vs_chip_identity to distinguish variants. Extract the DC8200-specific hardware ops into vs_dc8200.c and add unified IRQ bit definitions so implementations can translate hardware-specific bits to a common set. Update the shared code to dispatch through dc->funcs.
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 | 115 ++++++++++++++++++ drivers/gpu/drm/verisilicon/vs_drm.c | 5 +- drivers/gpu/drm/verisilicon/vs_drm.h | 8 ++ drivers/gpu/drm/verisilicon/vs_hwdb.c | 4 + drivers/gpu/drm/verisilicon/vs_hwdb.h | 6 + .../gpu/drm/verisilicon/vs_primary_plane.c | 32 +---- 11 files changed, 214 insertions(+), 54 deletions(-) create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8200.c
drivers/gpu/drm/verisilicon/Makefile +1 -1
@@ -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
@@ -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
@@ -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_ex) + dc->funcs->crtc_disable_ex (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_ex) + dc->funcs->crtc_enable_ex (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
@@ -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
@@ -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_ex)(struct vs_dc *dc,unsigned int output); +void (*crtc_disable_ex)(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 +115 -0
115 lines not on this page · raw message
drivers/gpu/drm/verisilicon/vs_drm.c +2 -3
@@ -25,7 +25,6 @@#include "vs_bridge.h" #include "vs_crtc.h" #include "vs_dc.h" -#include "vs_dc_top_regs.h" #include "vs_drm.h" #define DRIVER_NAME "verisilicon"
@@ -168,8 +167,8 @@ void vs_drm_handle_irq(struct vs_dc *dc, u32 irqs)unsigned int i;for (i =0 ; i < dc->identity.display_count; i++) { -if (irqs &VSDC_TOP_IRQ_VSYNC (i)) { - irqs &= ~VSDC_TOP_IRQ_VSYNC (i); +if (irqs &VSDC_IRQ_VSYNC (i)) { + irqs &= ~VSDC_IRQ_VSYNC (i);if (dc->drm_dev->crtcs[i])drm_crtc_handle_vblank (&dc->drm_dev->crtcs[i]->base); }
drivers/gpu/drm/verisilicon/vs_drm.h +8 -0
@@ -6,6 +6,7 @@#ifndef _VS_DRM_H_#define _VS_DRM_H_ +#include <linux/bits.h> #include <linux/platform_device.h> #include <linux/types.h>
@@ -13,6 +14,13 @@struct vs_dc ; +/* +* DC variants use different interrupt registers with diverging bit +* assignments; each irq_ack() implementation must translate its +* hardware-specific bits into these definitions. +*/ +#define VSDC_IRQ_VSYNC (n) BIT(n) +struct vs_drm_dev {struct drm_device base;
drivers/gpu/drm/verisilicon/vs_hwdb.c +4 -0
@@ -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
@@ -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
@@ -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
[email protected]
AI reviewRe: [PATCH v5 3/7] 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] CRTC disable hardware operation is called after disabling the pixel clock.
- [High] The register clearing sequence in vs_dc8200_panel_disable_ex is inverted compared to the original code, clearing the configuration bit before stopping the panel.
- [Medium] Unknown hardware interrupts are silently filtered out by the irq_ack abstraction, rendering the unknown interrupt diagnostic warning unreachable.
Pre-existing issues:
- [High] Primary plane disable function incorrectly sets the enable bit rather than clearing it.
- [High] The driver requests its IRQ line before it fully initializes its internal state, creating a race condition that can lead to a NULL pointer dereference.
- [High] vs_dc_irq_handler unconditionally returns IRQ_HANDLED regardless of whether any interrupt bits were set.
--
commit d0e2c6765378754f6b5239526ba6f62ca9de0dd3
Author: Joey Lu <[email protected]>
drm/verisilicon: introduce per-variant hardware ops table
The DC8200 and DCUltraLite share a broadly similar register layout but differ in how the bridge, CRTC, primary plane and IRQ paths are driven. This commit introduces a vs_dc_funcs vtable so each variant can supply its own implementation without scattering conditionals across multiple files.
Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +0
-0
[ ... ]
drivers/gpu/drm/verisilicon/vs_crtc.c static void vs_crtc_atomic_disable(struct drm_crtc *crtc, · line 59
Quoted 8 lines
drivers/gpu/drm/verisilicon/vs_crtc.c +3
-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]); + +if (dc->funcs->crtc_disable_ex) + dc->funcs->crtc_disable_ex (dc, output); }
[Severity: High]
Is it safe to access hardware registers via crtc_disable_ex() after the pixel clock has been gated? The teardown order should typically reverse the initialization order, meaning the hook must be invoked before gating the clock.
[ ... ]
Quoted 13 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);vs_drm_handle_irq (dc, irqs);
Quoted 1 line
return
IRQ_HANDLED;
[Severity: High]
This isn't a bug introduced by this patch, but does unconditionally returning IRQ_HANDLED prevent the kernel from detecting and disabling a stuck shared interrupt line? If the handler processes no interrupts, shouldn't it return IRQ_NONE?
[Severity: High]
This is another pre-existing issue, but in vs_dc_probe(), the IRQ is requested before vs_drm_initialize() is called. Can the IRQ handler fire before dc->drm_dev is allocated, resulting in a NULL pointer dereference when vs_drm_handle_irq() executes?
[ ... ]
Quoted 5 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +0
-0
[ ... ]
drivers/gpu/drm/verisilicon/vs_dc8200.c line 34
Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +7
-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));
[Severity: High]
Does reversing the clear order of the configuration and start registers risk hardware underflows or state desynchronization? In the original vs_bridge_atomic_disable() implementation, the panel was shut down by first clearing VSDC_DISP_PANEL_START_RUNNING and then clearing VSDC_DISP_PANEL_CONFIG_RUNNING.
[ ... ]
drivers/gpu/drm/verisilicon/vs_dc8200.c line 75
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 carried over from the original code, but does the primary plane disable sequence leave the plane enabled by using regmap_set_bits() instead of clearing the VSDC_FB_CONFIG_EX_FB_EN bit?
[ ... ]
Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +4
-0+static u32 vs_dc8200_irq_ack (struct vs_dc *dc) +{ +u32 hw_irqs, unified =0 ; +unsigned int i;
drivers/gpu/drm/verisilicon/vs_dc8200.c line 104
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +10
-0+ +regmap_read (dc->regs,VSDC_TOP_IRQ_ACK , &hw_irqs); + +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_TOP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + } + +return unified; +}
[Severity: Medium]
Does this filter out unknown hardware interrupts, making the diagnostic warning in vs_drm_handle_irq() unreachable? By only passing through known VSDC_IRQ_VSYNC bits, any unmapped hardware interrupt bits are silently discarded.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Icenowy Zheng
maintainerRe: [PATCH v5 3/7] drm/verisilicon: introduce per-variant hardware ops table
In reply to Joey LuQuoted 404 lines · 在 2026-06-25四的 17:44 +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 avs_dc_funcsvtable so each variant can supply its own implementation without scattering conditionals across multiple files.Add a generation field to struct
vs_chip_identityto distinguish variants.
Extract the DC8200-specific hardware ops intovs_dc8200.cand add unified
IRQ bit definitions so implementations can translate hardware- specific
bits to a common set. Update the shared code to dispatch throughdc->funcs.No behaviour change for existing DC8200 platforms.
Signed-off-by Joey Lu <[email protected]>---
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 | 115
++++++++++++++++++
drivers/gpu/drm/verisilicon/vs_drm.c | 5 +- drivers/gpu/drm/verisilicon/vs_drm.h | 8 ++ drivers/gpu/drm/verisilicon/vs_hwdb.c | 4 + drivers/gpu/drm/verisilicon/vs_hwdb.h | 6 + .../gpu/drm/verisilicon/vs_primary_plane.c | 32 +----11 files changed, 214 insertions(+), 54 deletions(-)create mode 100644
drivers/gpu/drm/verisilicon/vs_dc8200.cdrivers/gpu/drm/verisilicon/Makefile +0
-0@@ -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.odrivers/gpu/drm/verisilicon/vs_bridge.c +0
-0@@ -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(structdrm_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 structdrm_bridge_funcsvs_dpi_bridge_funcs= {drivers/gpu/drm/verisilicon/vs_crtc.c +0
-1@@ -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 +3
-0+ +if (dc->funcs->crtc_disable_ex) + dc->funcs->crtc_disable_ex (dc, output);}
static void vs_crtc_atomic_enable(structdrm_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 +3
-0+if (dc->funcs->crtc_enable_ex) + dc->funcs->crtc_enable_ex (dc, output); +
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 structdrm_crtc_helper_funcsvs_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 structdrm_crtc_funcsvs_crtc_funcs= {drivers/gpu/drm/verisilicon/vs_dc.c +0
-0@@ -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 +1
-1-regmap_read (dc->regs,VSDC_TOP_IRQ_ACK , &irqs); + irqs = dc->funcs->irq_ack (dc);
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@@ -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 @@
structvs_drm_dev;
structvs_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 intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*panel_disable_ex)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +7
-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_ex)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*crtc_disable_ex)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +3
-0+ +/* CRTC: enable_vblank, disable_vblank */ + void (*enable_vblank)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*disable_vblank)(struct vs_dc *dc, unsigned intoutput);
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, unsignedint output);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*primary_plane_disable_ex)(struct vs_dc *dc, unsignedint output);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*primary_plane_update_ex)(struct vs_dc *dc, unsignedint 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); +};
structvs_dc{
struct regmap *regs;drivers/gpu/drm/verisilicon/vs_dc.h +0
-0@@ -33,6 +62,9 @@ struct vs_dc {
structvs_drm_dev*drm_dev;
structvs_chip_identityidentity;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 +15
-0@@ -0,0 +1,115 @@ +// 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_drm.h" +#include "vs_plane.h" +#include "vs_primary_plane_regs.h" + +static void vs_dc8200_panel_enable_ex(struct vs_dc *dc, unsigned intoutput)
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, unsignedint 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 intoutput)
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 intoutput)
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 intoutput)
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 +7
-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)
drivers/gpu/drm/verisilicon/vs_dc8200.c line 101
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +10
-0+{ +u32 hw_irqs, unified =0 ; +unsigned int i; + +regmap_read (dc->regs,VSDC_TOP_IRQ_ACK , &hw_irqs); + +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_TOP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + }
Maybe add a drm_WARN_ONCE for unknown hardware IRQ bit?
Well, with this addressed,
``` Reviewed-by: Icenowy Zheng <[email protected]> ```
Thanks,
Icenowy
Quoted 219 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +7
-0+ +return unified; +} + +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_drm.c +0
-1@@ -25,7 +25,6 @@ #include "vs_bridge.h" #include "vs_crtc.h" #include "vs_dc.h" -#include "vs_dc_top_regs.h" #include "vs_drm.h"
#defineDRIVER_NAME"verisilicon"drivers/gpu/drm/verisilicon/vs_drm.c +0
-0@@ -168,8 +167,8 @@ void vs_drm_handle_irq(struct vs_dc *dc, u32 irqs) unsigned int i;
for (i = 0; i <dc->identity.display_count; i++) {drivers/gpu/drm/verisilicon/vs_drm.c +2
-2-if (irqs &VSDC_TOP_IRQ_VSYNC (i)) { - irqs &= ~VSDC_TOP_IRQ_VSYNC (i); +if (irqs &VSDC_IRQ_VSYNC (i)) { + irqs &= ~VSDC_IRQ_VSYNC (i);if (dc->drm_dev->crtcs[i]) drm_crtc_handle_vblank(&dc->drm_dev-
Quoted 1 line
crtcs[i]->base);
}
drivers/gpu/drm/verisilicon/vs_drm.h +0
-0@@ -6,6 +6,7 @@ #ifndef _VS_DRM_H_ #define _VS_DRM_H_
+#include <linux/bits.h>
#include <linux/platform_device.h>
#include <linux/types.h>drivers/gpu/drm/verisilicon/vs_drm.h +0
-0@@ -13,6 +14,13 @@
structvs_dc;drivers/gpu/drm/verisilicon/vs_drm.h +7
-0+/* +* DC variants use different interrupt registers with diverging bit +* assignments; each irq_ack() implementation must translate its +* hardware-specific bits into these definitions. +*/ +#define VSDC_IRQ_VSYNC (n) BIT(n) +struct
vs_drm_dev{
structdrm_devicebase;drivers/gpu/drm/verisilicon/vs_hwdb.c +0
-0@@ -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@@ -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 fielddrivers/gpu/drm/verisilicon/vs_primary_plane.c +0
-0@@ -53,12 +53,6 @@ static int vs_primary_plane_atomic_check(struct drm_plane *plane, return 0; }
-static voidvs_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(structdrm_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(structdrm_plane*plane,drivers/gpu/drm/verisilicon/vs_primary_plane.c +0
-0@@ -88,10 +77,8 @@ static void vs_primary_plane_atomic_disable(structdrm_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(structdrm_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 structdrm_plane_helper_funcsvs_primary_plane_helper_funcs= {
Re: [PATCH v5 3/7] drm/verisilicon: introduce per-variant hardware ops table
Quoted 417 lines · Icenowy Zheng
Quoted 404 lines · 在 2026-06-25四的 17:44 +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 avs_dc_funcsvtable so each variant can supply its own implementation without scattering conditionals across multiple files.Add a generation field to struct
vs_chip_identityto distinguish variants.
Extract the DC8200-specific hardware ops intovs_dc8200.cand add unified
IRQ bit definitions so implementations can translate hardware- specific
bits to a common set. Update the shared code to dispatch throughdc->funcs.No behaviour change for existing DC8200 platforms.
Signed-off-by Joey Lu <[email protected]>--- 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 | 115 ++++++++++++++++++ drivers/gpu/drm/verisilicon/vs_drm.c | 5 +- drivers/gpu/drm/verisilicon/vs_drm.h | 8 ++ drivers/gpu/drm/verisilicon/vs_hwdb.c | 4 + drivers/gpu/drm/verisilicon/vs_hwdb.h | 6 + .../gpu/drm/verisilicon/vs_primary_plane.c | 32 +---- 11 files changed, 214 insertions(+), 54 deletions(-)create mode 100644
drivers/gpu/drm/verisilicon/vs_dc8200.cdrivers/gpu/drm/verisilicon/Makefile +1
-1@@ -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.oobj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o
drivers/gpu/drm/verisilicon/vs_bridge.c +2
-9@@ -162,15 +162,8 @@ static void vs_bridge_enable_common(structvs_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_funcsvs_dpi_bridge_funcs= {drivers/gpu/drm/verisilicon/vs_crtc.c +27
-1@@ -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_ex) + dc->funcs->crtc_disable_ex (dc, output); }static void vs_crtc_atomic_enable(struct
drm_crtc*crtc,drivers/gpu/drm/verisilicon/vs_crtc.c +5
-1@@ -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_ex) + dc->funcs->crtc_enable_ex (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,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_funcsvs_crtc_funcs= {drivers/gpu/drm/verisilicon/vs_dc.c +3
-3@@ -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 +15
-0@@ -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_ex)(struct vs_dc *dc,unsigned int output); + void (*crtc_disable_ex)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +3
-0+ +/* CRTC: enable_vblank, disable_vblank */ + void (*enable_vblank)(struct vs_dc *dc, unsigned intoutput);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*disable_vblank)(struct vs_dc *dc, unsigned intoutput);
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, unsignedint output);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*primary_plane_disable_ex)(struct vs_dc *dc, unsignedint output);
drivers/gpu/drm/verisilicon/vs_dc.h +1
-0+ void (*primary_plane_update_ex)(struct vs_dc *dc, unsignedint 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 +15
-0@@ -0,0 +1,115 @@ +// 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_drm.h" +#include "vs_plane.h" +#include "vs_primary_plane_regs.h" + +static void vs_dc8200_panel_enable_ex(struct vs_dc *dc, unsigned intoutput)
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, unsignedint 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 intoutput)
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 intoutput)
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 intoutput)
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 +7
-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)drivers/gpu/drm/verisilicon/vs_dc8200.c line 101
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc8200.c new file +10
-0+{ +u32 hw_irqs, unified =0 ; +unsigned int i; + +regmap_read (dc->regs,VSDC_TOP_IRQ_ACK , &hw_irqs); + +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_TOP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + }Maybe add a
drm_WARN_ONCEfor unknown hardware IRQ bit?
Quoted 8 lines
Well, with this addressed,
``` Reviewed-by: Icenowy Zheng <[email protected]> ```Thanks,
Icenowy
I will add a drm_WARN_ONCE after the IRQ translation loop in vs_dc8200_irq_ack to catch any unknown hardware IRQ bits.
PATCH v5 4/7 drm/verisilicon: make axi and ahb clocks optional
In reply to Joey LuThe Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose AXI and AHB bus clocks share a single gate enable bit with the display core clock, so the clock driver does not expose them separately. This patch makes the axi and ahb clocks optional in the probe.
--- drivers/gpu/drm/verisilicon/vs_dc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/verisilicon/vs_dc.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v5 4/7] drm/verisilicon: make axi and ahb clocks optional
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Possible NULL pointer dereference in the IRQ handler if an interrupt triggers before DRM initialization completes. --
commit 2cd6077ab2fb5ed065ee2cef55004b713c80f827
Author: Joey Lu <[email protected]>
drm/verisilicon: make axi and ahb clocks optional
The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose AXI and AHB bus clocks share a single gate enable bit with the display core clock, so the clock driver does not expose them separately. This patch makes the axi and ahb clocks optional in the probe.
Quoted 4 lines
drivers/gpu/drm/verisilicon/vs_dc.c +0
-0
[ ... ]
drivers/gpu/drm/verisilicon/vs_dc.c static int vs_dc_probe(struct platform_device *pdev) · line 94
Quoted 7 lines
drivers/gpu/drm/verisilicon/vs_dc.c +1
-1@@ -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)) {
[Severity: High]
This is a pre-existing issue, but is it possible for an interrupt to trigger a NULL pointer dereference during probe if the bootloader left the display active?
Looking further down in vs_dc_probe(), the IRQ handler is registered before vs_drm_initialize() is called:
ret = devm_request_irq(dev, irq, vs_dc_irq_handler, 0,
dev_name(dev), dc);
if (ret) {
dev_err(dev, "can't request irq\n");
goto err_rst_assert;
}
dev_set_drvdata(dev, dc);
ret = vs_drm_initialize(dc, pdev);If a pending interrupt (such as VSYNC) fires immediately after devm_request_irq() is called, vs_dc_irq_handler() will be triggered and will eventually call vs_drm_handle_irq().
Looking at vs_drm_handle_irq() in vs_drm.c, it unconditionally dereferences the drm_dev pointer:
if (dc->drm_dev->crtcs[i]) drm_crtc_handle_vblank(&dc->drm_dev->crtcs[i]->base);
Since vs_drm_initialize() hasn't allocated or assigned dc->drm_dev yet, could this cause a kernel panic during boot on platforms where the bootloader leaves interrupts enabled?
Would it be safer to request the IRQ after the DRM device is fully initialized, or to mask interrupts in the hardware before registering the handler?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Icenowy Zheng
maintainerRe: [PATCH v5 4/7] drm/verisilicon: make axi and ahb clocks optional
In reply to Joey LuQuoted 8 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose
AXI and AHB bus clocks share a single gate enable bit with the display
core clock, so the clock driver does not expose them separately. This patch makes the axi and ahb clocks optional in the probe.Signed-off-by Joey Lu <[email protected]>
``` Reviewed-by: Icenowy Zheng <[email protected]> ```
Thanks,
Icenowy
Quoted 26 lines
---
drivers/gpu/drm/verisilicon/vs_dc.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/verisilicon/vs_dc.c +0
-0@@ -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"); returnPTR_ERR(dc->axi_clk); }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" );if (
IS_ERR(dc->ahb_clk)) {dev_err(dev, "can't get ahb clock\n"); returnPTR_ERR(dc->ahb_clk);
Re: [PATCH v5 4/7] drm/verisilicon: make axi and ahb clocks optional
Quoted 8 lines · Icenowy Zheng
Quoted 7 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
The Nuvoton MA35D1 SoC integrates a DCUltraLite display controller whose
AXI and AHB bus clocks share a single gate enable bit with the display
core clock, so the clock driver does not expose them separately. This patch makes the axi and ahb clocks optional in the probe.
Quoted 7 lines
Quoted 1 line
Signed-off-by Joey Lu <[email protected]>``` Reviewed-by: Icenowy Zheng <[email protected]> ```Thanks,
Icenowy
Thank you for the review. I will revert this patch entirely. As discussed in the binding review, axi and ahb clocks will now always be supplied in the devicetree using the same phandle as the core clock gate, so making them optional in the driver is no longer needed.
Quoted 26 lines
Quoted 26 lines
--- drivers/gpu/drm/verisilicon/vs_dc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/verisilicon/vs_dc.c +2
-2@@ -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);
PATCH v5 5/7 drm/verisilicon: add DC8000 (DCUltraLite) display controller support
In reply to Joey LuThe Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller (DC8000 generation) 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. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.
--- drivers/gpu/drm/verisilicon/Makefile | 2 +- drivers/gpu/drm/verisilicon/vs_dc.c | 5 +- drivers/gpu/drm/verisilicon/vs_dc.h | 1 + drivers/gpu/drm/verisilicon/vs_dc8000.c | 86 +++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/verisilicon/vs_dc8000.c
drivers/gpu/drm/verisilicon/Makefile +1 -1
@@ -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 +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
@@ -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 +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v5 5/7] drm/verisilicon: add DC8000 (DCUltraLite) display controller support
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [High] The DC8000 panel enable, CRTC begin, and CRTC flush operations use incorrect registers and bits, directly contradicting the commit message and breaking hardware functionality.
- [Medium] The hw_irqs variable is passed to regmap_read() uninitialized and used without checking for read failures.
Pre-existing issues:
- [High] The DC8200 primary plane disable function erroneously sets the enable bit instead of clearing it, keeping the plane active.
- [High] The IRQ handler unconditionally dereferences dc->drm_dev, but the interrupt is enabled before dc->drm_dev is allocated and remains active after it is freed. --
commit a518460571afb18a0b4ff8e14af894a66907ebde
Author: Joey Lu <[email protected]>
drm/verisilicon: add DC8000 (DCUltraLite) display controller support
The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller (DC8000 generation) whose register layout differs from the DC8200 in several important ways:
Quoted 8 lines
1. No
CONFIG_EXcommit path: framebuffer updates use the enable (bit 0) and reset (bit 4) bits inFB_CONFIGinstead of the DC8200 staging registers (FB_CONFIG_EX,FB_TOP_LEFT,FB_BOTTOM_RIGHT,FB_BLEND_CONFIG,PANEL_CONFIG_EX).2. No
PANEL_STARTregister: panel output starts when PANEL_CONFIG.RUNNING is set; there is no multi-display sync start register.
[Severity: High]
Do the functions implemented in this patch use the correct registers and bits as described in the commit message?
In vs_dc8000_panel_enable_ex(), the code sets a reset bit (VSDC_FB_CONFIG_RESET) in VSDC_FB_CONFIG instead of writing to PANEL_CONFIG.
Additionally, vs_dc8000_crtc_begin() and vs_dc8000_crtc_flush() use an unmentioned VALID bit (VSDC_FB_CONFIG_VALID), and clear it after updates complete, which seems to invert normal latch semantics.
Could this mismatch prevent the display panel from enabling properly?
Quoted 14 lines
3. Different IRQ registers: DCUltraLite uses
DISP_IRQ_STA(0x147C) /DISP_IRQ_EN(0x1480) versus DC8200'sTOP_IRQ_ACK(0x0010) /TOP_IRQ_EN(0x0014).4. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.
Signed-off-by Joey Lu <[email protected]>drivers/gpu/drm/verisilicon/Makefile +0
-0
drivers/gpu/drm/verisilicon/Makefile line 3
Quoted 4 lines
drivers/gpu/drm/verisilicon/Makefile +1
-1@@ -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 \
[Severity: High]
This is a pre-existing issue, but while reviewing the driver files included here, I noticed a potential problem in vs_dc8200.c:vs_dc8200_primary_plane_disable_ex().
The function appears to call regmap_set_bits() on VSDC_FB_CONFIG_EX_FB_EN instead of regmap_clear_bits():
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);
...
}Does this erroneously keep the primary plane active when the DRM framework expects it to be turned off, potentially breaking power management?
Quoted 3 lines
drivers/gpu/drm/verisilicon/Makefile +0
-0vs_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 static int vs_dc_probe(struct platform_device *pdev) · line 140
Quoted 13 lines
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;
[Severity: High]
This is a pre-existing issue, but I noticed a potential lifecycle regression in vs_dc_probe() just below this block.
The function calls devm_request_irq() to register vs_dc_irq_handler() before calling vs_drm_initialize(), which is responsible for allocating and assigning dc->drm_dev.
If an interrupt fires during this window, for example if the bootloader left VSYNC interrupts enabled, the handler is invoked:
vs_drm.c:vs_drm_handle_irq() {
...
if (dc->drm_dev->crtcs[i])
drm_crtc_handle_vblank(&dc->drm_dev->crtcs[i]->base);
...
}Will this unconditionally dereference dc->drm_dev and cause a NULL pointer dereference before vs_drm_initialize() has completed?
Quoted 3 lines
drivers/gpu/drm/verisilicon/vs_dc.c +0
-0if (port_count > dc->identity.display_count) {dev_err (dev,"too many downstream ports than HW capability\n" );
[ ... ]
Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +0
-0@@ -0,0 +1,86 @@
[ ... ]
drivers/gpu/drm/verisilicon/vs_dc8000.c line 66
Quoted 6 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6
-0+static u32 vs_dc8000_irq_ack (struct vs_dc *dc) +{ +u32 hw_irqs, unified =0 ; +unsigned int i; + +regmap_read (dc->regs,VSDC_DISP_IRQ_STA , &hw_irqs);
[Severity: Medium]
Is it safe to use hw_irqs here if regmap_read() fails?
If regmap_read() returns an error code, hw_irqs will remain uninitialized stack memory.
The function then proceeds to bitwise-AND this uninitialized value to determine which VSYNC interrupts fired:
for (i = 0; i < VSDC_MAX_OUTPUTS; i++) {
if (hw_irqs & VSDC_DISP_IRQ_VSYNC(i))
unified |= VSDC_IRQ_VSYNC(i);
}Could this result in spurious VSYNC events being dispatched to the DRM core if a read failure occurs?
Quoted 8 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +8
-0+ +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_DISP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + } + +return unified; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Icenowy Zheng
maintainerRe: [PATCH v5 5/7] drm/verisilicon: add DC8000 (DCUltraLite) display controller support
In reply to Joey LuQuoted 154 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller (DC8000 generation) whose register layout differs from the DC8200 in several important ways:
1. No
CONFIG_EXcommit path: framebuffer updates use the enable (bit
0)
and reset (bit 4) bits inFB_CONFIGinstead of the DC8200 staging registers (FB_CONFIG_EX,FB_TOP_LEFT,FB_BOTTOM_RIGHT,FB_BLEND_CONFIG,PANEL_CONFIG_EX).2. No
PANEL_STARTregister: 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'sTOP_IRQ_ACK(0x0010) /TOP_IRQ_EN(0x0014).4. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.
Signed-off-by Joey Lu <[email protected]>---
drivers/gpu/drm/verisilicon/Makefile | 2 +-
drivers/gpu/drm/verisilicon/vs_dc.c | 5 +-
drivers/gpu/drm/verisilicon/vs_dc.h | 1 +
drivers/gpu/drm/verisilicon/vs_dc8000.c | 86
+++++++++++++++++++++++++4 files changed, 92 insertions(+), 2 deletions(-)create mode 100644
drivers/gpu/drm/verisilicon/vs_dc8000.cdrivers/gpu/drm/verisilicon/Makefile +0
-0@@ -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.odrivers/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@@ -66,5 +66,6 @@ struct vs_dc { };
extern const structvs_dc_funcsvs_dc8200_funcs;
+extern const structvs_dc_funcsvs_dc8000_funcs;
#endif /* _VS_DC_H_ */drivers/gpu/drm/verisilicon/vs_dc8000.c new file +13
-0@@ -0,0 +1,86 @@ +// 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_drm.h" +#include "vs_primary_plane_regs.h" + +static void vs_dc8000_panel_enable_ex(struct vs_dc *dc, unsigned intoutput)
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, unsignedint 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 intoutput)
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 intoutput)
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_ex(struct vs_dc *dc, unsigned intoutput)
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_ex(struct vs_dc *dc, unsigned intoutput)
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 intoutput)
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 intoutput)
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6
-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)
drivers/gpu/drm/verisilicon/vs_dc8000.c line 71
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +10
-0+{ +u32 hw_irqs, unified =0 ; +unsigned int i; + +regmap_read (dc->regs,VSDC_DISP_IRQ_STA , &hw_irqs); + +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_DISP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + }
Maybe a warning for unknown IRQ bits should be added here.
Thanks,
Icenowy
Quoted 15 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +15
-0+ +return unified; +} + +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_ex = vs_dc8000_crtc_enable_ex, + .crtc_disable_ex = vs_dc8000_crtc_disable_ex, + .enable_vblank = vs_dc8000_enable_vblank, + .disable_vblank = vs_dc8000_disable_vblank, + .irq_ack = vs_dc8000_irq_ack, +};
Re: [PATCH v5 5/7] drm/verisilicon: add DC8000 (DCUltraLite) display controller support
Quoted 167 lines · Icenowy Zheng
Quoted 154 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
The Nuvoton MA35D1 SoC integrates a Verisilicon DCUltraLite display controller (DC8000 generation) whose register layout differs from the DC8200 in several important ways:
1. No
CONFIG_EXcommit path: framebuffer updates use the enable (bit
0)
and reset (bit 4) bits inFB_CONFIGinstead of the DC8200 staging registers (FB_CONFIG_EX,FB_TOP_LEFT,FB_BOTTOM_RIGHT,FB_BLEND_CONFIG,PANEL_CONFIG_EX).2. No
PANEL_STARTregister: 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'sTOP_IRQ_ACK(0x0010) /TOP_IRQ_EN(0x0014).4. Simpler clock topology: only 'core' (bus gate) and 'pix0' (pixel divider) clocks; no axi or ahb clocks required.
Signed-off-by Joey Lu <[email protected]>--- drivers/gpu/drm/verisilicon/Makefile | 2 +- drivers/gpu/drm/verisilicon/vs_dc.c | 5 +- drivers/gpu/drm/verisilicon/vs_dc.h | 1 + drivers/gpu/drm/verisilicon/vs_dc8000.c | 86 +++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-)create mode 100644
drivers/gpu/drm/verisilicon/vs_dc8000.cdrivers/gpu/drm/verisilicon/Makefile +1
-1@@ -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.oobj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon-dc.o
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@@ -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 +13
-0@@ -0,0 +1,86 @@ +// 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_drm.h" +#include "vs_primary_plane_regs.h" + +static void vs_dc8000_panel_enable_ex(struct vs_dc *dc, unsigned intoutput)
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, unsignedint 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 intoutput)
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 intoutput)
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_ex(struct vs_dc *dc, unsigned intoutput)
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_ex(struct vs_dc *dc, unsigned intoutput)
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 intoutput)
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 intoutput)
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +6
-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)drivers/gpu/drm/verisilicon/vs_dc8000.c line 71
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +10
-0+{ +u32 hw_irqs, unified =0 ; +unsigned int i; + +regmap_read (dc->regs,VSDC_DISP_IRQ_STA , &hw_irqs); + +for (i =0 ; i <VSDC_MAX_OUTPUTS ; i++) { +if (hw_irqs &VSDC_DISP_IRQ_VSYNC (i)) + unified |=VSDC_IRQ_VSYNC (i); + }Maybe a warning for unknown IRQ bits should be added here.
Quoted 2 lines
Thanks,
Icenowy
I will add the same drm_WARN_ONCE pattern in vs_dc8000_irq_ack for unknown VSDC_DISP_IRQ_STA bits.
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/verisilicon/vs_dc8000.c new file +15
-0+ +return unified; +} + +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_ex = vs_dc8000_crtc_enable_ex, + .crtc_disable_ex = vs_dc8000_crtc_disable_ex, + .enable_vblank = vs_dc8000_enable_vblank, + .disable_vblank = vs_dc8000_disable_vblank, + .irq_ack = vs_dc8000_irq_ack, +};
PATCH v5 6/7 drm/verisilicon: add DCUltraLite chip identity to HWDB
In reply to Joey LuThe 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.
drivers/gpu/drm/verisilicon/vs_hwdb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
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,
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v5 6/7] drm/verisilicon: add DCUltraLite chip identity to HWDB
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The newly added DCUltraLite chip restricts the max cursor size to 32x32, but the driver does not…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The newly added DCUltraLite chip restricts the max cursor size to 32x32, but the driver does not configure drm->mode_config.cursor_width or cursor_height. DRM core defaults to 64x64 when these fields are 0. This incorrectly exposes a DRM_CAP_CURSOR_WIDTH of 64 to userspace, causing atomic commits with 64x64 hardware cursors to be rejected with -EINVAL, breaking display compositors. --
commit a3c0d8a714c977c54ec25009535f44e9ded7c881
Author: Joey Lu <[email protected]>
drm/verisilicon: add DCUltraLite chip identity to HWDB
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
drivers/gpu/drm/verisilicon/vs_hwdb.c +0
-0@@ -129,6 +129,16 @@ static struct vs_chip_identity vs_chip_identities[] = { .max_cursor_size = 64,
drivers/gpu/drm/verisilicon/vs_hwdb.c static struct vs_chip_identity vs_chip_identities[] = { · line 139
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +8
-0.formats = &vs_formats_no_yuv444, }, + { + .model = 0x0, /* DCUltraLite */ + .revision = 0x5560, + .customer_id = 0x305, + + .generation = VSDC_GEN_DC8000, + .display_count = 1, + .max_cursor_size = 32,
[Severity: High]
Does this code expose an incorrect DRM_CAP_CURSOR_WIDTH to userspace?
Looking at vs_mode_config_init() in drivers/gpu/drm/verisilicon/vs_drm.c, the driver does not seem to configure drm->mode_config.cursor_width or cursor_height:
drivers/gpu/drm/verisilicon/vs_drm.c:vs_mode_config_init() {
...
drm->mode_config.helper_private = &vs_mode_config_helper_funcs;
}When these fields are 0, the DRM core defaults to 64x64. This means userspace compositors might query the capability, receive 64x64, and attempt to commit a 64x64 hardware cursor.
If this new chip restricts the max cursor size to 32x32, will the driver's atomic check reject the 64x64 state and break display compositors?
Quoted 3 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +2
-0+ .formats = &vs_formats_no_yuv444, + }, };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Icenowy Zheng
maintainerRe: [PATCH v5 6/7] drm/verisilicon: add DCUltraLite chip identity to HWDB
In reply to Joey LuQuoted 20 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
The Nuvoton MA35D1 chip contains a DCUltraLite display controller with
model number0x0(sic, the model name contains no number either), revision0x5560and customer ID 0x305. It has a similar register map with DC8000, only one display output and only 32x32 cursor supported.Signed-off-by Joey Lu <[email protected]>drivers/gpu/drm/verisilicon/vs_hwdb.c | 10 ++++++++++
1 file changed, 10 insertions(+)drivers/gpu/drm/verisilicon/vs_hwdb.c +0
-0@@ -129,6 +129,16 @@ static struct vs_chip_identity vs_chip_identities[] = { .max_cursor_size = 64, .formats = &vs_formats_no_yuv444, },
drivers/gpu/drm/verisilicon/vs_hwdb.c static struct vs_chip_identity · line 142
Quoted 10 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +10
-0+ { + .model = 0x0, /* DCUltraLite */ + .revision = 0x5560, + .customer_id = 0x305, + + .generation = VSDC_GEN_DC8000, + .display_count = 1, + .max_cursor_size = 32, + .formats = &vs_formats_no_yuv444, + },
Checked against the MA35D1 manual, and it looks okay.
``` Reviewed-by: Icenowy Zheng <[email protected]> ```
Thanks,
Icenowy
Quoted 3 lines
drivers/gpu/drm/verisilicon/vs_hwdb.c +0
-0};
int vs_fill_chip_identity(struct regmap *regs,
PATCH v5 7/7 drm/verisilicon: extend Kconfig to support ARCH_MA35 platforms
In reply to Joey LuAdd ARCH_MA35 to the platform dependencies to allow the driver to be built for Nuvoton MA35D1.
--- drivers/gpu/drm/verisilicon/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/verisilicon/Kconfig +1 -1
@@ -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
Icenowy Zheng
maintainerQuoted 60 lines · 在 2026-06-25四的 17:44 +0800,Joey Lu写道:
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_EXcommit 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 inFB_CONFIGfor direct framebuffer updates, and
requires a per-frame VALID bit toggle (FB_CONFIGbit 3) to latch configuration changes.- No
PANEL_STARTregister: panel output begins when PANEL_CONFIG.RUNNING is set; the DC8200 multi-display sync start register at0x1CCCdoes not exist.- Different IRQ registers:
DISP_IRQ_STAat0x147C/DISP_IRQ_ENat0x1480, versus the DC8200'sTOP_IRQ_ACKat0x0010/TOP_IRQ_ENat0x0014.- 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 reads0x0(revision0x5560,customer_id0x305), allowing the existingvs_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_funcshardware ops vtable with DC8200 ops extracted intovs_dc8200.c; making axi/ahb clocks optional as a separate atomic change;
and the DC8000 ops in vs_dc8000.c. Patch 6 adds the DCUltraLite HWDB entry that gates hardware recognition once all support is in place.
Quoted 5 lines
Patch 7 adds the
Kconfigdependency onARCH_MA35, placed last because it
is only meaningful after the HWDB entry is added.All patches have been tested on Nuvoton MA35D1 hardware.
I also tested these patches on TH1520, and it seems to show no regression.
Thanks,
Icenowy
Quoted 56 lines
Changes from v4:
- [dt-bindings] Kept clock and reset item descriptions in the global
clocks:/resets: properties; per-compatible sections only constrain
minItems/maxItems and override clock-names items for nuvoton,ma35d1-dcu.
- [dt-bindings] Dropped redundant global minItems/maxItems on clocks:
and clock-names:.
- [dt-bindings] Dropped the extra-space typo fix in port@0 description
to keep the patch atomic; left for a separate patch later.
- [ops] Renamed crtc_enable/crtc_disable hooks to crtc_enable_ex/crtc_disable_ex.
- [ops] Added unified IRQ bit definitions; eachirq_ack()implementation
now translates hardware-specific bits before returning.
- [clocks] Split the axi/ahb optional-clock change into its own patch
for atomicity.
- [hwdb] Simplified the commit message for patch 6.
- [kconfig] Simplified the commit message for patch 7.Joey Lu (7):
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: make axi and ahb clocks optional drm/verisilicon: add DC8000 (DCUltraLite) display controller support
drm/verisilicon: add DCUltraLite chip identity to HWDB drm/verisilicon: extendKconfigto supportARCH_MA35platforms.../bindings/display/verisilicon,dc.yaml | 57 +++++++++ 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 | 86 +++++++++++++ drivers/gpu/drm/verisilicon/vs_dc8200.c | 115
++++++++++++++++++
drivers/gpu/drm/verisilicon/vs_drm.c | 5 +- drivers/gpu/drm/verisilicon/vs_drm.h | 8 ++ 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 +16 files changed, 378 insertions(+), 57 deletions(-)create mode 100644
drivers/gpu/drm/verisilicon/vs_dc8000.ccreate mode 100644drivers/gpu/drm/verisilicon/vs_dc8200.c