arm64: dts: mediatek: mt8167: Add DRM nodes
Subsystems (2)
PATCH 1/1 arm64: dts: mediatek: mt8167: Add DRM nodes
Add all the DRM nodes required to get DSI and DPI to work on MT8167 SoC.
---
Since the DPI patches have been applied to CK Hu's -next branch, this patch is the sole leftover of the previous mt8167 display series [1]. I am resending it separately as it now contains an additional fix to the disp_pwm clocks that it took me months to figure out and was causing random missing display output.
arch/arm64/boot/dts/mediatek/mt8167.dtsi | 369 +++++++++++++++++++++++ 1 file changed, 369 insertions(+)
arch/arm64/boot/dts/mediatek/mt8167.dtsi +369 -0
@@ -16,6 +16,22 @@ / { compatible = "mediatek,mt8167"; + aliases { + aal0 = &aal; + ccorr0 = &ccorr; + color0 = &color; + dither0 = &dither; + dpi0 = &dpi0; + dpi1 = &dpi1; + dsi0 = &dsi; + gamma0 = γ + ovl0 = &ovl0; + pwm0 = &disp_pwm; + rdma0 = &rdma0; + rdma1 = &rdma1; + wdma0 = &wdma; + }; + soc { topckgen: topckgen@10000000 { compatible = "mediatek,mt8167-topckgen", "syscon";
@@ -120,10 +136,325 @@ iommu: m4u@10203000 { #iommu-cells = <1>; }; + disp_pwm: pwm@1100f000 { + compatible = "mediatek,mt8167-disp-pwm", "mediatek,mt8173-disp-pwm"; + reg = <0 0x1100f000 0 0x1000>; + clocks = <&topckgen CLK_TOP_PWM_MM>, <&mmsys CLK_MM_DISP_PWM_MM>; + clock-names = "main", "mm"; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + #pwm-cells = <2>; + status = "disabled"; + }; + mmsys: syscon@14000000 { compatible = "mediatek,mt8167-mmsys", "syscon"; reg = <0 0x14000000 0 0x1000>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; #clock-cells = <1>; + + port { + #address-cells = <1>; + #size-cells = <0>; + + mmsys_main: endpoint@0 { + reg = <0>; + remote-endpoint = <&ovl0_in>; + }; + + mmsys_ext: endpoint@1 { + reg = <1>; + remote-endpoint = <&rdma1_in>; + }; + }; + }; + + ovl0: ovl0@14007000 { + compatible = "mediatek,mt8167-disp-ovl"; + reg = <0 0x14007000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_OVL0>; + interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_OVL0>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ovl0_in: endpoint { + remote-endpoint = <&mmsys_main>; + }; + }; + + port@1 { + reg = <1>; + ovl0_out: endpoint { + remote-endpoint = <&color_in>; + }; + }; + }; + }; + + rdma0: rdma0@14009000 { + compatible = "mediatek,mt8167-disp-rdma", "mediatek,mt2701-disp-rdma"; + reg = <0 0x14009000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_RDMA0>; + interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_RDMA0>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rdma0_in: endpoint { + remote-endpoint = <&dither_out>; + }; + }; + + port@1 { + reg = <1>; + rdma0_out: endpoint { }; + }; + }; + }; + + rdma1: rdma1@1400a000 { + compatible = "mediatek,mt8167-disp-rdma", "mediatek,mt2701-disp-rdma"; + reg = <0 0x1400a000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_RDMA1>; + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_RDMA1>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rdma1_in: endpoint { + remote-endpoint = <&mmsys_ext>; + }; + }; + + port@1 { + reg = <1>; + rdma1_out: endpoint { }; + }; + }; + }; + + wdma: wdma0@1400b000 { + compatible = "mediatek,mt8167-disp-wdma", "mediatek,mt8173-disp-wdma"; + reg = <0 0x1400b000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_WDMA>; + interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_WDMA0>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + }; + + color: color@1400c000 { + compatible = "mediatek,mt8167-disp-color"; + reg = <0 0x1400c000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_COLOR>; + interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + color_in: endpoint { + remote-endpoint = <&ovl0_out>; + }; + }; + + port@1 { + reg = <1>; + color_out: endpoint { + remote-endpoint = <&ccorr_in>; + }; + }; + }; + }; + + ccorr: ccorr@1400d000 { + compatible = "mediatek,mt8167-disp-ccorr", "mediatek,mt8183-disp-ccorr"; + reg = <0 0x1400d000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_CCORR>; + interrupts = <GIC_SPI 166 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ccorr_in: endpoint { + remote-endpoint = <&color_out>; + }; + }; + + port@1 { + reg = <1>; + ccorr_out: endpoint { + remote-endpoint = <&aal_in>; + }; + }; + }; + }; + + aal: aal@1400e000 { + compatible = "mediatek,mt8167-disp-aal", "mediatek,mt8173-disp-aal"; + reg = <0 0x1400e000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_AAL>; + interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + aal_in: endpoint { + remote-endpoint = <&ccorr_out>; + }; + }; + + port@1 { + reg = <1>; + aal_out: endpoint { + remote-endpoint = <&gamma_in>; + }; + }; + }; + }; + + gamma: gamma@1400f000 { + compatible = "mediatek,mt8167-disp-gamma", "mediatek,mt8173-disp-gamma"; + reg = <0 0x1400f000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_GAMMA>; + interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + gamma_in: endpoint { + remote-endpoint = <&aal_out>; + }; + }; + + port@1 { + reg = <1>; + gamma_out: endpoint { + remote-endpoint = <&dither_in>; + }; + }; + }; + }; + + dither: dither@14010000 { + compatible = "mediatek,mt8167-disp-dither", "mediatek,mt8183-disp-dither"; + reg = <0 0x14010000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_DITHER>; + interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dither_in: endpoint { + remote-endpoint = <&gamma_out>; + }; + }; + + port@1 { + reg = <1>; + dither_out: endpoint { + remote-endpoint = <&rdma0_in>; + }; + }; + }; + }; + + dsi: dsi@14012000 { + compatible = "mediatek,mt8167-dsi"; + reg = <0 0x14012000 0 0x1000>; + clocks = <&mmsys CLK_MM_DSI_ENGINE>, <&mmsys CLK_MM_DSI_DIGITAL>, + <&mipi_tx>; + clock-names = "engine", "digital", "hs"; + interrupts = <GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>; + phys = <&mipi_tx>; + phy-names = "dphy"; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dsi_in: endpoint { }; + }; + + port@1 { + reg = <1>; + dsi_out: endpoint { }; + }; + }; + }; + + dpi0: dpi@14013000 { + compatible = "mediatek,mt8167-dpi"; + reg = <0 0x14013000 0 0x1000>; + clocks = <&mmsys CLK_MM_DPI0_PXL>, <&mmsys CLK_MM_DPI0_ENGINE>, + <&apmixedsys CLK_APMIXED_LVDSPLL>; + clock-names = "pixel", "engine", "pll"; + interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dpi0_in: endpoint { }; + }; + + port@1 { + reg = <1>; + dpi0_out: endpoint { }; + }; + }; + }; + + mutex: mutex@14015000 { + compatible = "mediatek,mt8167-disp-mutex"; + reg = <0 0x14015000 0 0x1000>; + interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; }; larb0: larb@14016000 {
@@ -145,6 +476,44 @@ smi_common: smi@14017000 { power-domains = <&spm MT8167_POWER_DOMAIN_MM>; }; + mipi_tx: dsi-phy@14018000 { + compatible = "mediatek,mt8167-mipi-tx", "mediatek,mt2701-mipi-tx"; + reg = <0 0x14018000 0 0x90>; + clocks = <&topckgen CLK_TOP_MIPI_26M_DBG>; + clock-output-names = "mipi_tx0_pll"; + #clock-cells = <0>; + #phy-cells = <0>; + status = "disabled"; + }; + + dpi1: dpi1@14019000 { + compatible = "mediatek,mt8167-dpi"; + reg = <0 0x14019000 0 0x1000>; + clocks = <&mmsys CLK_MM_DPI1_PXL>, <&mmsys CLK_MM_DPI1_ENGINE>, + <&apmixedsys CLK_APMIXED_TVDPLL>; + clock-names = "pixel", "engine", "pll"; + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dpi1_in: endpoint { }; + }; + + port@1 { + reg = <1>; + + dpi1_out: endpoint { }; + }; + }; + }; + imgsys: syscon@15000000 { compatible = "mediatek,mt8167-imgsys", "syscon"; reg = <0 0x15000000 0 0x1000>;
Signature · 1 line
2.43.0
Quoted 26 lines · Luca Leonardo Scorcia
Add all the DRM nodes required to get DSI and DPI to work on MT8167 SoC.
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>---
Since the DPI patches have been applied to CK Hu's -next branch, this patch is the sole leftover of the previous mt8167 display series [1]. I am resending it separately as it now contains an additional fix to thedisp_pwmclocks that it took me months to figure out and was causing random missing display output.arch/arm64/boot/dts/mediatek/mt8167.dtsi | 369 +++++++++++++++++++++++ 1 file changed, 369 insertions(+)arch/arm64/boot/dts/mediatek/mt8167.dtsi +4
-0@@ -16,6 +16,22 @@ / { compatible = "mediatek,mt8167"; + aliases { + aal0 = &aal; + ccorr0 = &ccorr; + color0 = &color;
arch/arm64/boot/dts/mediatek/mt8167.dtsi line 32
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +10
-0+ dither0 = &dither; + dpi0 = &dpi0; + dpi1 = &dpi1; + dsi0 = &dsi; + gamma0 = γ + ovl0 = &ovl0; + pwm0 = &disp_pwm; + rdma0 = &rdma0; + rdma1 = &rdma1; + wdma0 = &wdma;
You do not get own aliases. Where are these documented (and approved)?
Best regards,
Krzysztof
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] arm64: dts: mediatek: mt8167: missing reg = <1> on rdma1 endpoints breaks CRTC_EXT - [Medium] arm64…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] arm64: dts: mediatek: mt8167: missing reg = <1> on rdma1 endpoints breaks CRTC_EXT
- [Medium] arm64: dts: mediatek: mt8167: undocumented mediatek,mt8167-dpi compatible
- [Medium] arm64: dts: mediatek: mt8167: unconnected rdma0_out breaks mtk_drm_probe()
- [Low] arm64: dts: mediatek: mt8167: non-generic display node names with indices
--
commit 550fb79e6d290ccbb35fb88f6c76ac7ea3a27e5b
Author: Luca Leonardo Scorcia <[email protected]>
arm64: dts: mediatek: mt8167: Add DRM nodes
This commit adds the devicetree nodes and aliases for the display subsystem on the MediaTek MT8167 SoC.
Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +0
-0
[ ... ]
Quoted 1 line
arch/arm64/boot/dts/mediatek/mt8167.dtsi +0
-0@@ -120,10 +136,325 @@ iommu: m4u@10203000 {
[ ... ]
Quoted 13 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +9
-0mmsys: syscon@14000000 { compatible = "mediatek,mt8167-mmsys", "syscon"; reg = <0 0x14000000 0 0x1000>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; #clock-cells = <1>; + + port { + #address-cells = <1>; + #size-cells = <0>; + + mmsys_main: endpoint@0 { + reg = <0>; + remote-endpoint = <&ovl0_in>;
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 171
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +10
-0+ }; + + mmsys_ext: endpoint@1 { + reg = <1>; + remote-endpoint = <&rdma1_in>; + }; + }; + }; + + ovl0: ovl0@14007000 {
[Severity: Low]
This isn't a bug, but ovl0@14007000, rdma0@14009000, rdma1@1400a000, wdma0@1400b000, and dpi1@14019000 include instance numbers in their node names. Should these use generic node names without trailing indices (ovl@14007000, rdma@14009000, rdma@1400a000, wdma@1400b000, and dpi@14019000) to match dpi0 (dpi@14013000), the MediaTek display bindings, and other MediaTek devicetrees?
[ ... ]
Quoted 15 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +15
-0+ rdma0: rdma0@14009000 { + compatible = "mediatek,mt8167-disp-rdma", "mediatek,mt2701-disp-rdma"; + reg = <0 0x14009000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_RDMA0>; + interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_RDMA0>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rdma0_in: endpoint {
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 223
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +10
-0+ remote-endpoint = <&dither_out>; + }; + }; + + port@1 { + reg = <1>; + rdma0_out: endpoint { }; + }; + }; + };
[Severity: Medium]
Does leaving the main pipeline (ovl0 through rdma0) enabled while rdma0_out has no remote-endpoint cause mtk_drm_probe() to fail on boards that do not connect rdma0_out?
When mtk_drm_of_ddp_path_build_one() walks the main pipeline from mmsys_main, it reaches rdma0_out, where of_graph_get_remote_port_parent() returns null and mtk_drm_of_get_ddp_ep_cid() fails with an invalid-argument error instead of a no-such-device error:
drivers/gpu/drm/mediatek/mtk_drm_drv.c:mtk_drm_of_ddp_path_build_one() {
...
if (ret == -ENODEV)
return ret;
/* If the last entry is not a final display output, the configuration is wrong */
switch (temp_path[idx - 1]) {
case DDP_COMPONENT_DP_INTF0:
case DDP_COMPONENT_DP_INTF1:
case DDP_COMPONENT_DPI0:
case DDP_COMPONENT_DPI1:
case DDP_COMPONENT_DSI0:
case DDP_COMPONENT_DSI1:
case DDP_COMPONENT_DSI2:
case DDP_COMPONENT_DSI3:
break;
default:
dev_err(dev, "Invalid display hw pipeline. Last component: %d (ret=%d)\n",
temp_path[idx - 1], ret);
return -EINVAL;
}
}Because rdma0 is not a final display output, mtk_drm_of_ddp_path_build() aborts mtk_drm_probe() with an error on boards without a main display (such as mt8167-pumpkin.dts) and before evaluating the external pipeline on boards that only use rdma1.
Quoted 17 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +17
-0+ + rdma1: rdma1@1400a000 { + compatible = "mediatek,mt8167-disp-rdma", "mediatek,mt2701-disp-rdma"; + reg = <0 0x1400a000 0 0x1000>; + clocks = <&mmsys CLK_MM_DISP_RDMA1>; + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_DISP_RDMA1>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rdma1_in: endpoint {
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 250
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +10
-0+ remote-endpoint = <&mmsys_ext>; + }; + }; + + port@1 { + reg = <1>; + rdma1_out: endpoint { }; + }; + }; + };
[Severity: High]
Does omitting reg = <1> on the rdma1 endpoints break the external display pipeline whenever rdma1 is enabled?
mmsys_ext has reg = <1>, so mtk_drm_of_ddp_path_build() builds that path with crtc_path set to 1. When mtk_drm_of_ddp_path_build_one() steps from rdma1 to its output port, mtk_drm_of_get_ddp_ep_cid() looks up the endpoint whose reg matches crtc_path:
drivers/gpu/drm/mediatek/mtk_drm_drv.c:mtk_drm_of_get_ddp_ep_cid() {
...
ep_out = of_graph_get_endpoint_by_regs(node, output_port, crtc_path);
if (!ep_out)
return -ENOENT;
}Because rdma1_out has no reg property, its endpoint id defaults to 0, so of_graph_get_endpoint_by_regs(rdma1, 1, 1) returns null and mtk_drm_of_ddp_path_build_one() fails with an invalid pipeline error. Adding #address-cells = <1> and #size-cells = <0> to port@0 and port@1 and using endpoint@1 with reg = <1> on rdma1_in and rdma1_out (as in mt8365.dtsi and mt8183.dtsi) would allow the driver to follow the external path.
[ ... ]
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 435
Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +9
-0+ dpi0: dpi@14013000 { + compatible = "mediatek,mt8167-dpi"; + reg = <0 0x14013000 0 0x1000>; + clocks = <&mmsys CLK_MM_DPI0_PXL>, <&mmsys CLK_MM_DPI0_ENGINE>, + <&apmixedsys CLK_APMIXED_LVDSPLL>; + clock-names = "pixel", "engine", "pll"; + interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>; + power-domains = <&spm MT8167_POWER_DOMAIN_MM>; + status = "disabled";
[Severity: Medium]
Is "mediatek,mt8167-dpi" missing from the devicetree bindings and MediaTek drm driver in this tree, or should dpi0 and dpi1 include a fallback compatible?
Without a matching entry in Documentation/devicetree/bindings/display/ mediatek/mediatek,dpi.yaml, mtk_dpi_of_ids, and mtk_ddp_comp_dt_ids, dtbs_check fails on both nodes and mtk_drm_of_get_ddp_comp_type() rejects the pipeline when either dpi node is enabled.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1