* [RFC PATCH 01/13] dt-bindings: sram: sunxi: Add A733 system-control compatible
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 02/13] dt-bindings: display: sun4i: Document A733 DE3.5 display pipeline Alastair D'Silva
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Add the allwinner,sun60i-a733-system-control compatible string for the
Allwinner A733 system control block.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../bindings/sram/allwinner,sun4i-a10-system-control.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml b/Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml
index 6e6ab2168a2a..4d3445a87f14 100644
--- a/Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml
+++ b/Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml
@@ -37,6 +37,7 @@ properties:
- allwinner,sun50i-a64-system-control
- allwinner,sun50i-h5-system-control
- allwinner,sun50i-h616-system-control
+ - allwinner,sun60i-a733-system-control
- items:
- enum:
- allwinner,suniv-f1c100s-system-control
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 02/13] dt-bindings: display: sun4i: Document A733 DE3.5 display pipeline
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 01/13] dt-bindings: sram: sunxi: Add A733 system-control compatible Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 03/13] dt-bindings: display: sun4i: Document A733 TCON TOP, TCON TV, and HDMI Alastair D'Silva
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Document the Allwinner A733 DE3.5 display engine, planes, and mixer
bindings. DE3.5 adds AHB and MBUS clocks, two reset lines, and a power
domain.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../allwinner,sun4i-a10-display-engine.yaml | 1 +
.../allwinner,sun50i-h616-de33-planes.yaml | 13 +++++-
.../allwinner,sun8i-a83t-de2-mixer.yaml | 46 ++++++++++++++++++-
3 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-engine.yaml b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-engine.yaml
index e6088f379f70..e5102cc58728 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-engine.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-engine.yaml
@@ -65,6 +65,7 @@ properties:
- allwinner,sun20i-d1-display-engine
- allwinner,sun50i-a64-display-engine
- allwinner,sun50i-h6-display-engine
+ - allwinner,sun60i-a733-display-engine
allwinner,pipelines:
$ref: /schemas/types.yaml#/definitions/phandle-array
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun50i-h616-de33-planes.yaml b/Documentation/devicetree/bindings/display/allwinner,sun50i-h616-de33-planes.yaml
index 0a07cb8a5f79..0a713096bd44 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun50i-h616-de33-planes.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun50i-h616-de33-planes.yaml
@@ -18,6 +18,7 @@ properties:
compatible:
enum:
- allwinner,sun50i-h616-de33-planes
+ - allwinner,sun60i-a733-de35-planes
reg:
maxItems: 1
@@ -31,7 +32,17 @@ properties:
required:
- compatible
- reg
- - allwinner,plane-mapping
+
+if:
+ properties:
+ compatible:
+ const: allwinner,sun50i-h616-de33-planes
+then:
+ required:
+ - allwinner,plane-mapping
+else:
+ properties:
+ allwinner,plane-mapping: false
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml
index 064e4ca7e419..aa7161e86db9 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-de2-mixer.yaml
@@ -25,30 +25,43 @@ properties:
- allwinner,sun50i-a64-de2-mixer-1
- allwinner,sun50i-h6-de3-mixer-0
- allwinner,sun50i-h616-de33-mixer-0
+ - allwinner,sun60i-a733-de35-mixer-0
reg: true
reg-names: true
clocks:
+ minItems: 2
items:
- description: The mixer interface clock
- description: The mixer module clock
+ - description: The mixer AHB clock
+ - description: The mixer MBUS clock
clock-names:
+ minItems: 2
items:
- const: bus
- const: mod
+ - const: ahb
+ - const: mbus
iommus:
maxItems: 1
- resets:
+ power-domains:
maxItems: 1
+ resets:
+ minItems: 1
+ items:
+ - description: The mixer interface reset
+ - description: The display engine subsystem reset
+
allwinner,planes:
$ref: /schemas/types.yaml#/definitions/phandle
- description: Phandle of Display Engine 3.3 planes node
+ description: Phandle of Display Engine 3.3 or 3.5 planes node
ports:
$ref: /schemas/graph.yaml#/properties/ports
@@ -74,12 +87,14 @@ allOf:
contains:
enum:
- allwinner,sun50i-h616-de33-mixer-0
+ - allwinner,sun60i-a733-de35-mixer-0
then:
properties:
reg:
description: |
Registers for display blending control (display) and global
control (top). Names are from Allwinner BSP kernel.
+ minItems: 2
maxItems: 2
reg-names:
items:
@@ -93,8 +108,35 @@ allOf:
properties:
reg:
maxItems: 1
+ reg-names: false
allwinner,planes: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun60i-a733-de35-mixer-0
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ clock-names:
+ minItems: 4
+ resets:
+ minItems: 2
+ required:
+ - power-domains
+
+ else:
+ properties:
+ clocks:
+ maxItems: 2
+ clock-names:
+ maxItems: 2
+ resets:
+ maxItems: 1
+ power-domains: false
+
required:
- compatible
- reg
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 03/13] dt-bindings: display: sun4i: Document A733 TCON TOP, TCON TV, and HDMI
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 01/13] dt-bindings: sram: sunxi: Add A733 system-control compatible Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 02/13] dt-bindings: display: sun4i: Document A733 DE3.5 display pipeline Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 04/13] soc: sunxi: sram: Add A733 system-control RESCAL support Alastair D'Silva
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Document the Allwinner A733 TCON TOP1, TCON TV0, DW-HDMI 2.0
controller, and TOP PHY bindings. The TOP PHY uses a syscon reference
for RESCAL calibration.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../display/allwinner,sun4i-a10-tcon.yaml | 19 +++
.../display/allwinner,sun8i-a83t-dw-hdmi.yaml | 142 ++++++++++++-----
.../allwinner,sun8i-a83t-hdmi-phy.yaml | 148 +++++++++++-------
.../display/allwinner,sun8i-r40-tcon-top.yaml | 44 +++++-
4 files changed, 257 insertions(+), 96 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml
index 724d93b9193b..d556d8a1cdcc 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml
@@ -35,6 +35,7 @@ properties:
- const: allwinner,sun9i-a80-tcon-tv
- const: allwinner,sun20i-d1-tcon-lcd
- const: allwinner,sun20i-d1-tcon-tv
+ - const: allwinner,sun60i-a733-tcon-tv
- items:
- enum:
@@ -80,6 +81,9 @@ properties:
dmas:
maxItems: 1
+ power-domains:
+ maxItems: 1
+
resets:
anyOf:
- items:
@@ -254,6 +258,7 @@ allOf:
- allwinner,sun8i-r40-tcon-tv
- allwinner,sun9i-a80-tcon-tv
- allwinner,sun20i-d1-tcon-tv
+ - allwinner,sun60i-a733-tcon-tv
then:
properties:
@@ -361,6 +366,20 @@ allOf:
required:
- dmas
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun60i-a733-tcon-tv
+
+ then:
+ required:
+ - power-domains
+
+ else:
+ properties:
+ power-domains: false
+
examples:
- |
#include <dt-bindings/dma/sun4i-a10.h>
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml
index c43b02ec884f..9b9ef5853675 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Allwinner A83t DWC HDMI TX Encoder
description: |
- The HDMI transmitter is a Synopsys DesignWare HDMI 1.4 TX controller
+ The HDMI transmitter is a Synopsys DesignWare HDMI 1.4/2.0 TX controller
IP with Allwinner\'s own PHY IP. It supports audio and video outputs
and CEC.
@@ -27,6 +27,7 @@ properties:
oneOf:
- const: allwinner,sun8i-a83t-dw-hdmi
- const: allwinner,sun50i-h6-dw-hdmi
+ - const: allwinner,sun60i-a733-dw-hdmi
- items:
- enum:
@@ -46,35 +47,22 @@ properties:
clocks:
minItems: 3
- items:
- - description: Bus Clock
- - description: Register Clock
- - description: TMDS Clock
- - description: HDMI CEC Clock
- - description: HDCP Clock
- - description: HDCP Bus Clock
+ maxItems: 6
clock-names:
minItems: 3
- items:
- - const: iahb
- - const: isfr
- - const: tmds
- - const: cec
- - const: hdcp
- - const: hdcp-bus
+ maxItems: 6
resets:
minItems: 1
- items:
- - description: HDMI Controller Reset
- - description: HDCP Reset
+ maxItems: 3
reset-names:
minItems: 1
- items:
- - const: ctrl
- - const: hdcp
+ maxItems: 3
+
+ power-domains:
+ maxItems: 1
phys:
maxItems: 1
@@ -121,26 +109,98 @@ required:
- phy-names
- ports
-if:
- properties:
- compatible:
- contains:
- enum:
- - allwinner,sun50i-h6-dw-hdmi
-
-then:
- properties:
- clocks:
- minItems: 6
-
- clock-names:
- minItems: 6
-
- resets:
- minItems: 2
-
- reset-names:
- minItems: 2
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - allwinner,sun50i-h6-dw-hdmi
+
+ then:
+ properties:
+ clocks:
+ minItems: 6
+
+ clock-names:
+ minItems: 6
+
+ resets:
+ minItems: 2
+
+ reset-names:
+ minItems: 2
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun60i-a733-dw-hdmi
+
+ then:
+ properties:
+ clocks:
+ items:
+ - description: Bus Clock
+ - description: Register Clock
+ - description: TMDS Clock
+ - description: AHB Clock
+
+ clock-names:
+ items:
+ - const: iahb
+ - const: isfr
+ - const: tmds
+ - const: ahb
+
+ resets:
+ items:
+ - description: HDMI Controller Reset
+ - description: HDMI Sub-module Reset
+ - description: HDCP Reset
+
+ reset-names:
+ items:
+ - const: ctrl
+ - const: sub
+ - const: hdcp
+ required:
+ - power-domains
+
+ else:
+ properties:
+ power-domains: false
+ clocks:
+ minItems: 3
+ items:
+ - description: Bus Clock
+ - description: Register Clock
+ - description: TMDS Clock
+ - description: HDMI CEC Clock
+ - description: HDCP Clock
+ - description: HDCP Bus Clock
+
+ clock-names:
+ minItems: 3
+ items:
+ - const: iahb
+ - const: isfr
+ - const: tmds
+ - const: cec
+ - const: hdcp
+ - const: hdcp-bus
+
+ resets:
+ minItems: 1
+ items:
+ - description: HDMI Controller Reset
+ - description: HDCP Reset
+
+ reset-names:
+ minItems: 1
+ items:
+ - const: ctrl
+ - const: hdcp
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml
index 1b47f3d99a78..6d44365badf8 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml
@@ -21,25 +21,25 @@ properties:
- allwinner,sun8i-r40-hdmi-phy
- allwinner,sun50i-a64-hdmi-phy
- allwinner,sun50i-h6-hdmi-phy
+ - allwinner,sun60i-a733-hdmi-phy
reg:
maxItems: 1
+ allwinner,rescal:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: Phandle to the RESCAL syscon node for PHY calibration
+
+ power-domains:
+ maxItems: 1
+
clocks:
- minItems: 2
- items:
- - description: Bus Clock
- - description: Module Clock
- - description: Parent of the PHY clock
- - description: Second possible parent of the PHY clock
+ minItems: 1
+ maxItems: 4
clock-names:
- minItems: 2
- items:
- - const: bus
- - const: mod
- - const: pll-0
- - const: pll-1
+ minItems: 1
+ maxItems: 4
resets:
maxItems: 1
@@ -52,48 +52,88 @@ required:
- reg
- clocks
- clock-names
- - resets
- - reset-names
-
-if:
- properties:
- compatible:
- contains:
- enum:
- - allwinner,sun8i-r40-hdmi-phy
-
-then:
- properties:
- clocks:
- minItems: 4
-
- clock-names:
- minItems: 4
-
-else:
- if:
- properties:
- compatible:
- contains:
- enum:
- - allwinner,sun8i-h3-hdmi-phy
- - allwinner,sun50i-a64-hdmi-phy
-
- then:
- properties:
- clocks:
- minItems: 3
-
- clock-names:
- minItems: 3
-
- else:
- properties:
- clocks:
- maxItems: 2
-
- clock-names:
- maxItems: 2
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun60i-a733-hdmi-phy
+ then:
+ properties:
+ clocks:
+ items:
+ - description: Reference oscillator clock (24 MHz or 26 MHz)
+ clock-names:
+ const: ref
+ resets: false
+ reset-names: false
+ required:
+ - allwinner,rescal
+ - power-domains
+ else:
+ properties:
+ allwinner,rescal: false
+ power-domains: false
+ clocks:
+ minItems: 2
+ items:
+ - description: Bus Clock
+ - description: Module Clock
+ - description: Parent of the PHY clock
+ - description: Second possible parent of the PHY clock
+ clock-names:
+ minItems: 2
+ items:
+ - const: bus
+ - const: mod
+ - const: pll-0
+ - const: pll-1
+ required:
+ - resets
+ - reset-names
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun8i-r40-hdmi-phy
+ then:
+ properties:
+ clocks:
+ minItems: 4
+ clock-names:
+ minItems: 4
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - allwinner,sun8i-h3-hdmi-phy
+ - allwinner,sun50i-a64-hdmi-phy
+ then:
+ properties:
+ clocks:
+ minItems: 3
+ maxItems: 3
+ clock-names:
+ minItems: 3
+ maxItems: 3
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - allwinner,sun8i-a83t-hdmi-phy
+ - allwinner,sun50i-h6-hdmi-phy
+ then:
+ properties:
+ clocks:
+ maxItems: 2
+ clock-names:
+ maxItems: 2
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml b/Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml
index 7d849c4095a3..8ebb58d21d22 100644
--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml
+++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-r40-tcon-top.yaml
@@ -43,6 +43,7 @@ properties:
- allwinner,sun8i-r40-tcon-top
- allwinner,sun20i-d1-tcon-top
- allwinner,sun50i-h6-tcon-top
+ - allwinner,sun60i-a733-tcon-top
reg:
maxItems: 1
@@ -59,9 +60,13 @@ properties:
minItems: 1
maxItems: 3
- resets:
+ power-domains:
maxItems: 1
+ resets:
+ minItems: 1
+ maxItems: 2
+
ports:
$ref: /schemas/graph.yaml#/properties/ports
@@ -201,6 +206,43 @@ allOf:
items:
- description: TCON TV0 output clock name
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun60i-a733-tcon-top
+
+ then:
+ properties:
+ clocks:
+ items:
+ - description: The TCON TOP interface clock
+ - description: The TCON TOP TV0 clock
+ - description: The TCON TOP AHB clock
+
+ clock-names:
+ items:
+ - const: bus
+ - const: tcon-tv0
+ - const: ahb
+
+ clock-output-names:
+ items:
+ - description: TCON TV0 output clock name
+
+ resets:
+ items:
+ - description: The TCON TOP interface reset
+ - description: The video output subsystem reset
+ required:
+ - power-domains
+
+ else:
+ properties:
+ power-domains: false
+ resets:
+ maxItems: 1
+
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 04/13] soc: sunxi: sram: Add A733 system-control RESCAL support
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (2 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 03/13] dt-bindings: display: sun4i: Document A733 TCON TOP, TCON TV, and HDMI Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 05/13] drm/sun4i: Add A733 TCON TOP1 and TCON TV0 support Alastair D'Silva
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Register a syscon regmap for the Allwinner A733 system control block so
consumers such as the HDMI TOP PHY can access the RESCAL calibration
register.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/soc/sunxi/sunxi_sram.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 2ccaeacf8c70..9651ed5c5c6c 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -328,6 +328,7 @@ EXPORT_SYMBOL(sunxi_sram_release);
struct sunxi_sramc_variant {
int num_emac_clocks;
bool has_ldo_ctrl;
+ bool has_rescal_ctrl;
bool has_ths_offset;
};
@@ -357,9 +358,15 @@ static const struct sunxi_sramc_variant sun55i_a523_sramc_variant = {
.num_emac_clocks = 2,
};
+static const struct sunxi_sramc_variant sun60i_a733_sramc_variant = {
+ .num_emac_clocks = 2,
+ .has_rescal_ctrl = true,
+};
+
#define SUNXI_SRAM_THS_OFFSET_REG 0x0
#define SUNXI_SRAM_EMAC_CLOCK_REG 0x30
#define SUNXI_SYS_LDO_CTRL_REG 0x150
+#define SUNXI_SYS_RESCAL_CTRL_REG 0x160
static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
unsigned int reg)
@@ -373,6 +380,8 @@ static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
return true;
if (reg == SUNXI_SYS_LDO_CTRL_REG && variant->has_ldo_ctrl)
return true;
+ if (reg == SUNXI_SYS_RESCAL_CTRL_REG && variant->has_rescal_ctrl)
+ return true;
return false;
}
@@ -396,7 +405,7 @@ static const struct regmap_config sunxi_sram_regmap_config = {
.val_bits = 32,
.reg_stride = 4,
/* last defined register */
- .max_register = SUNXI_SYS_LDO_CTRL_REG,
+ .max_register = SUNXI_SYS_RESCAL_CTRL_REG,
/* other devices have no business accessing other registers */
.readable_reg = sunxi_sram_regmap_accessible_reg,
.writeable_reg = sunxi_sram_regmap_accessible_reg,
@@ -424,7 +433,8 @@ static int __init sunxi_sram_probe(struct platform_device *pdev)
if (IS_ERR(base))
return PTR_ERR(base);
- if (variant->num_emac_clocks || variant->has_ldo_ctrl) {
+ if (variant->num_emac_clocks || variant->has_ldo_ctrl ||
+ variant->has_rescal_ctrl) {
regmap = devm_regmap_init_mmio(dev, base, &sunxi_sram_regmap_config);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
@@ -486,6 +496,10 @@ static const struct of_device_id sunxi_sram_dt_match[] = {
.compatible = "allwinner,sun55i-a523-system-control",
.data = &sun55i_a523_sramc_variant,
},
+ {
+ .compatible = "allwinner,sun60i-a733-system-control",
+ .data = &sun60i_a733_sramc_variant,
+ },
{ },
};
MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match);
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 05/13] drm/sun4i: Add A733 TCON TOP1 and TCON TV0 support
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (3 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 04/13] soc: sunxi: sram: Add A733 system-control RESCAL support Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 06/13] drm/bridge: dw-hdmi: Export dw_hdmi_phy_enable_svsret() Alastair D'Silva
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Add Allwinner A733 TCON TOP1 and TCON TV0 support with runtime PM.
TCON TOP1 omits the DE-to-TCON mux and uses an optional AHB clock.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 74 +++++++++++++++++++++-----
drivers/gpu/drm/sun4i/sun4i_tcon.h | 8 +++
drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 61 +++++++++++++++++++--
drivers/gpu/drm/sun4i/sun8i_tcon_top.h | 3 ++
4 files changed, 127 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 20740fa10ce8..927601a7be07 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/reset.h>
@@ -604,6 +605,14 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1);
+ /* A733 TCON TV0 requires a reset before reprogramming timings */
+ if (tcon->quirks->basic1_vtotal) {
+ clk_disable_unprepare(tcon->clk);
+ reset_control_reset(tcon->lcd_rst);
+ if (clk_prepare_enable(tcon->clk))
+ dev_err(tcon->dev, "Failed to re-enable TCON bus clock\n");
+ }
+
/* Configure the dot clock */
clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
@@ -622,15 +631,22 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
SUN4I_TCON1_CTL_INTERLACE_ENABLE,
val);
+ vtotal = mode->vtotal;
+ if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
+ vtotal = vtotal * 2;
+
/* Set the input resolution */
regmap_write(tcon->regs, SUN4I_TCON1_BASIC0_REG,
SUN4I_TCON1_BASIC0_X(mode->crtc_hdisplay) |
SUN4I_TCON1_BASIC0_Y(mode->crtc_vdisplay));
- /* Set the upscaling resolution */
- regmap_write(tcon->regs, SUN4I_TCON1_BASIC1_REG,
- SUN4I_TCON1_BASIC1_X(mode->crtc_hdisplay) |
- SUN4I_TCON1_BASIC1_Y(mode->crtc_vdisplay));
+ /* Set the upscaling resolution (or extended vtotal on A733) */
+ if (tcon->quirks->basic1_vtotal)
+ regmap_write(tcon->regs, SUN4I_TCON1_BASIC1_REG, vtotal);
+ else
+ regmap_write(tcon->regs, SUN4I_TCON1_BASIC1_REG,
+ SUN4I_TCON1_BASIC1_X(mode->crtc_hdisplay) |
+ SUN4I_TCON1_BASIC1_Y(mode->crtc_vdisplay));
/* Set the output resolution */
regmap_write(tcon->regs, SUN4I_TCON1_BASIC2_REG,
@@ -662,10 +678,6 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
* To work around this, we will always use vtotal, and
* multiply by two only if we're not in interlace.
*/
- vtotal = mode->vtotal;
- if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
- vtotal = vtotal * 2;
-
/* Set vertical display timings */
regmap_write(tcon->regs, SUN4I_TCON1_BASIC4_REG,
SUN4I_TCON1_BASIC4_V_TOTAL(vtotal) |
@@ -703,6 +715,16 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
regmap_write(tcon->regs, SUN4I_TCON1_IO_POL_REG, val);
}
+ if (tcon->quirks->has_pixel_depth) {
+ regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, 0);
+ regmap_write(tcon->regs, SUN4I_TCON1_DATA_IO_POL0_REG, 0);
+ regmap_write(tcon->regs, SUN4I_TCON1_DATA_IO_POL1_REG, 0);
+ regmap_write(tcon->regs, SUN4I_TCON1_DATA_IO_TRI0_REG, 0);
+ regmap_write(tcon->regs, SUN4I_TCON1_DATA_IO_TRI1_REG, 0);
+ regmap_write(tcon->regs, SUN4I_TCON1_PIXEL_DEPTH_REG,
+ SUN4I_TCON1_PIXEL_DEPTH_8BIT);
+ }
+
/* Map output pins to channel 1 */
regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
SUN4I_TCON_GCTL_IOMAP_MASK,
@@ -1136,23 +1158,30 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
tcon->id = engine->id;
tcon->quirks = of_device_get_match_data(dev);
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
+ goto err_pm_disable;
+
tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
if (IS_ERR(tcon->lcd_rst)) {
dev_err(dev, "Couldn't get our reset line\n");
- return PTR_ERR(tcon->lcd_rst);
+ ret = PTR_ERR(tcon->lcd_rst);
+ goto err_pm_put;
}
if (tcon->quirks->needs_edp_reset) {
edp_rstc = devm_reset_control_get_shared(dev, "edp");
if (IS_ERR(edp_rstc)) {
dev_err(dev, "Couldn't get edp reset line\n");
- return PTR_ERR(edp_rstc);
+ ret = PTR_ERR(edp_rstc);
+ goto err_pm_put;
}
ret = reset_control_deassert(edp_rstc);
if (ret) {
dev_err(dev, "Couldn't deassert edp reset line\n");
- return ret;
+ goto err_pm_put;
}
}
@@ -1160,7 +1189,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
ret = reset_control_reset(tcon->lcd_rst);
if (ret) {
dev_err(dev, "Couldn't deassert our reset line\n");
- return ret;
+ goto err_pm_put;
}
if (tcon->quirks->supports_lvds) {
@@ -1174,7 +1203,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
tcon->lvds_rst = devm_reset_control_get_optional(dev, "lvds");
if (IS_ERR(tcon->lvds_rst)) {
dev_err(dev, "Couldn't get our reset line\n");
- return PTR_ERR(tcon->lvds_rst);
+ ret = PTR_ERR(tcon->lvds_rst);
+ goto err_pm_put;
} else if (tcon->lvds_rst) {
has_lvds_rst = true;
reset_control_reset(tcon->lvds_rst);
@@ -1196,7 +1226,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
has_lvds_alt = false;
} else {
dev_err(dev, "Couldn't get the LVDS PLL\n");
- return PTR_ERR(tcon->lvds_pll);
+ ret = PTR_ERR(tcon->lvds_pll);
+ goto err_pm_put;
}
} else {
has_lvds_alt = true;
@@ -1296,6 +1327,10 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
sun4i_dclk_free(tcon);
err_assert_reset:
reset_control_assert(tcon->lcd_rst);
+err_pm_put:
+ pm_runtime_put_sync(dev);
+err_pm_disable:
+ pm_runtime_disable(dev);
return ret;
}
@@ -1307,6 +1342,8 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
list_del(&tcon->list);
if (tcon->quirks->has_channel_0)
sun4i_dclk_free(tcon);
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
}
static const struct component_ops sun4i_tcon_ops = {
@@ -1546,6 +1583,14 @@ static const struct sun4i_tcon_quirks sun20i_d1_lcd_quirks = {
.set_mux = sun8i_r40_tcon_tv_set_mux,
};
+static const struct sun4i_tcon_quirks sun60i_a733_tv_quirks = {
+ .has_channel_1 = true,
+ .polarity_in_ch0 = true,
+ .basic1_vtotal = true,
+ .has_pixel_depth = true,
+ .set_mux = sun8i_r40_tcon_tv_set_mux,
+};
+
/* sun4i_drv uses this list to check if a device node is a TCON */
const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun4i-a10-tcon", .data = &sun4i_a10_quirks },
@@ -1565,6 +1610,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun9i-a80-tcon-tv", .data = &sun9i_a80_tcon_tv_quirks },
{ .compatible = "allwinner,sun20i-d1-tcon-lcd", .data = &sun20i_d1_lcd_quirks },
{ .compatible = "allwinner,sun20i-d1-tcon-tv", .data = &sun8i_r40_tv_quirks },
+ { .compatible = "allwinner,sun60i-a733-tcon-tv", .data = &sun60i_a733_tv_quirks },
{ }
};
MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index fa23aa23fe4a..35932cbf5a51 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -229,6 +229,12 @@
#define SUN4I_TCON1_FILL_BEG2_REG 0x31c
#define SUN4I_TCON1_FILL_END2_REG 0x320
#define SUN4I_TCON1_FILL_DATA2_REG 0x324
+#define SUN4I_TCON1_DATA_IO_POL0_REG 0x330
+#define SUN4I_TCON1_DATA_IO_POL1_REG 0x334
+#define SUN4I_TCON1_DATA_IO_TRI0_REG 0x338
+#define SUN4I_TCON1_DATA_IO_TRI1_REG 0x33c
+#define SUN4I_TCON1_PIXEL_DEPTH_REG 0x340
+#define SUN4I_TCON1_PIXEL_DEPTH_8BIT 0
#define SUN4I_TCON1_GAMMA_TABLE_REG 0x400
#define SUN4I_TCON_MAX_CHANNELS 2
@@ -243,6 +249,8 @@ struct sun4i_tcon_quirks {
bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */
bool supports_lvds; /* Does the TCON support an LVDS output? */
bool polarity_in_ch0; /* some tcon1 channels have polarity bits in tcon0 pol register */
+ bool basic1_vtotal; /* sun60i tcon-tv stores extended vtotal in BASIC1 */
+ bool has_pixel_depth; /* sun60i tcon-tv has data io pol/tri and pixel depth regs */
u8 dclk_min_div; /* minimum divider for TCON0 DCLK */
/* callback to handle tcon muxing options */
diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index 86e1e8fed03a..9a40a5b7df6d 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -10,6 +10,7 @@
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <dt-bindings/clock/sun8i-tcon-top.h>
@@ -18,6 +19,11 @@
struct sun8i_tcon_top_quirks {
bool has_tcon_tv1;
bool has_dsi;
+ /*
+ * DE-to-TCON routing is handled in DE3.5 TOP; pre-route TCON_TV0
+ * to HDMI and clear TVE mode in TCON_TOP_TCON_TV_SETUP_REG.
+ */
+ bool no_de_mux;
};
static bool sun8i_tcon_top_node_is_tcon_top(struct device_node *node)
@@ -109,6 +115,9 @@ int sun8i_tcon_top_de_config(struct device *dev, int mixer, int tcon)
return -EINVAL;
}
+ if (tcon_top->no_de_mux)
+ return 0;
+
if (mixer > 1) {
dev_err(dev, "Mixer index is too high!\n");
return -EINVAL;
@@ -193,10 +202,11 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
clk_data->num = CLK_NUM;
tcon_top->clk_data = clk_data;
tcon_top->tcon_map = sun8i_tcon_top_get_tcon_map(dev->of_node);
+ tcon_top->no_de_mux = quirks->no_de_mux;
spin_lock_init(&tcon_top->reg_lock);
- tcon_top->rst = devm_reset_control_get(dev, NULL);
+ tcon_top->rst = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(tcon_top->rst)) {
dev_err(dev, "Couldn't get our reset line\n");
return PTR_ERR(tcon_top->rst);
@@ -208,25 +218,49 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
return PTR_ERR(tcon_top->bus);
}
+ tcon_top->ahb = devm_clk_get_optional(dev, "ahb");
+ if (IS_ERR(tcon_top->ahb))
+ return PTR_ERR(tcon_top->ahb);
+
regs = devm_platform_ioremap_resource(pdev, 0);
tcon_top->regs = regs;
if (IS_ERR(regs))
return PTR_ERR(regs);
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
+ goto err_pm_disable;
+
ret = reset_control_deassert(tcon_top->rst);
if (ret) {
dev_err(dev, "Could not deassert ctrl reset control\n");
- return ret;
+ goto err_pm_put;
+ }
+
+ ret = clk_prepare_enable(tcon_top->ahb);
+ if (ret) {
+ dev_err(dev, "Could not enable ahb clock\n");
+ goto err_assert_reset;
}
ret = clk_prepare_enable(tcon_top->bus);
if (ret) {
dev_err(dev, "Could not enable bus clock\n");
- goto err_assert_reset;
+ goto err_disable_ahb;
}
- writel(0, regs + TCON_TOP_PORT_SEL_REG);
- writel(0, regs + TCON_TOP_GATE_SRC_REG);
+ if (quirks->no_de_mux) {
+ writel(readl(regs + TCON_TOP_TCON_TV_SETUP_REG) &
+ ~TCON_TOP_TV_SETUP_TVE_MODE,
+ regs + TCON_TOP_TCON_TV_SETUP_REG);
+ /* Route TCON_TV0 as HDMI source so DW-HDMI bus access works */
+ writel(FIELD_PREP(TCON_TOP_HDMI_SRC_MSK, 1),
+ regs + TCON_TOP_GATE_SRC_REG);
+ } else {
+ writel(0, regs + TCON_TOP_PORT_SEL_REG);
+ writel(0, regs + TCON_TOP_GATE_SRC_REG);
+ }
/*
* TCON TOP has two muxes, which select parent clock for each TCON TV
@@ -274,8 +308,14 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
if (!IS_ERR_OR_NULL(clk_data->hws[i]))
clk_hw_unregister_gate(clk_data->hws[i]);
clk_disable_unprepare(tcon_top->bus);
+err_disable_ahb:
+ clk_disable_unprepare(tcon_top->ahb);
err_assert_reset:
reset_control_assert(tcon_top->rst);
+err_pm_put:
+ pm_runtime_put_sync(dev);
+err_pm_disable:
+ pm_runtime_disable(dev);
return ret;
}
@@ -293,7 +333,10 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
clk_hw_unregister_gate(clk_data->hws[i]);
clk_disable_unprepare(tcon_top->bus);
+ clk_disable_unprepare(tcon_top->ahb);
reset_control_assert(tcon_top->rst);
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
}
static const struct component_ops sun8i_tcon_top_ops = {
@@ -324,6 +367,10 @@ static const struct sun8i_tcon_top_quirks sun50i_h6_tcon_top_quirks = {
/* Nothing special */
};
+static const struct sun8i_tcon_top_quirks sun60i_a733_tcon_top_quirks = {
+ .no_de_mux = true,
+};
+
/* sun4i_drv uses this list to check if a device node is a TCON TOP */
const struct of_device_id sun8i_tcon_top_of_table[] = {
{
@@ -338,6 +385,10 @@ const struct of_device_id sun8i_tcon_top_of_table[] = {
.compatible = "allwinner,sun50i-h6-tcon-top",
.data = &sun50i_h6_tcon_top_quirks
},
+ {
+ .compatible = "allwinner,sun60i-a733-tcon-top",
+ .data = &sun60i_a733_tcon_top_quirks
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.h b/drivers/gpu/drm/sun4i/sun8i_tcon_top.h
index 2b887470a49f..2010672943a3 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.h
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.h
@@ -10,6 +10,7 @@
#include <linux/spinlock.h>
#define TCON_TOP_TCON_TV_SETUP_REG 0x00
+#define TCON_TOP_TV_SETUP_TVE_MODE BIT(3)
#define TCON_TOP_PORT_SEL_REG 0x1C
#define TCON_TOP_PORT_DE0_MSK GENMASK(1, 0)
@@ -29,11 +30,13 @@
struct sun8i_tcon_top {
struct clk *bus;
+ struct clk *ahb;
struct clk_hw_onecell_data *clk_data;
void __iomem *regs;
struct reset_control *rst;
unsigned int tcon_map;
+ bool no_de_mux;
/*
* spinlock is used to synchronize access to same
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 06/13] drm/bridge: dw-hdmi: Export dw_hdmi_phy_enable_svsret()
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (4 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 05/13] drm/sun4i: Add A733 TCON TOP1 and TCON TV0 support Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 07/13] drm/sun4i: Add A733 DW-HDMI 2.0 and TOP PHY support Alastair D'Silva
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Export dw_hdmi_phy_enable_svsret() so platform glue drivers with custom
Synopsys Gen2 PHY setup sequences can release the PHY from low-power
retention mode before reset and I2C configuration.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++-
include/drm/bridge/dw_hdmi.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index d63cd7a9f243..5a5c72f6e68e 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1446,12 +1446,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable)
HDMI_PHY_CONF0_ENTMDS_MASK);
}
-static void dw_hdmi_phy_enable_svsret(struct dw_hdmi *hdmi, u8 enable)
+void dw_hdmi_phy_enable_svsret(struct dw_hdmi *hdmi, u8 enable)
{
hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
HDMI_PHY_CONF0_SVSRET_OFFSET,
HDMI_PHY_CONF0_SVSRET_MASK);
}
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_enable_svsret);
void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable)
{
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 8500dd4f99d8..484a909b9fbd 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -213,6 +213,8 @@ void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable);
void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable);
void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi);
+void dw_hdmi_phy_enable_svsret(struct dw_hdmi *hdmi, u8 enable);
+
enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
void *data);
void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 07/13] drm/sun4i: Add A733 DW-HDMI 2.0 and TOP PHY support
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (5 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 06/13] drm/bridge: dw-hdmi: Export dw_hdmi_phy_enable_svsret() Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 08/13] drm/sun4i: Add A733 DE3.5 RCQ helper Alastair D'Silva
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Add Allwinner A733 DW-HDMI 2.0 controller and TOP PHY support.
Configure RESCAL calibration, the TOP PHY PLL, and the C422-0 PHY.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 114 +++++++--
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 7 +
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 333 +++++++++++++++++++++++++
3 files changed, 437 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
index e554cd577af9..424659791198 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_encoder.h>
@@ -133,56 +134,108 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
if (encoder->possible_crtcs == 0)
return -EPROBE_DEFER;
- hdmi->rst_ctrl = devm_reset_control_get(dev, "ctrl");
+ hdmi->rst_ctrl = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(hdmi->rst_ctrl))
return dev_err_probe(dev, PTR_ERR(hdmi->rst_ctrl),
- "Could not get ctrl reset control\n");
+ "Could not get reset controls\n");
hdmi->clk_tmds = devm_clk_get(dev, "tmds");
if (IS_ERR(hdmi->clk_tmds))
return dev_err_probe(dev, PTR_ERR(hdmi->clk_tmds),
"Couldn't get the tmds clock\n");
- hdmi->regulator = devm_regulator_get(dev, "hvcc");
- if (IS_ERR(hdmi->regulator))
- return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
- "Couldn't get regulator\n");
+ hdmi->clk_ahb = devm_clk_get_optional(dev, "ahb");
+ if (IS_ERR(hdmi->clk_ahb))
+ return dev_err_probe(dev, PTR_ERR(hdmi->clk_ahb),
+ "Couldn't get the ahb clock\n");
- ret = regulator_enable(hdmi->regulator);
- if (ret) {
- dev_err(dev, "Failed to enable regulator\n");
- return ret;
+ /*
+ * Enable iahb/isfr before sun8i_hdmi_phy_init(), as A733 TOP PHY
+ * registers are accessed before dw_hdmi_bind() enables them.
+ */
+ hdmi->clk_iahb = devm_clk_get(dev, "iahb");
+ if (IS_ERR(hdmi->clk_iahb))
+ return dev_err_probe(dev, PTR_ERR(hdmi->clk_iahb),
+ "Couldn't get the iahb clock\n");
+
+ hdmi->clk_isfr = devm_clk_get(dev, "isfr");
+ if (IS_ERR(hdmi->clk_isfr))
+ return dev_err_probe(dev, PTR_ERR(hdmi->clk_isfr),
+ "Couldn't get the isfr clock\n");
+
+ if (hdmi->quirks->optional_hvcc)
+ hdmi->regulator = devm_regulator_get_optional(dev, "hvcc");
+ else
+ hdmi->regulator = devm_regulator_get(dev, "hvcc");
+ if (IS_ERR(hdmi->regulator)) {
+ if (hdmi->quirks->optional_hvcc &&
+ PTR_ERR(hdmi->regulator) == -ENODEV)
+ hdmi->regulator = NULL;
+ else
+ return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
+ "Couldn't get regulator\n");
+ }
+
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
+ goto err_pm_disable;
+
+ if (hdmi->regulator) {
+ ret = regulator_enable(hdmi->regulator);
+ if (ret) {
+ dev_err(dev, "Failed to enable regulator\n");
+ goto err_pm_put;
+ }
}
ret = reset_control_deassert(hdmi->rst_ctrl);
if (ret) {
- dev_err(dev, "Could not deassert ctrl reset control\n");
+ dev_err(dev, "Could not deassert reset controls\n");
goto err_disable_regulator;
}
+ ret = clk_prepare_enable(hdmi->clk_ahb);
+ if (ret) {
+ dev_err(dev, "Could not enable ahb clock\n");
+ goto err_assert_ctrl_reset;
+ }
+
ret = clk_prepare_enable(hdmi->clk_tmds);
if (ret) {
dev_err(dev, "Could not enable tmds clock\n");
- goto err_assert_ctrl_reset;
+ goto err_disable_clk_ahb;
+ }
+
+ ret = clk_prepare_enable(hdmi->clk_iahb);
+ if (ret) {
+ dev_err(dev, "Could not enable iahb clock\n");
+ goto err_disable_clk_tmds;
+ }
+
+ ret = clk_prepare_enable(hdmi->clk_isfr);
+ if (ret) {
+ dev_err(dev, "Could not enable isfr clock\n");
+ goto err_disable_clk_iahb;
}
phy_node = of_parse_phandle(dev->of_node, "phys", 0);
if (!phy_node) {
dev_err(dev, "Can't found PHY phandle\n");
ret = -EINVAL;
- goto err_disable_clk_tmds;
+ goto err_disable_clk_isfr;
}
ret = sun8i_hdmi_phy_get(hdmi, phy_node);
of_node_put(phy_node);
if (ret) {
dev_err(dev, "Couldn't get the HDMI PHY\n");
- goto err_disable_clk_tmds;
+ goto err_disable_clk_isfr;
}
ret = sun8i_hdmi_phy_init(hdmi->phy);
if (ret)
- goto err_disable_clk_tmds;
+ goto err_disable_clk_isfr;
drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs);
drm_encoder_init(drm, encoder, &sun8i_dw_hdmi_encoder_funcs,
@@ -210,12 +263,23 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
cleanup_encoder:
drm_encoder_cleanup(encoder);
sun8i_hdmi_phy_deinit(hdmi->phy);
+err_disable_clk_isfr:
+ clk_disable_unprepare(hdmi->clk_isfr);
+err_disable_clk_iahb:
+ clk_disable_unprepare(hdmi->clk_iahb);
err_disable_clk_tmds:
clk_disable_unprepare(hdmi->clk_tmds);
+err_disable_clk_ahb:
+ clk_disable_unprepare(hdmi->clk_ahb);
err_assert_ctrl_reset:
reset_control_assert(hdmi->rst_ctrl);
err_disable_regulator:
- regulator_disable(hdmi->regulator);
+ if (hdmi->regulator)
+ regulator_disable(hdmi->regulator);
+err_pm_put:
+ pm_runtime_put_sync(dev);
+err_pm_disable:
+ pm_runtime_disable(dev);
return ret;
}
@@ -227,9 +291,15 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master,
dw_hdmi_unbind(hdmi->hdmi);
sun8i_hdmi_phy_deinit(hdmi->phy);
+ clk_disable_unprepare(hdmi->clk_isfr);
+ clk_disable_unprepare(hdmi->clk_iahb);
clk_disable_unprepare(hdmi->clk_tmds);
+ clk_disable_unprepare(hdmi->clk_ahb);
reset_control_assert(hdmi->rst_ctrl);
- regulator_disable(hdmi->regulator);
+ if (hdmi->regulator)
+ regulator_disable(hdmi->regulator);
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
}
static const struct component_ops sun8i_dw_hdmi_ops = {
@@ -256,6 +326,12 @@ static const struct sun8i_dw_hdmi_quirks sun50i_h6_quirks = {
.use_drm_infoframe = true,
};
+static const struct sun8i_dw_hdmi_quirks sun60i_a733_quirks = {
+ .mode_valid = sun8i_dw_hdmi_mode_valid_h6,
+ .use_drm_infoframe = true,
+ .optional_hvcc = true,
+};
+
static const struct of_device_id sun8i_dw_hdmi_dt_ids[] = {
{
.compatible = "allwinner,sun8i-a83t-dw-hdmi",
@@ -265,6 +341,10 @@ static const struct of_device_id sun8i_dw_hdmi_dt_ids[] = {
.compatible = "allwinner,sun50i-h6-dw-hdmi",
.data = &sun50i_h6_quirks,
},
+ {
+ .compatible = "allwinner,sun60i-a733-dw-hdmi",
+ .data = &sun60i_a733_quirks,
+ },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, sun8i_dw_hdmi_dt_ids);
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
index ab80d52a70bb..e15e8a59a63e 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
@@ -150,6 +150,7 @@ struct sun8i_hdmi_phy;
struct sun8i_hdmi_phy_variant {
bool has_phy_clk;
bool has_second_pll;
+ bool is_top_phy;
const struct dw_hdmi_curr_ctrl *cur_ctr;
const struct dw_hdmi_mpll_config *mpll_cfg;
const struct dw_hdmi_phy_config *phy_cfg;
@@ -163,9 +164,11 @@ struct sun8i_hdmi_phy {
struct clk *clk_phy;
struct clk *clk_pll0;
struct clk *clk_pll1;
+ struct clk *clk_ref;
struct device *dev;
unsigned int rcal;
struct regmap *regs;
+ struct regmap *rescal;
struct reset_control *rst_phy;
const struct sun8i_hdmi_phy_variant *variant;
};
@@ -175,10 +178,14 @@ struct sun8i_dw_hdmi_quirks {
const struct drm_display_info *info,
const struct drm_display_mode *mode);
unsigned int use_drm_infoframe : 1;
+ unsigned int optional_hvcc : 1;
};
struct sun8i_dw_hdmi {
struct clk *clk_tmds;
+ struct clk *clk_ahb;
+ struct clk *clk_iahb;
+ struct clk *clk_isfr;
struct device *dev;
struct dw_hdmi *hdmi;
struct drm_encoder encoder;
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 0d284804e11f..0cae47704fdc 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -4,12 +4,49 @@
*/
#include <linux/delay.h>
+#include <linux/math.h>
+#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include "sun8i_dw_hdmi.h"
+#define SUN60I_RESCAL_CTRL_OFF 0x0160
+#define SUN60I_RESCAL_EN BIT(0)
+#define SUN60I_RESCAL_ANA_EN BIT(1)
+#define SUN60I_RESCAL_HDMI_SEL BIT(12)
+
+#define SUN60I_TOP_PHY_CTRL 0x0000
+#define SUN60I_TOP_PHY_CTRL_RESET BIT(0)
+#define SUN60I_TOP_PHY_CTRL_PDDQ BIT(1)
+#define SUN60I_TOP_PHY_CTRL_TXPWRON BIT(2)
+#define SUN60I_TOP_PHY_CTRL_ENHPDRXSENSE BIT(4)
+#define SUN60I_TOP_PHY_PLL_CTRL 0x0020
+#define SUN60I_TOP_PHY_PLL_MASK 0x007fffe2
+#define SUN60I_TOP_PHY_PLL_OUTPUT_GATE BIT(27)
+#define SUN60I_TOP_PHY_PLL_LOCK_EN BIT(29)
+#define SUN60I_TOP_PHY_PLL_LDO_EN BIT(30)
+#define SUN60I_TOP_PHY_PLL_EN BIT(31)
+#define SUN60I_TOP_PHY_PLL_STATUS 0x0024
+#define SUN60I_TOP_PHY_PLL_LVL_SHIFT_GATE BIT(7)
+#define SUN60I_TOP_PHY_PLL_CLK_SEL_CCU BIT(8)
+#define SUN60I_TOP_PHY_PLL_LDO 0x0028
+#define SUN60I_TOP_PHY_PLL_LDO_VAL 0x00035000
+#define SUN60I_TOP_PHY_PLL_PAT0 0x002c
+#define SUN60I_TOP_PHY_PLL_PAT1 0x0030
+#define SUN60I_TOP_PHY_PLL_PAT1_VAL 0x30000000
+#define SUN60I_TOP_PHY_PLL_LOCK_STATUS 0x0040
+#define SUN60I_TOP_PHY_PLL_LOCK BIT(0)
+
+#define SUN60I_C422_PHY_OPMODE_PLLCFG 0x06
+#define SUN60I_C422_PHY_CKSYMTXCTRL 0x09
+#define SUN60I_C422_PHY_VLEVCTRL 0x0e
+#define SUN60I_C422_PHY_PLLCURRCTRL 0x10
+#define SUN60I_C422_PHY_PLLDIVCTRL 0x11
+#define SUN60I_C422_PHY_TXTERM 0x19
+#define SUN60I_C422_PHY_I2C_SLAVE_ADDR 0x69
+
/*
* Address can be actually any value. Here is set to same value as
* it is set in BSP driver.
@@ -519,6 +556,11 @@ int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy)
{
int ret;
+ if (phy->variant->is_top_phy) {
+ phy->variant->phy_init(phy);
+ return 0;
+ }
+
ret = reset_control_deassert(phy->rst_phy);
if (ret) {
dev_err(phy->dev, "Cannot deassert phy reset control: %d\n", ret);
@@ -564,6 +606,9 @@ int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy)
void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy)
{
+ if (phy->variant->is_top_phy)
+ return;
+
clk_disable_unprepare(phy->clk_mod);
clk_disable_unprepare(phy->clk_bus);
clk_disable_unprepare(phy->clk_phy);
@@ -619,6 +664,272 @@ static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = {
.phy_init = &sun8i_hdmi_phy_init_h3,
};
+static const struct regmap_config sun60i_hdmi_phy_regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .max_register = SUN60I_TOP_PHY_PLL_LOCK_STATUS,
+ .name = "phy"
+};
+
+struct sun60i_top_phy_pll_cfg {
+ u32 ref_khz;
+ u32 pll_val;
+ u32 pat0;
+};
+
+static const struct sun60i_top_phy_pll_cfg sun60i_top_pll_24m[] = {
+ { 13500, 0x005f3500, 0x00000000 },
+ { 27000, 0x00576200, 0x80000000 },
+ { 54000, 0x002b6200, 0x80000000 },
+ { 65000, 0x00246200, 0x80000000 },
+ { 74250, 0x001f6200, 0x80000000 },
+ { 148500, 0x000f6200, 0x80000000 },
+ { 185625, 0x000f6200, 0x80000000 },
+ { 297000, 0x00076200, 0x00000000 },
+ { 371250, 0x00076200, 0x00000000 },
+ { 594000, 0x00036200, 0x00000000 },
+};
+
+static const struct sun60i_top_phy_pll_cfg sun60i_top_pll_26m[] = {
+ { 13500, 0x00673500, 0x00000000 },
+ { 27000, 0x00595c00, 0x80000000 },
+ { 54000, 0x000c1a00, 0x80000000 },
+ { 65000, 0x00235a00, 0x80000000 },
+ { 74250, 0x001f5a00, 0x80000000 },
+ { 108000, 0x000c3500, 0x00000000 },
+ { 148500, 0x000f5a00, 0x80000000 },
+ { 185625, 0x000f5a00, 0x80000000 },
+ { 297000, 0x0007b602, 0x00000000 },
+ { 371250, 0x0007b602, 0x00000000 },
+ { 594000, 0x0003b602, 0x00000000 },
+};
+
+struct sun60i_c422_mpll_cfg {
+ u32 khz;
+ u16 opmode;
+ u16 curr;
+ u16 div;
+};
+
+static const struct sun60i_c422_mpll_cfg sun60i_mpll_8bit[] = {
+ { 25175, 0x0003, 0x0283, 0x0628 },
+ { 27000, 0x0003, 0x0283, 0x0628 },
+ { 33750, 0x0003, 0x0283, 0x0628 },
+ { 35500, 0x0003, 0x0283, 0x0628 },
+ { 36000, 0x0003, 0x0285, 0x0228 },
+ { 40000, 0x0003, 0x0285, 0x0228 },
+ { 44900, 0x0003, 0x0285, 0x0228 },
+ { 49500, 0x0002, 0x1183, 0x0614 },
+ { 50000, 0x0002, 0x1183, 0x0614 },
+ { 50350, 0x0002, 0x1183, 0x0614 },
+ { 54000, 0x0002, 0x1183, 0x0694 },
+ { 56250, 0x0002, 0x1183, 0x0614 },
+ { 59400, 0x0002, 0x1183, 0x0614 },
+ { 65000, 0x0002, 0x1183, 0x0614 },
+ { 68250, 0x0002, 0x1183, 0x0614 },
+ { 71000, 0x0002, 0x1183, 0x0614 },
+ { 72000, 0x0002, 0x1142, 0x0214 },
+ { 73250, 0x0002, 0x1142, 0x0214 },
+ { 74250, 0x0002, 0x1142, 0x0214 },
+ { 82500, 0x0002, 0x1142, 0x0214 },
+ { 90000, 0x0002, 0x1142, 0x0214 },
+ { 99000, 0x0001, 0x20c0, 0x060a },
+ { 100700, 0x0001, 0x20c0, 0x060a },
+ { 108000, 0x0001, 0x20c0, 0x060a },
+ { 118000, 0x0001, 0x20c0, 0x060a },
+ { 144000, 0x0001, 0x2080, 0x020a },
+ { 148500, 0x0001, 0x2080, 0x020a },
+ { 165000, 0x0001, 0x2080, 0x020a },
+ { 180000, 0x0001, 0x2080, 0x020a },
+ { 185625, 0x0000, 0x3040, 0x0605 },
+ { 198000, 0x0000, 0x3040, 0x0605 },
+ { 216000, 0x0000, 0x3040, 0x0605 },
+ { 237600, 0x0000, 0x3040, 0x0605 },
+ { 288000, 0x0000, 0x3041, 0x0205 },
+ { 297000, 0x0000, 0x3041, 0x0205 },
+ { 330000, 0x0000, 0x3041, 0x0205 },
+ { 360000, 0x0640, 0x3041, 0x0205 },
+ { 371250, 0x0640, 0x3041, 0x0205 },
+ { 396000, 0x0640, 0x3041, 0x0205 },
+ { 432000, 0x0640, 0x3041, 0x0205 },
+ { 495000, 0x0640, 0x3080, 0x0005 },
+ { 505250, 0x0640, 0x3080, 0x0005 },
+ { 552750, 0x0640, 0x3080, 0x0005 },
+ { 594000, 0x0640, 0x3080, 0x0005 },
+};
+
+struct sun60i_c422_drive_cfg {
+ u32 min_khz;
+ u32 max_khz;
+ u16 txterm;
+ u16 vlev;
+ u16 cksym;
+};
+
+static const struct sun60i_c422_drive_cfg sun60i_drive[] = {
+ { 25000, 165000, 0x0007, 0x8160, 0x8188 },
+ { 165000, 340000, 0x0004, 0x8040, 0x8e85 },
+ { 340000, 600000, 0x0000, 0x80c0, 0x82f6 },
+};
+
+static void sun60i_hdmi_phy_init_a733(struct sun8i_hdmi_phy *phy)
+{
+ regmap_clear_bits(phy->rescal, SUN60I_RESCAL_CTRL_OFF,
+ SUN60I_RESCAL_EN | SUN60I_RESCAL_HDMI_SEL);
+ regmap_set_bits(phy->rescal, SUN60I_RESCAL_CTRL_OFF,
+ SUN60I_RESCAL_ANA_EN | SUN60I_RESCAL_EN);
+ usleep_range(200, 250);
+ regmap_clear_bits(phy->rescal, SUN60I_RESCAL_CTRL_OFF,
+ SUN60I_RESCAL_ANA_EN | SUN60I_RESCAL_EN);
+
+ regmap_set_bits(phy->regs, SUN60I_TOP_PHY_CTRL,
+ SUN60I_TOP_PHY_CTRL_RESET |
+ SUN60I_TOP_PHY_CTRL_PDDQ |
+ SUN60I_TOP_PHY_CTRL_TXPWRON |
+ SUN60I_TOP_PHY_CTRL_ENHPDRXSENSE);
+ regmap_clear_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_OUTPUT_GATE);
+ regmap_clear_bits(phy->regs, SUN60I_TOP_PHY_PLL_STATUS,
+ SUN60I_TOP_PHY_PLL_CLK_SEL_CCU);
+}
+
+static int sun60i_top_phy_pll_set(struct sun8i_hdmi_phy *phy, u32 clk_khz)
+{
+ const struct sun60i_top_phy_pll_cfg *table = sun60i_top_pll_24m;
+ unsigned int table_size = ARRAY_SIZE(sun60i_top_pll_24m);
+ const struct sun60i_top_phy_pll_cfg *cfg;
+ u32 val, best_diff = ~0U;
+ int i, ret;
+
+ if (phy->clk_ref && clk_get_rate(phy->clk_ref) == 26000000) {
+ table = sun60i_top_pll_26m;
+ table_size = ARRAY_SIZE(sun60i_top_pll_26m);
+ }
+
+ cfg = &table[0];
+ for (i = 0; i < table_size; i++) {
+ u32 diff = abs_diff(clk_khz, table[i].ref_khz);
+
+ if (diff < best_diff) {
+ best_diff = diff;
+ cfg = &table[i];
+ }
+ }
+
+ regmap_clear_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_OUTPUT_GATE);
+ regmap_update_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_MASK, cfg->pll_val);
+ regmap_write(phy->regs, SUN60I_TOP_PHY_PLL_LDO,
+ SUN60I_TOP_PHY_PLL_LDO_VAL);
+ regmap_write(phy->regs, SUN60I_TOP_PHY_PLL_PAT0, cfg->pat0);
+ regmap_write(phy->regs, SUN60I_TOP_PHY_PLL_PAT1,
+ SUN60I_TOP_PHY_PLL_PAT1_VAL);
+ regmap_set_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_EN | SUN60I_TOP_PHY_PLL_LDO_EN |
+ SUN60I_TOP_PHY_PLL_LOCK_EN);
+ regmap_set_bits(phy->regs, SUN60I_TOP_PHY_PLL_STATUS,
+ SUN60I_TOP_PHY_PLL_LVL_SHIFT_GATE);
+
+ ret = regmap_read_poll_timeout(phy->regs,
+ SUN60I_TOP_PHY_PLL_LOCK_STATUS, val,
+ val & SUN60I_TOP_PHY_PLL_LOCK,
+ 10, 20000);
+ if (ret) {
+ dev_err(phy->dev, "TOP PHY PLL lock timeout\n");
+ return ret;
+ }
+
+ usleep_range(20, 40);
+ regmap_set_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_OUTPUT_GATE);
+
+ return 0;
+}
+
+static int sun60i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data,
+ const struct drm_display_info *display,
+ const struct drm_display_mode *mode)
+{
+ struct sun8i_hdmi_phy *phy = data;
+ u32 clk_khz = mode->crtc_clock;
+ const struct sun60i_c422_mpll_cfg *mpll = &sun60i_mpll_8bit[0];
+ const struct sun60i_c422_drive_cfg *drv =
+ &sun60i_drive[ARRAY_SIZE(sun60i_drive) - 1];
+ u32 best_diff = ~0U;
+ int i, ret;
+
+ ret = sun60i_top_phy_pll_set(phy, clk_khz);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < ARRAY_SIZE(sun60i_mpll_8bit); i++) {
+ u32 diff = abs_diff(clk_khz, sun60i_mpll_8bit[i].khz);
+
+ if (diff < best_diff) {
+ best_diff = diff;
+ mpll = &sun60i_mpll_8bit[i];
+ }
+ }
+
+ for (i = 0; i < ARRAY_SIZE(sun60i_drive); i++) {
+ if (clk_khz >= sun60i_drive[i].min_khz &&
+ clk_khz < sun60i_drive[i].max_khz) {
+ drv = &sun60i_drive[i];
+ break;
+ }
+ }
+
+ dw_hdmi_phy_gen2_txpwron(hdmi, 0);
+ dw_hdmi_phy_gen2_pddq(hdmi, 1);
+ dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
+ dw_hdmi_phy_enable_svsret(hdmi, 0);
+ usleep_range(5, 10);
+ dw_hdmi_phy_enable_svsret(hdmi, 1);
+ dw_hdmi_phy_gen2_reset(hdmi);
+
+ dw_hdmi_phy_i2c_set_addr(hdmi, SUN60I_C422_PHY_I2C_SLAVE_ADDR);
+ dw_hdmi_phy_i2c_write(hdmi, mpll->opmode, SUN60I_C422_PHY_OPMODE_PLLCFG);
+ dw_hdmi_phy_i2c_write(hdmi, mpll->curr, SUN60I_C422_PHY_PLLCURRCTRL);
+ dw_hdmi_phy_i2c_write(hdmi, mpll->div, SUN60I_C422_PHY_PLLDIVCTRL);
+ dw_hdmi_phy_i2c_write(hdmi, drv->txterm, SUN60I_C422_PHY_TXTERM);
+ dw_hdmi_phy_i2c_write(hdmi, drv->vlev, SUN60I_C422_PHY_VLEVCTRL);
+ dw_hdmi_phy_i2c_write(hdmi, drv->cksym, SUN60I_C422_PHY_CKSYMTXCTRL);
+
+ dw_hdmi_phy_gen2_txpwron(hdmi, 1);
+ dw_hdmi_phy_gen2_pddq(hdmi, 0);
+
+ return 0;
+}
+
+static void sun60i_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data)
+{
+ struct sun8i_hdmi_phy *phy = data;
+
+ dw_hdmi_phy_gen2_txpwron(hdmi, 0);
+ dw_hdmi_phy_gen2_pddq(hdmi, 1);
+
+ regmap_clear_bits(phy->regs, SUN60I_TOP_PHY_PLL_CTRL,
+ SUN60I_TOP_PHY_PLL_OUTPUT_GATE |
+ SUN60I_TOP_PHY_PLL_EN | SUN60I_TOP_PHY_PLL_LDO_EN |
+ SUN60I_TOP_PHY_PLL_LOCK_EN);
+}
+
+static const struct dw_hdmi_phy_ops sun60i_a733_hdmi_phy_ops = {
+ .init = sun60i_hdmi_phy_config,
+ .disable = sun60i_hdmi_phy_disable,
+ .read_hpd = dw_hdmi_phy_read_hpd,
+ .update_hpd = dw_hdmi_phy_update_hpd,
+ .setup_hpd = dw_hdmi_phy_setup_hpd,
+};
+
+static const struct sun8i_hdmi_phy_variant sun60i_a733_hdmi_phy = {
+ .is_top_phy = true,
+ .phy_ops = &sun60i_a733_hdmi_phy_ops,
+ .phy_init = &sun60i_hdmi_phy_init_a733,
+};
+
static const struct sun8i_hdmi_phy_variant sun50i_h6_hdmi_phy = {
.cur_ctr = sun50i_h6_cur_ctr,
.mpll_cfg = sun50i_h6_mpll_cfg,
@@ -647,6 +958,10 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = {
.compatible = "allwinner,sun50i-h6-hdmi-phy",
.data = &sun50i_h6_hdmi_phy,
},
+ {
+ .compatible = "allwinner,sun60i-a733-hdmi-phy",
+ .data = &sun60i_a733_hdmi_phy,
+ },
{ /* sentinel */ }
};
@@ -690,11 +1005,29 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
"Couldn't map the HDMI PHY registers\n");
phy->regs = devm_regmap_init_mmio(dev, regs,
+ phy->variant->is_top_phy ?
+ &sun60i_hdmi_phy_regmap_config :
&sun8i_hdmi_phy_regmap_config);
if (IS_ERR(phy->regs))
return dev_err_probe(dev, PTR_ERR(phy->regs),
"Couldn't create the HDMI PHY regmap\n");
+ if (phy->variant->is_top_phy) {
+ phy->rescal = syscon_regmap_lookup_by_phandle(dev->of_node,
+ "allwinner,rescal");
+ if (IS_ERR(phy->rescal))
+ return dev_err_probe(dev, PTR_ERR(phy->rescal),
+ "Could not get rescal syscon\n");
+
+ phy->clk_ref = devm_clk_get_optional_enabled(dev, "ref");
+ if (IS_ERR(phy->clk_ref))
+ return dev_err_probe(dev, PTR_ERR(phy->clk_ref),
+ "Could not get ref clock\n");
+
+ platform_set_drvdata(pdev, phy);
+ return 0;
+ }
+
phy->clk_bus = devm_clk_get(dev, "bus");
if (IS_ERR(phy->clk_bus))
return dev_err_probe(dev, PTR_ERR(phy->clk_bus),
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 08/13] drm/sun4i: Add A733 DE3.5 RCQ helper
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (6 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 07/13] drm/sun4i: Add A733 DW-HDMI 2.0 and TOP PHY support Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 09/13] drm/sun4i: Add A733 DE3.5 planes and mixer support Alastair D'Silva
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Add a regmap-backed Register Configuration Queue (RCQ) helper for
Allwinner A733 DE3.5. It batches dirty register blocks for DMA commit.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/gpu/drm/sun4i/Makefile | 2 +-
drivers/gpu/drm/sun4i/sun60i_de35_rcq.c | 220 ++++++++++++++++++++++++
drivers/gpu/drm/sun4i/sun60i_de35_rcq.h | 44 +++++
drivers/gpu/drm/sun4i/sun8i_mixer.h | 31 +++-
4 files changed, 295 insertions(+), 2 deletions(-)
create mode 100644 drivers/gpu/drm/sun4i/sun60i_de35_rcq.c
create mode 100644 drivers/gpu/drm/sun4i/sun60i_de35_rcq.h
diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index 501e3d867918..184bf4f65b2a 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -17,7 +17,7 @@ sun8i-drm-hdmi-y += sun8i_hdmi_phy_clk.o
sun8i-mixer-y += sun8i_mixer.o sun8i_ui_layer.o \
sun8i_vi_layer.o sun8i_ui_scaler.o \
sun8i_vi_scaler.o sun8i_csc.o \
- sun50i_planes.o
+ sun50i_planes.o sun60i_de35_rcq.o
sun4i-tcon-y += sun4i_crtc.o
sun4i-tcon-y += sun4i_tcon_dclk.o
diff --git a/drivers/gpu/drm/sun4i/sun60i_de35_rcq.c b/drivers/gpu/drm/sun4i/sun60i_de35_rcq.c
new file mode 100644
index 000000000000..037b6c8259dd
--- /dev/null
+++ b/drivers/gpu/drm/sun4i/sun60i_de35_rcq.c
@@ -0,0 +1,220 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2026 Alastair D'Silva <alastair@d-silva.org>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/dma-mapping.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#include "sun60i_de35_rcq.h"
+#include "sun8i_mixer.h"
+
+#define SUN60I_DE35_TOP_RCQ_CTL_UPDATE BIT(0)
+#define SUN60I_DE35_RCQ_DW0_LEN_MASK GENMASK(23, 0)
+#define SUN60I_DE35_RCQ_DW0_HADDR_MASK GENMASK(31, 24)
+#define SUN60I_DE35_RCQ_HEAD_DIRTY BIT(0)
+
+struct sun60i_de35_rcq_block {
+ u32 offset;
+ u32 size;
+ u32 slab_off;
+ bool dirty;
+};
+
+struct sun60i_de35_rcq {
+ struct device *dev;
+ void __iomem *mmio;
+ u32 de_base_offset;
+ void *slab;
+ dma_addr_t slab_dma;
+ size_t slab_size;
+ unsigned int num_blocks;
+ struct sun60i_de35_rcq_block blocks[];
+};
+
+static struct sun60i_de35_rcq_block *
+sun60i_de35_rcq_find_block(struct sun60i_de35_rcq *rcq, unsigned int reg)
+{
+ unsigned int i;
+
+ for (i = 0; i < rcq->num_blocks; i++) {
+ struct sun60i_de35_rcq_block *blk = &rcq->blocks[i];
+
+ if (reg >= blk->offset && reg < blk->offset + blk->size)
+ return blk;
+ }
+
+ return NULL;
+}
+
+static int sun60i_de35_rcq_reg_write(void *context, unsigned int reg,
+ unsigned int val)
+{
+ struct sun60i_de35_rcq *rcq = context;
+ struct sun60i_de35_rcq_block *blk;
+
+ blk = sun60i_de35_rcq_find_block(rcq, reg);
+ if (blk) {
+ __le32 *slot = rcq->slab + blk->slab_off + (reg - blk->offset);
+
+ *slot = cpu_to_le32(val);
+ blk->dirty = true;
+ return 0;
+ }
+
+ writel(val, rcq->mmio + reg);
+ return 0;
+}
+
+static int sun60i_de35_rcq_reg_read(void *context, unsigned int reg,
+ unsigned int *val)
+{
+ struct sun60i_de35_rcq *rcq = context;
+ struct sun60i_de35_rcq_block *blk;
+
+ blk = sun60i_de35_rcq_find_block(rcq, reg);
+ if (blk) {
+ __le32 *slot = rcq->slab + blk->slab_off + (reg - blk->offset);
+
+ *val = le32_to_cpu(*slot);
+ return 0;
+ }
+
+ *val = readl(rcq->mmio + reg);
+ return 0;
+}
+
+static const struct regmap_bus sun60i_de35_rcq_regmap_bus = {
+ .reg_write = sun60i_de35_rcq_reg_write,
+ .reg_read = sun60i_de35_rcq_reg_read,
+};
+
+struct regmap *
+sun60i_de35_rcq_regmap_init(struct device *dev, void __iomem *mmio,
+ u32 de_base_offset,
+ const struct sun60i_de35_rcq_block_desc *descs,
+ unsigned int num_blocks,
+ const struct regmap_config *config,
+ struct sun60i_de35_rcq **rcq_out)
+{
+ struct sun60i_de35_rcq *rcq;
+ size_t slab_off = 0;
+ unsigned int i;
+
+ rcq = devm_kzalloc(dev, struct_size(rcq, blocks, num_blocks),
+ GFP_KERNEL);
+ if (!rcq)
+ return ERR_PTR(-ENOMEM);
+
+ rcq->dev = dev;
+ rcq->mmio = mmio;
+ rcq->de_base_offset = de_base_offset;
+ rcq->num_blocks = num_blocks;
+
+ for (i = 0; i < num_blocks; i++) {
+ rcq->blocks[i].offset = descs[i].offset;
+ rcq->blocks[i].size = descs[i].size;
+ rcq->blocks[i].slab_off = slab_off;
+ slab_off += ALIGN(descs[i].size, 64);
+ }
+
+ rcq->slab_size = slab_off;
+ /*
+ * Coherent allocations are zeroed; do not read back hardware SRAM
+ * because DE3.5 channel registers contain uninitialized reset values.
+ */
+ rcq->slab = dmam_alloc_coherent(dev, rcq->slab_size, &rcq->slab_dma,
+ GFP_KERNEL);
+ if (!rcq->slab)
+ return ERR_PTR(-ENOMEM);
+
+ for (i = 0; i < num_blocks; i++)
+ rcq->blocks[i].dirty = true;
+
+ *rcq_out = rcq;
+
+ return devm_regmap_init(dev, &sun60i_de35_rcq_regmap_bus, rcq,
+ config);
+}
+
+static unsigned int
+sun60i_de35_rcq_collect(struct sun60i_de35_rcq *rcq,
+ struct sun60i_de35_rcq_head *heads,
+ unsigned int count, unsigned int max_heads)
+{
+ unsigned int i;
+
+ if (!rcq)
+ return count;
+
+ for (i = 0; i < rcq->num_blocks; i++) {
+ struct sun60i_de35_rcq_block *blk = &rcq->blocks[i];
+ dma_addr_t addr;
+
+ if (!blk->dirty)
+ continue;
+
+ if (count >= max_heads) {
+ WARN_ON_ONCE(1);
+ break;
+ }
+
+ addr = rcq->slab_dma + blk->slab_off;
+ heads[count].low_addr = cpu_to_le32(lower_32_bits(addr));
+ heads[count].dw0 = cpu_to_le32(FIELD_PREP(SUN60I_DE35_RCQ_DW0_LEN_MASK,
+ blk->size) |
+ FIELD_PREP(SUN60I_DE35_RCQ_DW0_HADDR_MASK,
+ upper_32_bits(addr)));
+ heads[count].dirty = cpu_to_le32(SUN60I_DE35_RCQ_HEAD_DIRTY);
+ heads[count].reg_offset = cpu_to_le32(rcq->de_base_offset +
+ blk->offset);
+ blk->dirty = false;
+ count++;
+ }
+
+ return count;
+}
+
+/*
+ * Serialized by DRM atomic commit locking (single CRTC/mixer on A733).
+ */
+void sun60i_de35_rcq_commit(struct regmap *top_regs,
+ struct sun60i_de35_rcq *rcq_a,
+ struct sun60i_de35_rcq *rcq_b,
+ struct sun60i_de35_rcq_head *heads,
+ dma_addr_t heads_dma, unsigned int max_heads)
+{
+ unsigned int count = 0;
+ u32 val;
+ int ret;
+
+ ret = regmap_read_poll_timeout(top_regs, SUN60I_DE35_TOP_RCQ_CTL, val,
+ !(val & SUN60I_DE35_TOP_RCQ_CTL_UPDATE),
+ 100, 50000);
+ if (ret) {
+ dev_warn_ratelimited(rcq_a ? rcq_a->dev : rcq_b->dev,
+ "DE3.5 RCQ busy timeout\n");
+ return;
+ }
+
+ count = sun60i_de35_rcq_collect(rcq_a, heads, count, max_heads);
+ count = sun60i_de35_rcq_collect(rcq_b, heads, count, max_heads);
+ if (!count)
+ return;
+
+ /* Ensure descriptor and shadow register writes reach memory before DMA */
+ dma_wmb();
+
+ regmap_write(top_regs, SUN60I_DE35_TOP_RCQ_HADDR_L,
+ lower_32_bits(heads_dma));
+ regmap_write(top_regs, SUN60I_DE35_TOP_RCQ_HADDR_H,
+ upper_32_bits(heads_dma));
+ regmap_write(top_regs, SUN60I_DE35_TOP_RCQ_LEN,
+ count * sizeof(*heads));
+ regmap_write(top_regs, SUN60I_DE35_TOP_RCQ_CTL,
+ SUN60I_DE35_TOP_RCQ_CTL_UPDATE);
+}
diff --git a/drivers/gpu/drm/sun4i/sun60i_de35_rcq.h b/drivers/gpu/drm/sun4i/sun60i_de35_rcq.h
new file mode 100644
index 000000000000..0b189b414caf
--- /dev/null
+++ b/drivers/gpu/drm/sun4i/sun60i_de35_rcq.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2026 Alastair D'Silva <alastair@d-silva.org>
+ */
+
+#ifndef _SUN60I_DE35_RCQ_H_
+#define _SUN60I_DE35_RCQ_H_
+
+#include <linux/types.h>
+
+struct device;
+struct regmap;
+
+struct sun60i_de35_rcq_block_desc {
+ u32 offset;
+ u32 size;
+};
+
+struct sun60i_de35_rcq_head {
+ __le32 low_addr;
+ __le32 dw0;
+ __le32 dirty;
+ __le32 reg_offset;
+};
+
+struct sun60i_de35_rcq;
+
+struct regmap_config;
+
+struct regmap *
+sun60i_de35_rcq_regmap_init(struct device *dev, void __iomem *mmio,
+ u32 de_base_offset,
+ const struct sun60i_de35_rcq_block_desc *descs,
+ unsigned int num_blocks,
+ const struct regmap_config *config,
+ struct sun60i_de35_rcq **rcq_out);
+
+void sun60i_de35_rcq_commit(struct regmap *top_regs,
+ struct sun60i_de35_rcq *rcq_a,
+ struct sun60i_de35_rcq *rcq_b,
+ struct sun60i_de35_rcq_head *heads,
+ dma_addr_t heads_dma, unsigned int max_heads);
+
+#endif /* _SUN60I_DE35_RCQ_H_ */
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 9552c0bd9b99..9e3a42344748 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -148,6 +148,23 @@
#define SUN50I_MIXER_CDC0_EN 0xd0000
#define SUN50I_MIXER_CDC1_EN 0xd8000
+/* DE3.5 TOP registers (relative to 0x05008000) */
+#define SUN60I_DE35_TOP_RESET 0x000
+#define SUN60I_DE35_TOP_CLK 0x004
+#define SUN60I_DE35_TOP_MBUS_CLK 0x008
+#define SUN60I_DE35_TOP_DE2TCON_MUX 0x010
+#define SUN60I_DE35_TOP_VCH2CORE_MUX 0x028
+#define SUN60I_DE35_TOP_UCH2CORE_MUX 0x02c
+#define SUN60I_DE35_TOP_PORT2CHN_MUX 0x030
+#define SUN60I_DE35_TOP_BUF_DEPTH 0x050
+#define SUN60I_DE35_TOP_GLB_CTL 0x100
+#define SUN60I_DE35_TOP_OUT_SIZE 0x108
+#define SUN60I_DE35_TOP_AUTO_CLK 0x10c
+#define SUN60I_DE35_TOP_RCQ_CTL 0x110
+#define SUN60I_DE35_TOP_RCQ_HADDR_L 0x114
+#define SUN60I_DE35_TOP_RCQ_HADDR_H 0x118
+#define SUN60I_DE35_TOP_RCQ_LEN 0x11c
+
enum {
/* First mixer or second mixer with VEP support. */
CCSC_MIXER0_LAYOUT,
@@ -161,6 +178,7 @@ enum sun8i_mixer_type {
SUN8I_MIXER_DE2,
SUN8I_MIXER_DE3,
SUN8I_MIXER_DE33,
+ SUN8I_MIXER_DE35,
};
/**
@@ -203,6 +221,9 @@ struct sun8i_mixer_cfg {
unsigned long mod_rate;
};
+struct sun60i_de35_rcq;
+struct sun60i_de35_rcq_head;
+
struct sun8i_mixer {
struct sunxi_engine engine;
@@ -212,9 +233,16 @@ struct sun8i_mixer {
struct clk *bus_clk;
struct clk *mod_clk;
+ struct clk *ahb_clk;
+ struct clk *mbus_clk;
struct regmap *top_regs;
struct device *planes_dev;
+
+ struct sun60i_de35_rcq *rcq;
+ struct sun60i_de35_rcq_head *rcq_heads;
+ dma_addr_t rcq_heads_dma;
+ unsigned int rcq_max_heads;
};
enum {
@@ -253,7 +281,8 @@ sun8i_blender_base(struct sun8i_mixer *mixer)
static inline u32
sun8i_channel_base(struct sun8i_layer *layer)
{
- if (layer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ layer->cfg->de_type == SUN8I_MIXER_DE35)
return DE33_CH_BASE + layer->channel * DE33_CH_SIZE;
else if (layer->cfg->de_type == SUN8I_MIXER_DE3)
return DE3_CH_BASE + layer->channel * DE3_CH_SIZE;
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 09/13] drm/sun4i: Add A733 DE3.5 planes and mixer support
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (7 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 08/13] drm/sun4i: Add A733 DE3.5 RCQ helper Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 10/13] arm64: dts: allwinner: sun60i-a733: Add DE3.5 and HDMI display pipeline Alastair D'Silva
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Reuse the DE3.3 planes and mixer infrastructure for Allwinner A733
DE3.5. Enable 40-bit DMA addresses and commit shadow blocks via RCQ.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 10 +-
drivers/gpu/drm/sun4i/sun50i_planes.c | 98 +++++++++---
drivers/gpu/drm/sun4i/sun50i_planes.h | 5 +
drivers/gpu/drm/sun4i/sun8i_csc.c | 3 +-
drivers/gpu/drm/sun4i/sun8i_mixer.c | 200 +++++++++++++++++++-----
drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 12 +-
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 6 +
drivers/gpu/drm/sun4i/sun8i_vi_layer.h | 2 +
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c | 3 +-
9 files changed, 272 insertions(+), 67 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 248be5ff4f36..c17208c91cd0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -378,10 +378,13 @@ static int sun4i_drv_probe(struct platform_device *pdev)
INIT_KFIFO(list.fifo);
/*
- * DE2 and DE3 cores actually supports 40-bit addresses, but
- * driver does not.
+ * DE2 and DE3 cores actually support 40-bit addresses, but the
+ * driver uses 32-bit for them. DE3.5 requires 40-bit DMA.
*/
- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+ if (of_device_is_compatible(np, "allwinner,sun60i-a733-display-engine"))
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
+ else
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
dma_set_max_seg_size(&pdev->dev, UINT_MAX);
for (i = 0;; i++) {
@@ -442,6 +445,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
{ .compatible = "allwinner,sun20i-d1-display-engine" },
{ .compatible = "allwinner,sun50i-a64-display-engine" },
{ .compatible = "allwinner,sun50i-h6-display-engine" },
+ { .compatible = "allwinner,sun60i-a733-display-engine" },
{ }
};
MODULE_DEVICE_TABLE(of, sun4i_drv_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun50i_planes.c b/drivers/gpu/drm/sun4i/sun50i_planes.c
index 05607445cc38..a597fbbe54dc 100644
--- a/drivers/gpu/drm/sun4i/sun50i_planes.c
+++ b/drivers/gpu/drm/sun4i/sun50i_planes.c
@@ -4,6 +4,7 @@
#include <drm/drm_device.h>
#include <linux/device.h>
+#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -12,6 +13,7 @@
#include <linux/regmap.h>
#include "sun50i_planes.h"
+#include "sun60i_de35_rcq.h"
#include "sun8i_ui_layer.h"
#include "sun8i_vi_layer.h"
@@ -37,11 +39,39 @@ static const struct sun50i_planes_quirks sun50i_h616_planes_quirks = {
},
};
+static const struct sun50i_planes_quirks sun60i_a733_planes_quirks = {
+ .is_de35 = true,
+ .def_map = {
+ {
+ .map = {0, 6, 7, 1, 2, 8},
+ .num_ch = 6,
+ },
+ },
+ .cfg = {
+ .de_type = SUN8I_MIXER_DE35,
+ .scaler_mask = 0,
+ .scanline_yuv = 4096,
+ },
+};
+
+static const struct sun60i_de35_rcq_block_desc sun60i_a733_plane_blocks[] = {
+ { 0x001000, 0x100 }, { 0x001800, 0x80 }, /* vch0 */
+ { 0x021000, 0x100 }, { 0x021800, 0x80 }, /* vch1 */
+ { 0x041000, 0x100 }, { 0x041800, 0x80 }, /* vch2 */
+ { 0x0c1000, 0x90 }, /* uch0 */
+ { 0x0e1000, 0x90 }, /* uch1 */
+ { 0x101000, 0x90 }, /* uch2 */
+};
+
static const struct of_device_id sun50i_planes_of_table[] = {
{
.compatible = "allwinner,sun50i-h616-de33-planes",
.data = &sun50i_h616_planes_quirks
},
+ {
+ .compatible = "allwinner,sun60i-a733-de35-planes",
+ .data = &sun60i_a733_planes_quirks
+ },
{ }
};
MODULE_DEVICE_TABLE(of, sun50i_planes_of_table);
@@ -105,6 +135,13 @@ sun50i_planes_setup(struct device *dev, struct drm_device *drm,
return drm_planes;
}
+struct sun60i_de35_rcq *sun50i_planes_get_rcq(struct device *dev)
+{
+ struct sun50i_planes *planes = dev_get_drvdata(dev);
+
+ return planes ? planes->rcq : NULL;
+}
+
static void sun50i_planes_init_mapping(struct sun50i_planes *planes)
{
const struct sun50i_planes_quirks *quirks = planes->quirks;
@@ -161,39 +198,56 @@ static int sun50i_planes_probe(struct platform_device *pdev)
if (!planes->quirks)
return dev_err_probe(dev, -EINVAL, "Unable to get quirks\n");
- np = of_parse_phandle(dev->of_node,
- "allwinner,plane-mapping", 0);
- if (!np)
- return dev_err_probe(dev, -EINVAL, "Missing mapping phandle\n");
-
- clk_pdev = of_find_device_by_node(np);
- of_node_put(np);
- if (!clk_pdev)
- return dev_err_probe(dev, -EPROBE_DEFER, "Unable to get mapping\n");
-
- /* Regmap is registered by display clocks driver during its probe. */
- planes->mapping = dev_get_regmap(&clk_pdev->dev, NULL);
- if (!planes->mapping) {
- platform_device_put(clk_pdev);
- return dev_err_probe(dev, -EPROBE_DEFER, "Unable to get regmap\n");
- }
+ if (!planes->quirks->is_de35) {
+ np = of_parse_phandle(dev->of_node,
+ "allwinner,plane-mapping", 0);
+ if (!np)
+ return dev_err_probe(dev, -EINVAL, "Missing mapping phandle\n");
+
+ clk_pdev = of_find_device_by_node(np);
+ of_node_put(np);
+ if (!clk_pdev)
+ return dev_err_probe(dev, -EPROBE_DEFER, "Unable to get mapping\n");
+
+ /* Regmap is registered by display clocks driver during its probe. */
+ planes->mapping = dev_get_regmap(&clk_pdev->dev, NULL);
+ if (!planes->mapping) {
+ platform_device_put(clk_pdev);
+ return dev_err_probe(dev, -EPROBE_DEFER, "Unable to get regmap\n");
+ }
- if (!device_link_add(dev, &clk_pdev->dev,
- DL_FLAG_AUTOREMOVE_CONSUMER)) {
+ if (!device_link_add(dev, &clk_pdev->dev,
+ DL_FLAG_AUTOREMOVE_CONSUMER)) {
+ platform_device_put(clk_pdev);
+ return dev_err_probe(dev, -EINVAL, "Failed to create link\n");
+ }
platform_device_put(clk_pdev);
- return dev_err_probe(dev, -EINVAL, "Failed to create link\n");
}
- platform_device_put(clk_pdev);
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
- planes->regs = devm_regmap_init_mmio(dev, regs, &sun50i_planes_regmap_config);
+ if (planes->quirks->is_de35) {
+ int ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
+
+ if (ret)
+ return ret;
+
+ planes->regs = sun60i_de35_rcq_regmap_init(dev, regs, 0x100000,
+ sun60i_a733_plane_blocks,
+ ARRAY_SIZE(sun60i_a733_plane_blocks),
+ &sun50i_planes_regmap_config,
+ &planes->rcq);
+ } else {
+ planes->regs = devm_regmap_init_mmio(dev, regs,
+ &sun50i_planes_regmap_config);
+ }
if (IS_ERR(planes->regs))
return PTR_ERR(planes->regs);
- sun50i_planes_init_mapping(planes);
+ if (!planes->quirks->is_de35)
+ sun50i_planes_init_mapping(planes);
dev_set_drvdata(dev, planes);
diff --git a/drivers/gpu/drm/sun4i/sun50i_planes.h b/drivers/gpu/drm/sun4i/sun50i_planes.h
index 9b4f77a6b94e..f3637222c3a1 100644
--- a/drivers/gpu/drm/sun4i/sun50i_planes.h
+++ b/drivers/gpu/drm/sun4i/sun50i_planes.h
@@ -23,20 +23,25 @@ struct default_map {
unsigned int num_ch;
};
+struct sun60i_de35_rcq;
+
struct sun50i_planes_quirks {
struct default_map def_map[MAX_DISP];
struct sun8i_layer_cfg cfg;
+ bool is_de35;
};
struct sun50i_planes {
struct regmap *regs;
struct regmap *mapping;
const struct sun50i_planes_quirks *quirks;
+ struct sun60i_de35_rcq *rcq;
};
struct drm_plane **
sun50i_planes_setup(struct device *dev, struct drm_device *drm,
unsigned int mixer);
+struct sun60i_de35_rcq *sun50i_planes_get_rcq(struct device *dev);
extern struct platform_driver sun50i_planes_platform_driver;
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c
index 70fc9b017d17..76904871abbd 100644
--- a/drivers/gpu/drm/sun4i/sun8i_csc.c
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.c
@@ -304,7 +304,8 @@ void sun8i_csc_config(struct sun8i_layer *layer,
mode, state->color_encoding,
state->color_range);
return;
- } else if (layer->cfg->de_type == SUN8I_MIXER_DE33) {
+ } else if (layer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ layer->cfg->de_type == SUN8I_MIXER_DE35) {
sun8i_de33_ccsc_setup(layer->regs, layer->channel,
mode, state->color_encoding,
state->color_range);
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 4677180ec780..638064ea1a72 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -15,6 +15,7 @@
#include <linux/of_graph.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <drm/drm_atomic.h>
@@ -30,6 +31,7 @@
#include "sun8i_ui_layer.h"
#include "sun8i_vi_layer.h"
#include "sun50i_planes.h"
+#include "sun60i_de35_rcq.h"
#include "sunxi_engine.h"
struct de2_fmt_info {
@@ -307,9 +309,19 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine,
regmap_write(engine->regs, SUN8I_MIXER_BLEND_PIPE_CTL(bld_base),
pipe_en | SUN8I_MIXER_BLEND_PIPE_CTL_FC_EN(0));
- if (mixer->cfg->de_type != SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE35) {
+ struct sun60i_de35_rcq *planes_rcq;
+
+ planes_rcq = sun50i_planes_get_rcq(mixer->planes_dev);
+ sun60i_de35_rcq_commit(mixer->top_regs,
+ mixer->rcq, planes_rcq,
+ mixer->rcq_heads,
+ mixer->rcq_heads_dma,
+ mixer->rcq_max_heads);
+ } else if (mixer->cfg->de_type != SUN8I_MIXER_DE33) {
regmap_write(engine->regs, SUN8I_MIXER_GLOBAL_DBUFF,
SUN8I_MIXER_GLOBAL_DBUFF_ENABLE);
+ }
}
static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
@@ -403,7 +415,9 @@ static void sun8i_mixer_mode_set(struct sunxi_engine *engine,
DRM_DEBUG_DRIVER("Updating global size W: %u H: %u\n",
mode->hdisplay, mode->vdisplay);
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE35)
+ regmap_write(mixer->top_regs, SUN60I_DE35_TOP_OUT_SIZE, size);
+ else if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
regmap_write(mixer->top_regs, SUN50I_MIXER_GLOBAL_SIZE, size);
else
regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_SIZE, size);
@@ -450,6 +464,19 @@ static const struct regmap_config sun8i_top_regmap_config = {
.max_register = 0x3c,
};
+static const struct regmap_config sun60i_de35_top_regmap_config = {
+ .name = "top",
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .max_register = 0x1fc,
+};
+
+static const struct sun60i_de35_rcq_block_desc sun60i_de35_mixer_rcq_blocks[] = {
+ { .offset = 0x1000, .size = 0x60 },
+ { .offset = 0x1080, .size = 0x80 },
+};
+
static const struct regmap_config sun50i_mixer33_regmap_config = {
.name = "display",
.reg_bits = 32,
@@ -484,17 +511,40 @@ static void sun8i_mixer_init(struct sun8i_mixer *mixer)
struct regmap *top_regs;
int plane_cnt, i;
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35)
top_regs = mixer->top_regs;
else
top_regs = mixer->engine.regs;
- /* Enable the mixer */
- regmap_write(top_regs, SUN8I_MIXER_GLOBAL_CTL,
- SUN8I_MIXER_GLOBAL_CTL_RT_EN);
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE35) {
+ regmap_set_bits(top_regs, SUN60I_DE35_TOP_RESET,
+ BIT(0) | BIT(16));
+ regmap_set_bits(top_regs, SUN60I_DE35_TOP_CLK,
+ BIT(0) | BIT(16));
+ regmap_set_bits(top_regs, SUN60I_DE35_TOP_MBUS_CLK,
+ BIT(0) | BIT(4));
+ /* Route mixer0 to TCON_TV0 (index 4); leave disp1-3 unrouted */
+ regmap_write(top_regs, SUN60I_DE35_TOP_DE2TCON_MUX, 0x0000fff4);
+ /* Route all VCH/UCH channels to mixer0 */
+ regmap_write(top_regs, SUN60I_DE35_TOP_VCH2CORE_MUX, 0);
+ regmap_write(top_regs, SUN60I_DE35_TOP_UCH2CORE_MUX, 0);
+ /*
+ * Map blender ports 0..5 to match sun60i_a733_planes_quirks
+ * def_map {0, 6, 7, 1, 2, 8}: vch0, uch0, uch1, vch1, vch2, uch2.
+ */
+ regmap_write(top_regs, SUN60I_DE35_TOP_PORT2CHN_MUX, 0x00a21980);
+ regmap_write(top_regs, SUN60I_DE35_TOP_BUF_DEPTH, 0x3000);
+ regmap_write(top_regs, SUN60I_DE35_TOP_GLB_CTL, 0x1);
+ regmap_write(top_regs, SUN60I_DE35_TOP_AUTO_CLK, 0x1);
+ } else {
+ /* Enable the mixer */
+ regmap_write(top_regs, SUN8I_MIXER_GLOBAL_CTL,
+ SUN8I_MIXER_GLOBAL_CTL_RT_EN);
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
- regmap_write(top_regs, SUN50I_MIXER_GLOBAL_CLK, 1);
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ regmap_write(top_regs, SUN50I_MIXER_GLOBAL_CLK, 1);
+ }
/* Set background color to black */
regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_BKCOLOR(base),
@@ -533,25 +583,28 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
void __iomem *regs;
int i, ret;
- /*
- * The mixer uses single 32-bit register to store memory
- * addresses, so that it cannot deal with 64-bit memory
- * addresses.
- * Restrict the DMA mask so that the mixer won't be
- * allocated some memory that is too high.
- */
- ret = dma_set_mask(dev, DMA_BIT_MASK(32));
- if (ret) {
- dev_err(dev, "Cannot do 32-bit DMA.\n");
- return ret;
- }
-
mixer = devm_kzalloc_obj(dev, *mixer);
if (!mixer)
return -ENOMEM;
dev_set_drvdata(dev, mixer);
mixer->engine.node = dev->of_node;
+ mixer->cfg = of_device_get_match_data(dev);
+ if (!mixer->cfg)
+ return -EINVAL;
+
+ /*
+ * DE2/DE3/DE33 mixers use 32-bit DMA addresses; DE3.5 supports 40-bit
+ * addresses via RCQ and layer top_haddr registers.
+ */
+ ret = dma_set_mask_and_coherent(dev,
+ mixer->cfg->de_type == SUN8I_MIXER_DE35 ?
+ DMA_BIT_MASK(40) : DMA_BIT_MASK(32));
+ if (ret) {
+ dev_err(dev, "Cannot set DMA mask.\n");
+ return ret;
+ }
+
/*
* This assume we have the same DMA constraints for all our the
* devices in our pipeline (all the backends, but also the
@@ -578,11 +631,8 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
*/
mixer->engine.id = sun8i_mixer_of_get_id(dev->of_node);
- mixer->cfg = of_device_get_match_data(dev);
- if (!mixer->cfg)
- return -EINVAL;
-
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33) {
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35) {
/*
* The original DE33 binding described planes as part of
* the mixer, which can't work with more than one mixer.
@@ -592,7 +642,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
if (of_property_match_string(dev->of_node, "reg-names", "layers") >= 0 ||
!of_property_present(dev->of_node, "allwinner,planes"))
return dev_err_probe(dev, -EINVAL,
- "Unsupported DE33 mixer binding, please update the device tree\n");
+ "Unsupported DE33/DE35 mixer binding, please update the device tree\n");
mixer->engine.ops = &sun50i_engine_ops;
} else {
@@ -603,7 +653,14 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
if (IS_ERR(regs))
return PTR_ERR(regs);
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE35)
+ mixer->engine.regs =
+ sun60i_de35_rcq_regmap_init(dev, regs, 0x280000,
+ sun60i_de35_mixer_rcq_blocks,
+ ARRAY_SIZE(sun60i_de35_mixer_rcq_blocks),
+ &sun50i_mixer33_regmap_config,
+ &mixer->rcq);
+ else if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
mixer->engine.regs = devm_regmap_init_mmio(dev, regs,
&sun50i_mixer33_regmap_config);
else
@@ -614,36 +671,79 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
return PTR_ERR(mixer->engine.regs);
}
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33) {
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35) {
+ const struct regmap_config *top_cfg;
+
regs = devm_platform_ioremap_resource_byname(pdev, "top");
if (IS_ERR(regs))
return PTR_ERR(regs);
- mixer->top_regs = devm_regmap_init_mmio(dev, regs,
- &sun8i_top_regmap_config);
+ top_cfg = mixer->cfg->de_type == SUN8I_MIXER_DE35 ?
+ &sun60i_de35_top_regmap_config :
+ &sun8i_top_regmap_config;
+ mixer->top_regs = devm_regmap_init_mmio(dev, regs, top_cfg);
if (IS_ERR(mixer->top_regs)) {
dev_err(dev, "Couldn't create the top regmap\n");
return PTR_ERR(mixer->top_regs);
}
}
- mixer->reset = devm_reset_control_get(dev, NULL);
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE35) {
+ size_t heads_size;
+
+ mixer->rcq_max_heads = 32;
+ heads_size = mixer->rcq_max_heads * sizeof(*mixer->rcq_heads);
+ mixer->rcq_heads = dmam_alloc_coherent(dev, heads_size,
+ &mixer->rcq_heads_dma,
+ GFP_KERNEL);
+ if (!mixer->rcq_heads)
+ return -ENOMEM;
+ }
+
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
+ goto err_pm_disable;
+
+ mixer->reset = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(mixer->reset)) {
dev_err(dev, "Couldn't get our reset line\n");
- return PTR_ERR(mixer->reset);
+ ret = PTR_ERR(mixer->reset);
+ goto err_pm_put;
}
ret = reset_control_deassert(mixer->reset);
if (ret) {
dev_err(dev, "Couldn't deassert our reset line\n");
- return ret;
+ goto err_pm_put;
+ }
+
+ mixer->ahb_clk = devm_clk_get_optional(dev, "ahb");
+ if (IS_ERR(mixer->ahb_clk)) {
+ ret = PTR_ERR(mixer->ahb_clk);
+ goto err_assert_reset;
}
+ ret = clk_prepare_enable(mixer->ahb_clk);
+ if (ret)
+ goto err_assert_reset;
+
+ mixer->mbus_clk = devm_clk_get_optional(dev, "mbus");
+ if (IS_ERR(mixer->mbus_clk)) {
+ ret = PTR_ERR(mixer->mbus_clk);
+ goto err_disable_ahb_clk;
+ }
+
+ ret = clk_prepare_enable(mixer->mbus_clk);
+ if (ret)
+ goto err_disable_ahb_clk;
+
mixer->bus_clk = devm_clk_get(dev, "bus");
if (IS_ERR(mixer->bus_clk)) {
dev_err(dev, "Couldn't get the mixer bus clock\n");
ret = PTR_ERR(mixer->bus_clk);
- goto err_assert_reset;
+ goto err_disable_mbus_clk;
}
clk_prepare_enable(mixer->bus_clk);
@@ -664,7 +764,8 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
clk_prepare_enable(mixer->mod_clk);
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33) {
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35) {
struct platform_device *planes_pdev;
struct device_node *np;
@@ -729,14 +830,23 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
return 0;
err_put_device:
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35)
put_device(mixer->planes_dev);
err_disable_mod_clk:
clk_disable_unprepare(mixer->mod_clk);
err_disable_bus_clk:
clk_disable_unprepare(mixer->bus_clk);
+err_disable_mbus_clk:
+ clk_disable_unprepare(mixer->mbus_clk);
+err_disable_ahb_clk:
+ clk_disable_unprepare(mixer->ahb_clk);
err_assert_reset:
reset_control_assert(mixer->reset);
+err_pm_put:
+ pm_runtime_put_sync(dev);
+err_pm_disable:
+ pm_runtime_disable(dev);
return ret;
}
@@ -747,12 +857,17 @@ static void sun8i_mixer_unbind(struct device *dev, struct device *master,
list_del(&mixer->engine.list);
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ mixer->cfg->de_type == SUN8I_MIXER_DE35)
put_device(mixer->planes_dev);
clk_disable_unprepare(mixer->mod_clk);
clk_disable_unprepare(mixer->bus_clk);
+ clk_disable_unprepare(mixer->mbus_clk);
+ clk_disable_unprepare(mixer->ahb_clk);
reset_control_assert(mixer->reset);
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
}
static const struct component_ops sun8i_mixer_ops = {
@@ -935,6 +1050,11 @@ static const struct sun8i_mixer_cfg sun50i_h616_mixer0_cfg = {
.mod_rate = 600000000,
};
+static const struct sun8i_mixer_cfg sun60i_a733_mixer0_cfg = {
+ .de_type = SUN8I_MIXER_DE35,
+ .mod_rate = 600000000,
+};
+
static const struct of_device_id sun8i_mixer_of_table[] = {
{
.compatible = "allwinner,sun8i-a83t-de2-mixer-0",
@@ -984,6 +1104,10 @@ static const struct of_device_id sun8i_mixer_of_table[] = {
.compatible = "allwinner,sun50i-h616-de33-mixer-0",
.data = &sun50i_h616_mixer0_cfg,
},
+ {
+ .compatible = "allwinner,sun60i-a733-de35-mixer-0",
+ .data = &sun60i_a733_mixer0_cfg,
+ },
{ }
};
MODULE_DEVICE_TABLE(of, sun8i_mixer_of_table);
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index f9c7f28f9fa2..a95e89b77f32 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -100,7 +100,8 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
hscale = state->src_w / state->crtc_w;
vscale = state->src_h / state->crtc_h;
- if (layer->cfg->de_type == SUN8I_MIXER_DE33) {
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ layer->cfg->de_type == SUN8I_MIXER_DE35) {
sun8i_vi_scaler_setup(layer, src_w, src_h, dst_w, dst_h,
hscale, vscale, hphase, vphase,
state->fb->format);
@@ -112,7 +113,8 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
}
} else {
DRM_DEBUG_DRIVER("HW scaling is not needed\n");
- if (layer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ layer->cfg->de_type == SUN8I_MIXER_DE35)
sun8i_vi_scaler_enable(layer, false);
else
sun8i_ui_scaler_enable(layer, false);
@@ -143,6 +145,12 @@ static void sun8i_ui_layer_update_buffer(struct sun8i_layer *layer,
regmap_write(layer->regs,
SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(ch_base, layer->overlay),
lower_32_bits(dma_addr));
+ if (layer->cfg->de_type == SUN8I_MIXER_DE35)
+ regmap_update_bits(layer->regs,
+ SUN8I_MIXER_CHAN_UI_TOP_HADDR(ch_base),
+ 0xff << (8 * layer->overlay),
+ (upper_32_bits(dma_addr) & 0xff) <<
+ (8 * layer->overlay));
}
static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 4d3fc03f9877..e1c22e0ffc92 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -222,6 +222,12 @@ static void sun8i_vi_layer_update_buffer(struct sun8i_layer *layer,
SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(ch_base,
layer->overlay, i),
lower_32_bits(dma_addr));
+ if (layer->cfg->de_type == SUN8I_MIXER_DE35)
+ regmap_update_bits(layer->regs,
+ SUN8I_MIXER_CHAN_VI_TOP_HADDR(ch_base, i),
+ 0xff << (8 * layer->overlay),
+ (upper_32_bits(dma_addr) & 0xff) <<
+ (8 * layer->overlay));
}
}
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.h b/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
index 29cc5573691f..43f62c3ad6fd 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
@@ -18,6 +18,8 @@
((base) + 0x30 * (layer) + 0xc + 4 * (plane))
#define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(base, layer, plane) \
((base) + 0x30 * (layer) + 0x18 + 4 * (plane))
+#define SUN8I_MIXER_CHAN_VI_TOP_HADDR(base, plane) \
+ ((base) + 0xd0 + 4 * (plane))
#define SUN8I_MIXER_CHAN_VI_OVL_SIZE(base) \
((base) + 0xe8)
#define SUN8I_MIXER_CHAN_VI_HDS_Y(base) \
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
index a5cc99981006..428df62e1079 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
@@ -835,7 +835,8 @@ static const u32 bicubic4coefftab32[480] = {
static u32 sun8i_vi_scaler_base(struct sun8i_layer *layer)
{
- if (layer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33 ||
+ layer->cfg->de_type == SUN8I_MIXER_DE35)
return DE33_VI_SCALER_UNIT_BASE +
DE33_CH_SIZE * layer->channel;
else if (layer->cfg->de_type == SUN8I_MIXER_DE3)
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 10/13] arm64: dts: allwinner: sun60i-a733: Add DE3.5 and HDMI display pipeline
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (8 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 09/13] drm/sun4i: Add A733 DE3.5 planes and mixer support Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 11/13] arm64: dts: allwinner: orangepi-4-pro: Enable HDMI output Alastair D'Silva
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Add the PCK-600 power controller, system controller, DE3.5 planes and
mixer, TCON TOP1, TCON TV0, DW-HDMI 2.0, and HDMI PHY nodes for A733.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../arm64/boot/dts/allwinner/sun60i-a733.dtsi | 186 ++++++++++++++++++
1 file changed, 186 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
index fe62d0e0b013..ba2e9790f578 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
@@ -3,7 +3,9 @@
#include <dt-bindings/clock/allwinner,sun60i-a733-ccu.h>
#include <dt-bindings/clock/allwinner,sun60i-a733-r-ccu.h>
#include <dt-bindings/clock/sun6i-rtc.h>
+#include <dt-bindings/clock/sun8i-tcon-top.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/allwinner,sun60i-a733-pck-600.h>
#include <dt-bindings/reset/allwinner,sun60i-a733-ccu.h>
#include <dt-bindings/reset/allwinner,sun60i-a733-r-ccu.h>
@@ -109,6 +111,12 @@ cpu7: cpu@700 {
};
};
+ de: display-engine {
+ compatible = "allwinner,sun60i-a733-display-engine";
+ allwinner,pipelines = <&mixer0>;
+ status = "disabled";
+ };
+
hosc: clock-hosc {
compatible = "fixed-clock";
#clock-cells = <0>;
@@ -467,6 +475,14 @@ i2c12: i2c@251c000 {
status = "disabled";
};
+ syscon: syscon@3000000 {
+ compatible = "allwinner,sun60i-a733-system-control";
+ reg = <0x03000000 0x1000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+ };
+
gic: interrupt-controller@3400000 {
compatible = "arm,gic-v3";
reg = <0x03400000 0x10000>, <0x03460000 0x100000>;
@@ -546,6 +562,176 @@ mmc2: mmc@4022000 {
status = "disabled";
};
+ de35_planes: planes@5100000 {
+ compatible = "allwinner,sun60i-a733-de35-planes";
+ reg = <0x05100000 0x180000>;
+ };
+
+ mixer0: mixer@5280000 {
+ compatible = "allwinner,sun60i-a733-de35-mixer-0";
+ reg = <0x05280000 0x20000>, <0x05008000 0x200>;
+ reg-names = "display", "top";
+ clocks = <&ccu CLK_BUS_DE0>,
+ <&ccu CLK_DE0>,
+ <&ccu CLK_AHB_DE>,
+ <&ccu CLK_MBUS_DESYS>;
+ clock-names = "bus", "mod", "ahb", "mbus";
+ resets = <&ccu RST_BUS_DE0>,
+ <&ccu RST_BUS_DE_SYS>;
+ power-domains = <&pck600 PD_DE_SYS>;
+ allwinner,planes = <&de35_planes>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mixer0_out: port@1 {
+ reg = <1>;
+
+ mixer0_out_tcon_top: endpoint {
+ remote-endpoint = <&tcon_top_mixer0_in_mixer0>;
+ };
+ };
+ };
+ };
+
+ tcon_top1: tcon-top@5510000 {
+ compatible = "allwinner,sun60i-a733-tcon-top";
+ reg = <0x05510000 0x1000>;
+ clocks = <&ccu CLK_BUS_DPSS_TOP1>,
+ <&ccu CLK_HDMI_TV>,
+ <&ccu CLK_AHB_VID_COUT1>;
+ clock-names = "bus", "tcon-tv0", "ahb";
+ clock-output-names = "tcon-top-tv0";
+ resets = <&ccu RST_BUS_DPSS_TOP1>,
+ <&ccu RST_BUS_VIDEO_OUT1>;
+ power-domains = <&pck600 PD_VO1>;
+ #clock-cells = <1>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tcon_top_mixer0_in: port@0 {
+ reg = <0>;
+
+ tcon_top_mixer0_in_mixer0: endpoint {
+ remote-endpoint = <&mixer0_out_tcon_top>;
+ };
+ };
+
+ tcon_top_mixer0_out: port@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ tcon_top_mixer0_out_tcon_tv0: endpoint@2 {
+ reg = <2>;
+ remote-endpoint = <&tcon_tv0_in_tcon_top>;
+ };
+ };
+
+ tcon_top_hdmi_in: port@4 {
+ reg = <4>;
+
+ tcon_top_hdmi_in_tcon_tv0: endpoint {
+ remote-endpoint = <&tcon_tv0_out_hdmi>;
+ };
+ };
+
+ tcon_top_hdmi_out: port@5 {
+ reg = <5>;
+
+ tcon_top_hdmi_out_hdmi: endpoint {
+ remote-endpoint = <&hdmi_in_tcon_top>;
+ };
+ };
+ };
+ };
+
+ hdmi: hdmi@5520000 {
+ compatible = "allwinner,sun60i-a733-dw-hdmi";
+ reg = <0x05520000 0x10000>;
+ reg-io-width = <1>;
+ interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&ccu CLK_BUS_HDMI_TV>,
+ <&ccu CLK_HDMI_SFR>,
+ <&tcon_top1 CLK_TCON_TOP_TV0>,
+ <&ccu CLK_AHB_VID_COUT1>;
+ clock-names = "iahb", "isfr", "tmds", "ahb";
+ resets = <&ccu RST_BUS_HDMI_MAIN>,
+ <&ccu RST_BUS_HDMI_SUB>,
+ <&ccu RST_BUS_HDMI_HDCP>;
+ reset-names = "ctrl", "sub", "hdcp";
+ phys = <&hdmi_phy>;
+ phy-names = "phy";
+ power-domains = <&pck600 PD_VO1>;
+ status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ hdmi_in: port@0 {
+ reg = <0>;
+
+ hdmi_in_tcon_top: endpoint {
+ remote-endpoint = <&tcon_top_hdmi_out_hdmi>;
+ };
+ };
+
+ hdmi_out: port@1 {
+ reg = <1>;
+ };
+ };
+ };
+
+ hdmi_phy: hdmi-phy@5600000 {
+ compatible = "allwinner,sun60i-a733-hdmi-phy";
+ reg = <0x05600000 0x1000>;
+ clocks = <&hosc>;
+ clock-names = "ref";
+ allwinner,rescal = <&syscon>;
+ power-domains = <&pck600 PD_VO1>;
+ #phy-cells = <0>;
+ };
+
+ tcon_tv0: lcd-controller@5730000 {
+ compatible = "allwinner,sun60i-a733-tcon-tv";
+ reg = <0x05730000 0x1000>;
+ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&ccu CLK_BUS_TCON_TV0>,
+ <&tcon_top1 CLK_TCON_TOP_TV0>;
+ clock-names = "ahb", "tcon-ch1";
+ resets = <&ccu RST_BUS_TCON_TV0>;
+ reset-names = "lcd";
+ power-domains = <&pck600 PD_VO1>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tcon_tv0_in: port@0 {
+ reg = <0>;
+
+ tcon_tv0_in_tcon_top: endpoint {
+ remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>;
+ };
+ };
+
+ tcon_tv0_out: port@1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+
+ tcon_tv0_out_hdmi: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>;
+ };
+ };
+ };
+ };
+
r_ccu: clock-controller@7010000 {
compatible = "allwinner,sun60i-a733-r-ccu";
reg = <0x07010000 0x250>;
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 11/13] arm64: dts: allwinner: orangepi-4-pro: Enable HDMI output
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (9 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 10/13] arm64: dts: allwinner: sun60i-a733: Add DE3.5 and HDMI display pipeline Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 12/13] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Enable the display engine and DW-HDMI controller on the Orange Pi 4 Pro.
Add the HDMI Type-A connector node, define reg_cldo2 on the AXP318W PMIC,
and connect reg_cldo2 as the HDMI 1.8V supply.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../allwinner/sun60i-a733-orangepi-4-pro.dts | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
index 374287d962a8..a11b195a0f57 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
@@ -21,6 +21,32 @@ aliases {
chosen {
stdout-path = "serial0:115200n8";
};
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_con_in: endpoint {
+ remote-endpoint = <&hdmi_out_con>;
+ };
+ };
+ };
+};
+
+&de {
+ status = "okay";
+};
+
+&hdmi {
+ hvcc-supply = <®_cldo2>;
+ status = "okay";
+};
+
+&hdmi_out {
+ hdmi_out_con: endpoint {
+ remote-endpoint = <&hdmi_con_in>;
+ };
};
&hosc {
@@ -51,6 +77,12 @@ axp318w: pmic@36 {
#interrupt-cells = <1>;
regulators {
+ reg_cldo2: cldo2 {
+ regulator-name = "vcc18-hdmi";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ };
+
reg_dcdc2: dcdc2 {
regulator-name = "vdd-cpu";
regulator-min-microvolt = <500000>;
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 12/13] arm64: dts: allwinner: cubie-a7a: Enable HDMI output
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (10 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 11/13] arm64: dts: allwinner: orangepi-4-pro: Enable HDMI output Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 2:07 ` [RFC PATCH 13/13] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva
2026-11-30 15:13 ` [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Jernej Škrabec
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Enable the DW-HDMI controller on the Radxa Cubie A7A. Add the HDMI Type-A
connector node and connect reg_cldo2 as the HDMI 1.8V supply.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../dts/allwinner/sun60i-a733-cubie-a7a.dts | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
index 9017cadf6c6a..eff71aa824be 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
@@ -22,6 +22,17 @@ chosen {
stdout-path = "serial0:115200n8";
};
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_con_in: endpoint {
+ remote-endpoint = <&hdmi_out_con>;
+ };
+ };
+ };
+
leds {
compatible = "gpio-leds";
@@ -103,6 +114,21 @@ &cpu7 {
cpu-supply = <®_dcdc3>;
};
+&de {
+ status = "okay";
+};
+
+&hdmi {
+ hvcc-supply = <®_cldo2>;
+ status = "okay";
+};
+
+&hdmi_out {
+ hdmi_out_con: endpoint {
+ remote-endpoint = <&hdmi_con_in>;
+ };
+};
+
&i2c0 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pg_pins>;
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [RFC PATCH 13/13] arm64: dts: allwinner: cubie-a7z: Enable HDMI output
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (11 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 12/13] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
@ 2026-11-30 2:07 ` Alastair D'Silva
2026-11-30 15:13 ` [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Jernej Škrabec
13 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 2:07 UTC (permalink / raw)
To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Enable the DW-HDMI controller on the Radxa Cubie A7Z. Add the Micro-HDMI
Type-D connector node and connect reg_cldo2 as the HDMI 1.8V supply.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
.../dts/allwinner/sun60i-a733-cubie-a7z.dts | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
index 049e6b67c23a..1ba0542ba347 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
@@ -25,6 +25,17 @@ osc32k: clock-osc32k {
clock-frequency = <32768>;
};
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "d";
+
+ port {
+ hdmi_con_in: endpoint {
+ remote-endpoint = <&hdmi_out_con>;
+ };
+ };
+ };
+
leds {
compatible = "gpio-leds";
@@ -102,6 +113,21 @@ &cpu7 {
cpu-supply = <®_dcdc3>;
};
+&de {
+ status = "okay";
+};
+
+&hdmi {
+ hvcc-supply = <®_cldo2>;
+ status = "okay";
+};
+
+&hdmi_out {
+ hdmi_out_con: endpoint {
+ remote-endpoint = <&hdmi_con_in>;
+ };
+};
+
&hosc {
clock-frequency = <26000000>;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support
2026-11-30 2:07 [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Alastair D'Silva
` (12 preceding siblings ...)
2026-11-30 2:07 ` [RFC PATCH 13/13] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva
@ 2026-11-30 15:13 ` Jernej Škrabec
2026-11-30 21:18 ` Alastair D'Silva
13 siblings, 1 reply; 16+ messages in thread
From: Jernej Škrabec @ 2026-11-30 15:13 UTC (permalink / raw)
To: Chen-Yu Tsai, Samuel Holland, Maxime Ripard, Daniel Golle,
Alastair D'Silva
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Alastair D'Silva
Dne ponedeljek, 30. november 2026 ob 03:07:45 Srednjeevropski standardni čas je Alastair D'Silva napisal(a):
> This RFC series adds Allwinner A733 (sun60i-a733) HDMI display support:
> - DE3.5 RCQ DMA commit helper, planes, and mixer support
> - TCON TOP1 and TCON TV0 support with runtime PM
> - DW-HDMI 2.0 and TOP PHY support with system-control RESCAL calibration
> - Device tree bindings, SoC pipeline, and board HDMI enablement for
> Xunlong OrangePi 4 Pro, Radxa Cubie A7A, and Radxa Cubie A7Z
>
> I am posting this early as an RFC because Daniel Golle expressed
> interest in collaborating on A733 display support, and we want to do
> that work in the open. There is no rush for maintainer review while the
> existing A733 patch queue clears.
Stop. Just stop for a moment. This is getting ridiculous, with all the
patches you sent in a few days. Some of them v2, with possibly no human
reviewer saying any word. This is a good way to become ignored.
sun4i-drm driver for DE2 and onwards needs architecture fix in order to
clear up technical debt accumulated over the years, when we didn't know
better.
Throwing AI task to add support for newer hardware only adds technical
debt. It just adds new code while keeping original as-is as much as
possible. Such approach just makes spaghetti code which is getting worse
and worse.
I actually have patches prepared, but of course, wide testing needs a lot
of time. Every detail have to be checked, on DE2, DE3 and DE33 devices.
It's comming close to the end. And of course, it will be splitted into 4
series. Main fix is to program registers at the right time, avoiding all
glitches which can be triggered in some cases. With that in, you'll see
that RCQ support becomes just opmitization, not a requirement.
When this series become relevant, e.g. when all prerequisite patches are
actually merged, my arch fix will be long posted. At that time, you will have to
do just minor adjustments and new compatibles.
Jernej
>
> Tested on Xunlong OrangePi 4 Pro:
> - Cold-boot HDMI console (1920x1080)
> - X11 modesetting driver (/dev/dri/card0)
> - 60 Hz VSync page-flipping (modetest -v)
> - Multi-plane hardware overlays, alpha, zpos, and 10-bit RGB (AR30)
> - Dynamic mode switching (1920x1080, 1280x720, 1024x768)
>
> Radxa Cubie A7A and Cubie A7Z HDMI enablement is schema- and
> compile-tested only.
>
> Prerequisites (not yet merged in linux-next):
> [PATCH 0/3] arm64: dts: allwinner: Add Xunlong OrangePi 4 Pro support
> https://lore.kernel.org/r/20261125124407.4098345-1-alastair@d-silva.org
>
> [PATCH] pmdomain: sunxi: pck600: Initialize pd->pck in probe
> https://lore.kernel.org/r/20261127080625.1982574-1-alastair@d-silva.org
>
> [PATCH v2] arm64: dts: allwinner: sun60i-a733: Add PCK-600 power domain controller
> https://lore.kernel.org/r/20261130005242.3366676-1-alastair@d-silva.org
>
> Alastair D'Silva (13):
> dt-bindings: sram: sunxi: Add A733 system-control compatible
> dt-bindings: display: sun4i: Document A733 DE3.5 display pipeline
> dt-bindings: display: sun4i: Document A733 TCON TOP, TCON TV, and HDMI
> soc: sunxi: sram: Add A733 system-control RESCAL support
> drm/sun4i: Add A733 TCON TOP1 and TCON TV0 support
> drm/bridge: dw-hdmi: Export dw_hdmi_phy_enable_svsret()
> drm/sun4i: Add A733 DW-HDMI 2.0 and TOP PHY support
> drm/sun4i: Add A733 DE3.5 RCQ helper
> drm/sun4i: Add A733 DE3.5 planes and mixer support
> arm64: dts: allwinner: sun60i-a733: Add DE3.5 and HDMI display
> pipeline
> arm64: dts: allwinner: orangepi-4-pro: Enable HDMI output
> arm64: dts: allwinner: cubie-a7a: Enable HDMI output
> arm64: dts: allwinner: cubie-a7z: Enable HDMI output
>
> .../allwinner,sun4i-a10-display-engine.yaml | 1 +
> .../display/allwinner,sun4i-a10-tcon.yaml | 19 +
> .../allwinner,sun50i-h616-de33-planes.yaml | 13 +-
> .../allwinner,sun8i-a83t-de2-mixer.yaml | 46 ++-
> .../display/allwinner,sun8i-a83t-dw-hdmi.yaml | 142 +++++---
> .../allwinner,sun8i-a83t-hdmi-phy.yaml | 148 +++++---
> .../display/allwinner,sun8i-r40-tcon-top.yaml | 44 ++-
> .../allwinner,sun4i-a10-system-control.yaml | 1 +
> .../dts/allwinner/sun60i-a733-cubie-a7a.dts | 26 ++
> .../dts/allwinner/sun60i-a733-cubie-a7z.dts | 26 ++
> .../allwinner/sun60i-a733-orangepi-4-pro.dts | 32 ++
> .../arm64/boot/dts/allwinner/sun60i-a733.dtsi | 186 ++++++++++
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +-
> drivers/gpu/drm/sun4i/Makefile | 2 +-
> drivers/gpu/drm/sun4i/sun4i_drv.c | 10 +-
> drivers/gpu/drm/sun4i/sun4i_tcon.c | 74 +++-
> drivers/gpu/drm/sun4i/sun4i_tcon.h | 8 +
> drivers/gpu/drm/sun4i/sun50i_planes.c | 98 ++++--
> drivers/gpu/drm/sun4i/sun50i_planes.h | 5 +
> drivers/gpu/drm/sun4i/sun60i_de35_rcq.c | 220 ++++++++++++
> drivers/gpu/drm/sun4i/sun60i_de35_rcq.h | 44 +++
> drivers/gpu/drm/sun4i/sun8i_csc.c | 3 +-
> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 114 +++++-
> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 7 +
> drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 333 ++++++++++++++++++
> drivers/gpu/drm/sun4i/sun8i_mixer.c | 200 +++++++++--
> drivers/gpu/drm/sun4i/sun8i_mixer.h | 31 +-
> drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 61 +++-
> drivers/gpu/drm/sun4i/sun8i_tcon_top.h | 3 +
> drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 12 +-
> drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 6 +
> drivers/gpu/drm/sun4i/sun8i_vi_layer.h | 2 +
> drivers/gpu/drm/sun4i/sun8i_vi_scaler.c | 3 +-
> drivers/soc/sunxi/sunxi_sram.c | 18 +-
> include/drm/bridge/dw_hdmi.h | 2 +
> 35 files changed, 1736 insertions(+), 207 deletions(-)
> create mode 100644 drivers/gpu/drm/sun4i/sun60i_de35_rcq.c
> create mode 100644 drivers/gpu/drm/sun4i/sun60i_de35_rcq.h
>
>
> base-commit: 3ce19e522a53b81f208b340b30534515f7f12b9c
> prerequisite-patch-id: 309a5a3ca5b216915907263dea7024263abf1d1c
> prerequisite-patch-id: 55e543b9854c7ae2fa86969233d05ccadd3792e9
> prerequisite-patch-id: 4a4aed175e3d69b1962a9225cd0eb47cdad600fc
> prerequisite-patch-id: b302709123a938272f5ddc8f88e269c0ef3e7cf3
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support
2026-11-30 15:13 ` [RFC PATCH 00/13] drm/sun4i: Add Allwinner A733 DE3.5 and DW-HDMI 2.0 support Jernej Škrabec
@ 2026-11-30 21:18 ` Alastair D'Silva
0 siblings, 0 replies; 16+ messages in thread
From: Alastair D'Silva @ 2026-11-30 21:18 UTC (permalink / raw)
To: Jernej Škrabec, Chen-Yu Tsai, Samuel Holland, Maxime Ripard,
Daniel Golle
Cc: Andre Przywara, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
David Airlie, Simona Vetter, Maarten Lankhorst, Thomas Zimmermann,
Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
Luca Ceresoli, dri-devel, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel
On Mon, 2026-11-30 at 16:13 +0100, Jernej Škrabec wrote:
> Dne ponedeljek, 30. november 2026 ob 03:07:45 Srednjeevropski standardni čas je Alastair D'Silva
> napisal(a):
> > This RFC series adds Allwinner A733 (sun60i-a733) HDMI display support:
> > - DE3.5 RCQ DMA commit helper, planes, and mixer support
> > - TCON TOP1 and TCON TV0 support with runtime PM
> > - DW-HDMI 2.0 and TOP PHY support with system-control RESCAL calibration
> > - Device tree bindings, SoC pipeline, and board HDMI enablement for
> > Xunlong OrangePi 4 Pro, Radxa Cubie A7A, and Radxa Cubie A7Z
> >
> > I am posting this early as an RFC because Daniel Golle expressed
> > interest in collaborating on A733 display support, and we want to do
> > that work in the open. There is no rush for maintainer review while the
> > existing A733 patch queue clears.
>
> Stop. Just stop for a moment. This is getting ridiculous, with all the
> patches you sent in a few days. Some of them v2, with possibly no human
> reviewer saying any word. This is a good way to become ignored.
>
> sun4i-drm driver for DE2 and onwards needs architecture fix in order to
> clear up technical debt accumulated over the years, when we didn't know
> better.
>
> Throwing AI task to add support for newer hardware only adds technical
> debt. It just adds new code while keeping original as-is as much as
> possible. Such approach just makes spaghetti code which is getting worse
> and worse.
>
> I actually have patches prepared, but of course, wide testing needs a lot
> of time. Every detail have to be checked, on DE2, DE3 and DE33 devices.
> It's comming close to the end. And of course, it will be splitted into 4
> series. Main fix is to program registers at the right time, avoiding all
> glitches which can be triggered in some cases. With that in, you'll see
> that RCQ support becomes just opmitization, not a requirement.
>
> When this series become relevant, e.g. when all prerequisite patches are
> actually merged, my arch fix will be long posted. At that time, you will have to
> do just minor adjustments and new compatibles.
>
> Jernej
Ack, my apologies. I only posted (as RFC) because others expressed an interest
in it, and I wanted to keep development on-list.
I'm happy to help with the testing, I have the boards with the following
SoCs on hand:
Allwinner H3/DE2.0
Allwinner H618/DE2.0
Allwinner H5/DE3.3
Allwinner A733/DE3.5
Cheers,
--
Alastair D'Silva
>
^ permalink raw reply [flat|nested] 16+ messages in thread