Add support for the mt8167 display pipeline
Subsystems (5)
v2 cover Add support for the mt8167 display pipeline
This series adds support for (almost) all display blocks of mt8167. This SoC supports a DSI or DPI display and has HDMI output via a second DPI block wired to the HDMI phy.
All the hard work was already upstreamed in the past, now all that's left is some glue. In the first two patches we add support for the DPI output blocks. In the third one we describe all the possible combinations of the SoC display pipeline and in the last one we add the required nodes to the SoC dtsi.
The final outputs of the display pipeline in the SoC dtsi are intentionally left not connected to allow board dts to specify their own output node.
I said almost all display blocks because HDMI output is not included in this patch. I have it tested and working at all supported resolutions, but since it needs some fixes in clocks and a new phy driver, I will send it in a separate series.
The series has been tested on a Lenovo Smart Clock 2 (DSI), a Xiaomi Mi Smart Clock 2 (DSI), and a Sony Playstation Classic Mini (HDMI via DPI). Unfortunately I couldn't find an actual device using a DPI display, but since DPI1-HDMI works, I feel confident saying that the clocks divisors are correct.
Changes in v2:
- Fixed some copy-and-paste error in MMSYS routes spotted by Sashiko [2].
Initial version: [1]
[1] https://lore.kernel.org/linux-mediatek/[email protected]/
[2] https://sashiko.dev/#/message/20260918180358.81A1D1F000FF%40smtp.kernel.org
Luca Leonardo Scorcia (4):
dt-bindings: display: mediatek: dpi: Add compatible for mt8167 drm/mediatek: Add support for mt8167 Digital Parallel Interface
soc: mediatek: mt8167-mmsys: add routes for all display paths
arm64: dts: mediatek: mt8167: Add DRM nodes
.../display/mediatek/mediatek,dpi.yaml | 1 + arch/arm64/boot/dts/mediatek/mt8167.dtsi | 369 ++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dpi.c | 23 ++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 + drivers/soc/mediatek/mt8167-mmsys.h | 193 ++++++++- 5 files changed, 579 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/4 dt-bindings: display: mediatek: dpi: Add compatible for mt8167
MediaTek mt8167 SoC has two Digital Parallel Interface (DPI) blocks, one can be routed to a DPI display while the other is wired to the HDMI block. They are not compatible with any other device, so add a new compatible to describe them in the device tree.
--- .../devicetree/bindings/display/mediatek/mediatek,dpi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml +1 -0
@@ -21,6 +21,7 @@ properties: - enum: - mediatek,mt2701-dpi - mediatek,mt7623-dpi + - mediatek,mt8167-dpi - mediatek,mt8173-dpi - mediatek,mt8183-dpi - mediatek,mt8186-dpi
Signature · 1 line
2.43.0
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
Quoted 10 lines · Luca Leonardo Scorcia
MediaTek mt8167 SoC has two Digital Parallel Interface (DPI) blocks, one can be routed to a DPI display while the other is wired to the HDMI block. They are not compatible with any other device, so add a new compatible to describe them in the device tree.
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,dpi.yaml | 1 + 1 file changed, 1 insertion(+)
Best regards,
Krzysztof
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Luca Leonardo Scorcia
MediaTek mt8167 SoC has two Digital Parallel Interface (DPI) blocks, one can be routed to a DPI display while the other is wired to the HDMI block. They are not compatible with any other device, so add a new compatible to describe them in the device tree.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,dpi.yaml | 1 + 1 file changed, 1 insertion(+)
And un-acked. Undocumented ABI.
Best regards,
Krzysztof
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
In reply to Luca Leonardo ScorciaLuca Leonardo Scorcia <[email protected]> 於 2026年9月21日週一 上午11:39寫道:
Quoted 5 lines
MediaTek mt8167 SoC has two Digital Parallel Interface (DPI) blocks, one can be routed to a DPI display while the other is wired to the HDMI block. They are not compatible with any other device, so add a new compatible to describe them in the device tree.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 4 lines
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>---
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
In reply to Luca Leonardo ScorciaQuoted 16 lines · Luca Leonardo Scorcia
MediaTek mt8167 SoC has two Digital Parallel Interface (DPI) blocks, one can be routed to a DPI display while the other is wired to the HDMI block. They are not compatible with any other device, so add a new compatible to describe them in the device tree.
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,dpi.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml +0
-0
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml properties: · line 24
Quoted 4 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml +1
-0@@ -21,6 +21,7 @@ properties: - enum: - mediatek,mt2701-dpi - mediatek,mt7623-dpi + - mediatek,mt8167-dpi
Turns out you bring here undocumented ABI. NAK.
Best regards,
Krzysztof
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
Quoted 1 line
Turns out you bring here undocumented ABI. NAK.
Hi, I'm sorry but I don't see the relation between this commit you just NAKed and the bigger issue about mediatek-drm alias usage. It's not like I'm introducing anything new in these DPI specific patches and the individual display block drivers do not depend on the aliases (they're used by mediatek-drm for building the pipeline).
I understand why the commit to the dtsi that includes the aliases is NAKed, and the eventual fix is going to require a change in all of Mediatek SoCs dtsi. I am fine with the dtsi changes being blocked until an appropriate solution is found. I just don't understand the NAKs on the DPI components.
Thank you for your help
--
Luca Leonardo Scorcia
[email protected]
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
Quoted 7 lines · Luca Leonardo Scorcia
Quoted 1 line
Turns out you bring here undocumented ABI. NAK.
Hi, I'm sorry but I don't see the relation between this commit you just NAKed and the bigger issue about mediatek-drm alias usage. It's not like I'm introducing anything new in these DPI specific patches and the individual display block drivers do not depend on the aliases (they're used by mediatek-drm for building the pipeline).
To clarify: you do introduce a new compatible here and in the DTS. Here it is documented. This is correct.
However your DTS introduces also new usage of the ABI - aliases - and that part is not documented. New DTS cannot use undocumented ABI. This means that the binding was not complete. There is a mismatch or missing pieces between the binding and DTS.
Quoted 6 lines
I understand why the commit to the dtsi that includes the aliases is NAKed, and the eventual fix is going to require a change in all of Mediatek SoCs dtsi. I am fine with the dtsi changes being blocked until an appropriate solution is found. I just don't understand the NAKs on the DPI components.
Because this binding in relation to your DTS is incomplete. Of course if you drop the aliases from your DTS and this will be your final and working solution (bindings and DTS should be complete) then this NAK is not relevant and can be ignored. But in current form your bindings are incomplete and DTS after correcting won't work...
Best regards,
Krzysztof
Re: [PATCH v2 1/4] dt-bindings: display: mediatek: dpi: Add compatible for mt8167
Quoted 1 line
bindings and DTS should be complete
Thank you for your patience, I understand now.
According to the current mediatek-drm code, aliases are not really required unless there's multiple instances of the same block type [1]. On mt8167 this only happens for the dpi1 block and the rdma1 block. It should be possible to introduce main display support without the aliases with a couple of changes:
- rdma1 drives the secondary display pipeline; it can be omitted from the DTS while still having the primary display pipeline work;
- dpi1 is used to drive HDMI output (not upstreamed yet). I can omit it from the DTS for now, adding only the dpi0 node.
With this approach the DPI bindings would remain as submitted. Once an appropriate mechanism to describe the blocks' indexing is in place those two nodes can be reintroduced without having to change any other component.
I have done a quick test on my devices and the approach seems to work.
Please let me know if you can see any issue with this idea, meanwhile I'll run more rigorous device and DT tests.
Thank you for your help
--
Luca
PATCH v2 2/4 drm/mediatek: Add support for mt8167 Digital Parallel Interface
In reply to Luca Leonardo ScorciaAdd support for the two DPI blocks found in the mt8167 SoCs. One of them can be routed to a DPI connector and another is directly connected to the HDMI IP.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ 2 files changed, 25 insertions(+)
drivers/gpu/drm/mediatek/mtk_dpi.c +23 -0
@@ -1114,6 +1114,10 @@ static const struct mtk_dpi_factor dpi_factor_mt2701[] = { { 64000, 4 }, { 128000, 2 }, { U32_MAX, 1 } }; +static const struct mtk_dpi_factor dpi_factor_mt8167[] = { + {64000 ,16 }, {74250 ,8 }, {160000 ,4 }, {U32_MAX ,2 } +}; +static const struct mtk_dpi_factor dpi_factor_mt8173[] = { {27000 ,48 }, {84000 ,24 }, {167000 ,12 }, {U32_MAX ,6 } };
@@ -1163,6 +1167,24 @@ static const struct mtk_dpi_conf mt2701_conf = { .csc_enable_bit = CSC_ENABLE, }; +static const struct mtk_dpi_conf mt8167_conf = { + .dpi_factor = dpi_factor_mt8167, + .num_dpi_factor =ARRAY_SIZE (dpi_factor_mt8167), + .reg_h_fre_con =0xe0 , + .max_clock_khz =150000 , + .output_fmts = mt8173_output_fmts, + .num_output_fmts =ARRAY_SIZE (mt8173_output_fmts), + .pixels_per_iter =1 , + .is_ck_de_pol = true, + .swap_input_support = true, + .support_direct_pin = true, + .dimension_mask =HPW_MASK , + .hvsize_mask =HSIZE_MASK , + .channel_swap_shift =CH_SWAP , + .yuv422_en_bit =YUV422_EN , + .csc_enable_bit =CSC_ENABLE , +}; +static const struct mtk_dpi_conf mt8183_conf = { .dpi_factor = dpi_factor_mt8183, .num_dpi_factor =ARRAY_SIZE (dpi_factor_mt8183),
@@ -1342,6 +1364,7 @@ static void mtk_dpi_remove(struct platform_device *pdev)static const struct of_device_id mtk_dpi_of_ids[] = { { .compatible ="mediatek,mt2701-dpi" , .data = &mt2701_conf }, + { .compatible ="mediatek,mt8167-dpi" , .data = &mt8167_conf }, { .compatible ="mediatek,mt8173-dpi" , .data = &mt8173_conf }, { .compatible ="mediatek,mt8183-dpi" , .data = &mt8183_conf }, { .compatible ="mediatek,mt8186-dpi" , .data = &mt8186_conf },
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -802,6 +802,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt8167-dsi", .data = (void *)MTK_DSI }, + { .compatible = "mediatek,mt8167-dpi", + .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt8173-dpi", .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt8183-dpi",
Signature · 1 line
2.43.0
Re: [PATCH v2 2/4] drm/mediatek: Add support for mt8167 Digital Parallel Interface
Luca Leonardo Scorcia <[email protected]> 於 2026年9月21日週一 上午11:39寫道:
Quoted 4 lines
Add support for the two DPI blocks found in the mt8167 SoCs. One of them can be routed to a DPI connector and another is directly connected to the HDMI IP.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 4 lines
Signed-off-by Luca Leonardo Scorcia <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>---
PATCH v2 3/4 soc: mediatek: mt8167-mmsys: add routes for all display paths
In reply to Luca Leonardo Scorciamt8167 display output pipeline can be configured in many different ways. Add support for additional routes according to the SoC data sheet and Android sources. There's a few inconsistencies between those two, but assume the Android sources are correct since they are required to drive HDMI output via DPI1.
--- drivers/soc/mediatek/mt8167-mmsys.h | 193 ++++++++++++++++++++++++++-- 1 file changed, 184 insertions(+), 9 deletions(-)
drivers/soc/mediatek/mt8167-mmsys.h +184 -9
@@ -5,35 +5,210 @@#define MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN 0x030#define MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN 0x038 +#define MT8167_DISP_REG_CONFIG_DISP_UFOE_MOUT_EN 0x03c#define MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x058 +#define MT8167_DISP_REG_CONFIG_DISP_WDMA0_SEL_IN 0x05c +#define MT8167_DISP_REG_CONFIG_DISP_UFOE_SEL_IN 0x060#define MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN 0x064 +#define MT8167_DISP_REG_CONFIG_DISP_DPI0_SEL_IN 0x068#define MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN 0x06c +#define MT8167_DISP_REG_CONFIG_DISP_RDMA1_SOUT_SEL_IN 0x070 +#define MT8167_DISP_REG_CONFIG_DISP_DPI1_SEL_IN 0x074 + +#define MT8167_OVL0_MOUT_EN_COLOR0 0x1 +#define MT8167_OVL0_MOUT_EN_WDMA0 0x2 +#define MT8167_OVL0_MOUT_EN_MASK 0x3#define MT8167_DITHER_MOUT_EN_RDMA0 0x1 +#define MT8167_DITHER_MOUT_EN_UFOE 0x2 +#define MT8167_DITHER_MOUT_EN_WDMA0 0x4#define MT8167_DITHER_MOUT_EN_MASK 0x7 -#define MT8167_RDMA0_SOUT_DSI0 0x2 -#define MT8167_RDMA0_SOUT_MASK 0x3 +#define MT8167_UFOE_MOUT_EN_DSI0 0x1 +#define MT8167_UFOE_MOUT_EN_DPI0 0x2 +/* +* For some reason Android sources and the data sheet don't agree here, +* the data sheet has UFOE_MOUT_EN_WDMA0 as 0x4 and does not mention DPI1. +*/ +#define MT8167_UFOE_MOUT_EN_DPI1 0x4 +#define MT8167_UFOE_MOUT_EN_WDMA0 0x8 +#define MT8167_UFOE_MOUT_EN_MASK 0xF + +#define MT8167_COLOR0_SEL_IN_RDMA0 0x0 +#define MT8167_COLOR0_SEL_IN_OVL0 0x1 +#define MT8167_COLOR0_SEL_IN_MASK 0x1 + +#define MT8167_WDMA0_SEL_IN_OVL0 0x0 +#define MT8167_WDMA0_SEL_IN_DITHER 0x1 +#define MT8167_WDMA0_SEL_IN_UFOE 0x2 +#define MT8167_WDMA0_SEL_IN_MASK 0x3 + +#define MT8167_UFOE_SEL_IN_RDMA0 0x0 +#define MT8167_UFOE_SEL_IN_DITHER 0x1 +#define MT8167_UFOE_SEL_IN_MASK 0x1 +#define MT8167_DSI0_SEL_IN_UFOE 0x0#define MT8167_DSI0_SEL_IN_RDMA0 0x1 +#define MT8167_DSI0_SEL_IN_RDMA1 0x2#define MT8167_DSI0_SEL_IN_MASK 0x3 +#define MT8167_DPI0_SEL_IN_UFOE 0x0 +#define MT8167_DPI0_SEL_IN_RDMA0 0x1 +#define MT8167_DPI0_SEL_IN_RDMA1 0x2 +#define MT8167_DPI0_SEL_IN_MASK 0x3 + +#define MT8167_DPI1_SEL_IN_UFOE 0x0 +#define MT8167_DPI1_SEL_IN_RDMA0 0x1 +#define MT8167_DPI1_SEL_IN_RDMA1 0x2 +#define MT8167_DPI1_SEL_IN_MASK 0x3 + +#define MT8167_RDMA0_SOUT_UFOE 0x0 +#define MT8167_RDMA0_SOUT_COLOR0 0x1 +#define MT8167_RDMA0_SOUT_DSI0 0x2 +#define MT8167_RDMA0_SOUT_DPI0 0x3 +/* DPI1 is only defined in Android sources, not in the data sheet */ +#define MT8167_RDMA0_SOUT_DPI1 0x4 +#define MT8167_RDMA0_SOUT_MASK 0x7 + +#define MT8167_RDMA1_SOUT_DSI0 0x0 +#define MT8167_RDMA1_SOUT_DPI0 0x1 +/* DPI1 is only defined in Android sources, not in the data sheet */ +#define MT8167_RDMA1_SOUT_DPI1 0x2 +#define MT8167_RDMA1_SOUT_MASK 0x3 +static const struct mtk_mmsys_routes mt8167_mmsys_routing_table[] = { +/* OVL0<->COLOR0 */ MMSYS_ROUTE (OVL ,0 ,COLOR ,0 , -MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,OVL0_MOUT_EN_COLOR0 , -OVL0_MOUT_EN_COLOR0 ), +MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,MT8167_OVL0_MOUT_EN_MASK , +MT8167_OVL0_MOUT_EN_COLOR0 ), +MMSYS_ROUTE (OVL ,0 ,COLOR ,0 , +MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN ,MT8167_COLOR0_SEL_IN_MASK , +MT8167_COLOR0_SEL_IN_OVL0 ), + +/* OVL0<->WDMA0 */ +MMSYS_ROUTE (OVL ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,MT8167_OVL0_MOUT_EN_MASK , +MT8167_OVL0_MOUT_EN_WDMA0 ), +MMSYS_ROUTE (OVL ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_WDMA0_SEL_IN ,MT8167_WDMA0_SEL_IN_MASK , +MT8167_WDMA0_SEL_IN_OVL0 ), + +/* DITHER0 output to RDMA */ MMSYS_ROUTE (DITHER ,0 ,RDMA ,0 ,MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK ,MT8167_DITHER_MOUT_EN_RDMA0 ), -MMSYS_ROUTE (OVL ,0 ,COLOR ,0 , -MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN ,COLOR0_SEL_IN_OVL0 , -COLOR0_SEL_IN_OVL0 ), -MMSYS_ROUTE (RDMA ,0 ,DSI ,0 , + +/* DITHER<->UFOE */ +MMSYS_ROUTE (DITHER ,0 ,UFOE ,0 , +MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , +MT8167_DITHER_MOUT_EN_UFOE ), +MMSYS_ROUTE (DITHER ,0 ,UFOE ,0 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_SEL_IN ,MT8167_UFOE_SEL_IN_MASK , +MT8167_UFOE_SEL_IN_DITHER ), + +/* DITHER<->WDMA */ +MMSYS_ROUTE (DITHER ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , +MT8167_DITHER_MOUT_EN_WDMA0 ), +MMSYS_ROUTE (DITHER ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_WDMA0_SEL_IN ,MT8167_WDMA0_SEL_IN_MASK , +MT8167_WDMA0_SEL_IN_DITHER ), + +/* UFOE<->DSI0 */ +MMSYS_ROUTE (UFOE ,0 ,DSI ,0 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_MOUT_EN ,MT8167_UFOE_MOUT_EN_MASK , +MT8167_UFOE_MOUT_EN_DSI0 ), +MMSYS_ROUTE (UFOE ,0 ,DSI ,0 ,MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN ,MT8167_DSI0_SEL_IN_MASK , -MT8167_DSI0_SEL_IN_RDMA0 ), +MT8167_DSI0_SEL_IN_UFOE ), + +/* UFOE<->DPI0 */ +MMSYS_ROUTE (UFOE ,0 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_MOUT_EN ,MT8167_UFOE_MOUT_EN_MASK , +MT8167_UFOE_MOUT_EN_DPI0 ), +MMSYS_ROUTE (UFOE ,0 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DPI0_SEL_IN ,MT8167_DPI0_SEL_IN_MASK , +MT8167_DPI0_SEL_IN_UFOE ), + +/* UFOE<->DPI1 */ +MMSYS_ROUTE (UFOE ,0 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_MOUT_EN ,MT8167_UFOE_MOUT_EN_MASK , +MT8167_UFOE_MOUT_EN_DPI1 ), +MMSYS_ROUTE (UFOE ,0 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_DPI1_SEL_IN ,MT8167_DPI1_SEL_IN_MASK , +MT8167_DPI1_SEL_IN_UFOE ), + +/* UFOE<->WDMA0 */ +MMSYS_ROUTE (UFOE ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_MOUT_EN ,MT8167_UFOE_MOUT_EN_MASK , +MT8167_UFOE_MOUT_EN_WDMA0 ), +MMSYS_ROUTE (UFOE ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_WDMA0_SEL_IN ,MT8167_WDMA0_SEL_IN_MASK , +MT8167_WDMA0_SEL_IN_UFOE ), + +/* RDMA0<->UFOE */ +MMSYS_ROUTE (RDMA ,0 ,UFOE ,0 , +MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN ,MT8167_RDMA0_SOUT_MASK , +MT8167_RDMA0_SOUT_UFOE ), +MMSYS_ROUTE (RDMA ,0 ,UFOE ,0 , +MT8167_DISP_REG_CONFIG_DISP_UFOE_SEL_IN ,MT8167_UFOE_SEL_IN_MASK , +MT8167_UFOE_SEL_IN_RDMA0 ), + +/* RDMA0->COLOR0 */ +MMSYS_ROUTE (RDMA ,0 ,COLOR ,0 , +MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN ,MT8167_RDMA0_SOUT_MASK , +MT8167_RDMA0_SOUT_COLOR0 ), +MMSYS_ROUTE (RDMA ,0 ,COLOR ,0 , +MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN ,MT8167_COLOR0_SEL_IN_MASK , +MT8167_COLOR0_SEL_IN_RDMA0 ), + +/* RDMA0<->DSI0 */ MMSYS_ROUTE (RDMA ,0 ,DSI ,0 ,MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN ,MT8167_RDMA0_SOUT_MASK ,MT8167_RDMA0_SOUT_DSI0 ), +MMSYS_ROUTE (RDMA ,0 ,DSI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN ,MT8167_DSI0_SEL_IN_MASK , +MT8167_DSI0_SEL_IN_RDMA0 ), + +/* RDMA0<->DPI0 */ +MMSYS_ROUTE (RDMA ,0 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN ,MT8167_RDMA0_SOUT_MASK , +MT8167_RDMA0_SOUT_DPI0 ), +MMSYS_ROUTE (RDMA ,0 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DPI0_SEL_IN ,MT8167_DPI0_SEL_IN_MASK , +MT8167_DPI0_SEL_IN_RDMA0 ), + +/* RDMA0<->DPI1 */ +MMSYS_ROUTE (RDMA ,0 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_RDMA0_SOUT_SEL_IN ,MT8167_RDMA0_SOUT_MASK , +MT8167_RDMA0_SOUT_DPI1 ), +MMSYS_ROUTE (RDMA ,0 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_DPI1_SEL_IN ,MT8167_DPI1_SEL_IN_MASK , +MT8167_DPI1_SEL_IN_RDMA0 ), + +/* RDMA1<->DSI0 */ +MMSYS_ROUTE (RDMA ,1 ,DSI ,0 , +MT8167_DISP_REG_CONFIG_DISP_RDMA1_SOUT_SEL_IN ,MT8167_RDMA1_SOUT_MASK , +MT8167_RDMA1_SOUT_DSI0 ), +MMSYS_ROUTE (RDMA ,1 ,DSI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN ,MT8167_DSI0_SEL_IN_MASK , +MT8167_DSI0_SEL_IN_RDMA1 ), + +/* RDMA1<->DPI0 */ +MMSYS_ROUTE (RDMA ,1 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_RDMA1_SOUT_SEL_IN ,MT8167_RDMA1_SOUT_MASK , +MT8167_RDMA1_SOUT_DPI0 ), +MMSYS_ROUTE (RDMA ,1 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DPI0_SEL_IN ,MT8167_DPI0_SEL_IN_MASK , +MT8167_DPI0_SEL_IN_RDMA1 ), + +/* RDMA1<->DPI1 */ +MMSYS_ROUTE (RDMA ,1 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_RDMA1_SOUT_SEL_IN ,MT8167_RDMA1_SOUT_MASK , +MT8167_RDMA1_SOUT_DPI1 ), +MMSYS_ROUTE (RDMA ,1 ,DPI ,1 , +MT8167_DISP_REG_CONFIG_DISP_DPI1_SEL_IN ,MT8167_DPI1_SEL_IN_MASK , +MT8167_DPI1_SEL_IN_RDMA1 ), };#endif /* __SOC_MEDIATEK_MT8167_MMSYS_H */
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v2 3/4] soc: mediatek: mt8167-mmsys: add routes for all display paths
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] mmsys: concurrent MOUT outputs broken by full bitmasks --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mmsys: concurrent MOUT outputs broken by full bitmasks
--
commit 8ae801c4ff167fb410aace262b9f0eef4667f2c9
Author: Luca Leonardo Scorcia <[email protected]>
soc: mediatek: mt8167-mmsys: add routes for all display paths
This commit adds support for additional routes according to the SoC data sheet and Android sources. It redefines existing routing table entries to use full masks and adds new concurrent display output configurations.
Quoted 4 lines
drivers/soc/mediatek/mt8167-mmsys.h +0
-0
[ ... ]
drivers/soc/mediatek/mt8167-mmsys.h line 83
Quoted 9 lines
drivers/soc/mediatek/mt8167-mmsys.h +3
-2@@ -34,16 +78,162 @@static const struct mtk_mmsys_routes mt8167_mmsys_routing_table[] = { +/* OVL0<->COLOR0 */ MMSYS_ROUTE (OVL ,0 ,COLOR ,0 , -MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,OVL0_MOUT_EN_COLOR0 , -OVL0_MOUT_EN_COLOR0 ), +MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,MT8167_OVL0_MOUT_EN_MASK , +MT8167_OVL0_MOUT_EN_COLOR0 ),
[Severity: High]
Does changing this mask to the full MT8167_OVL0_MOUT_EN_MASK inadvertently introduce a regression for concurrent multi-output pipelines?
Looking at mtk_mmsys_ddp_disconnect(), it performs a read-modify-write operation on the register using (tmp & ~mask) | (val & mask). When disconnecting a route, val is 0, so the register is masked with ~mask.
By using the full bitfield mask instead of the individual bit mask, does disconnecting one route clear the enable bits for all other active concurrent paths originating from the same block?
drivers/soc/mediatek/mt8167-mmsys.h line 91
Quoted 8 lines
drivers/soc/mediatek/mt8167-mmsys.h +8
-0+MMSYS_ROUTE (OVL ,0 ,COLOR ,0 , +MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN ,MT8167_COLOR0_SEL_IN_MASK , +MT8167_COLOR0_SEL_IN_OVL0 ), + +/* OVL0<->WDMA0 */ +MMSYS_ROUTE (OVL ,0 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN ,MT8167_OVL0_MOUT_EN_MASK , + MT8167_OVL0_MOUT_EN_WDMA0),
[Severity: High]
For example, if the OVL0-to-WDMA0 route is active alongside OVL0-to-COLOR0, does disconnecting WDMA0 here clear the active OVL0-to-COLOR0 routing bits as well because of the shared MT8167_OVL0_MOUT_EN_MASK mask?
[ ... ]
drivers/soc/mediatek/mt8167-mmsys.h line 104
Quoted 4 lines
drivers/soc/mediatek/mt8167-mmsys.h +4
-0+/* DITHER<->UFOE */ +MMSYS_ROUTE (DITHER ,0 ,UFOE ,0 , +MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , + MT8167_DITHER_MOUT_EN_UFOE),
[Severity: High]
Similarly, does using the full MT8167_DITHER_MOUT_EN_MASK here cause the disconnect of the DITHER-to-UFOE route to accidentally break concurrent routing to RDMA0 and WDMA0?
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
PATCH v2 4/4 arm64: dts: mediatek: mt8167: Add DRM nodes
In reply to Luca Leonardo ScorciaAdd all the DRM nodes required to get DSI and DPI to work on MT8167 SoC.
--- 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 = <&mmsys CLK_MM_DISP_PWM_26M>, <&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
Re: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 20 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]>--- 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;
Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
Best regards,
Krzysztof
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 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]>--- arch/arm64/boot/dts/mediatek/mt8167.dtsi | 369 +++++++++++++++++++++++ 1 file changed, 369 insertions(+)arch/arm64/boot/dts/mediatek/mt8167.dtsi +9
-0@@ -16,6 +16,22 @@ / { compatible = "mediatek,mt8167"; + aliases { + aal0 = &aal; + ccorr0 = &ccorr; + color0 = &color; + dither0 = &dither; + dpi0 = &dpi0; + dpi1 = &dpi1; + dsi0 = &dsi; + gamma0 = γ
Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi line 32
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +5
-0+ ovl0 = &ovl0; + pwm0 = &disp_pwm; + rdma0 = &rdma0; + rdma1 = &rdma1; + wdma0 = &wdma;Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
It's always been like this on MediaTek from day 1, what's up with that!?
Btw, in this case the aliases are useless.
Cheers,
Angelo
Re: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 37 lines · AngeloGioacchino Del Regno
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 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]>--- arch/arm64/boot/dts/mediatek/mt8167.dtsi | 369 +++++++++++++++++++++++ 1 file changed, 369 insertions(+)arch/arm64/boot/dts/mediatek/mt8167.dtsi +9
-0@@ -16,6 +16,22 @@ / { compatible = "mediatek,mt8167"; + aliases { + aal0 = &aal; + ccorr0 = &ccorr; + color0 = &color; + dither0 = &dither; + dpi0 = &dpi0; + dpi1 = &dpi1; + dsi0 = &dsi; + gamma0 = γQuoted 9 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi line 32
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +5
-0+ ovl0 = &ovl0; + pwm0 = &disp_pwm; + rdma0 = &rdma0; + rdma1 = &rdma1; + wdma0 = &wdma;Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
Quoted 1 line
It's always been like this on MediaTek from day 1, what's up with that!?
I wrote what is wrong - they are undocumented. You were never allowed to add undocumented ABI, never. Even 10 years ago.
I don't know what is day 1 in this context, but for a few (5-8 years?) we do not allow more custom aliases. Neither new DTS users of these.
Best regards,
Krzysztof
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 38 lines · Krzysztof Kozlowski
Quoted 37 lines · AngeloGioacchino Del Regno
Quoted 35 lines · Krzysztof Kozlowski
Quoted 20 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]>--- 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;Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
Quoted 5 lines
Quoted 1 line
It's always been like this on MediaTek from day 1, what's up with that!?
I wrote what is wrong - they are undocumented. You were never allowed to add undocumented ABI, never. Even 10 years ago.
Well, that's right.
Quoted 3 lines
I don't know what is day 1 in this context, but for a few (5-8 years?) we do not allow more custom aliases. Neither new DTS users of these.
That actually poses a severe issue, as mediatek-drm relies on aliases to find out the instance number of the display controller components, on all SoCs.
Any advice on how to possibly resolve this without rewriting the entire thing?
Mapping that by mmio address in the driver seems too stupid/dirty/bad/etc.
Thanks,
Angelo
Re: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 45 lines · AngeloGioacchino Del Regno
Quoted 38 lines · Krzysztof Kozlowski
Quoted 37 lines · AngeloGioacchino Del Regno
Quoted 35 lines · Krzysztof Kozlowski
Quoted 20 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]>--- 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;Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
Quoted 5 lines
Quoted 1 line
It's always been like this on MediaTek from day 1, what's up with that!?
I wrote what is wrong - they are undocumented. You were never allowed to add undocumented ABI, never. Even 10 years ago.
Quoted 8 lines
Well, that's right.
Quoted 3 lines
I don't know what is day 1 in this context, but for a few (5-8 years?) we do not allow more custom aliases. Neither new DTS users of these.
That actually poses a severe issue, as mediatek-drm relies on aliases to find out the instance number of the display controller components, on all SoCs.
If someone sent these for DT maintainers review, we would provide review telling they are not allowed and you need to use other methods. The problem is that someone sneaked undocumented ABI.
Instance IDs are not allowed in DT - neither as aliases nor as properties.
If the graph topology or phandles do not point to proper relation between components, then the recommended way I know (happy to learn more myself) is to map instances to IDs in the drivers. For example Qualcomm/MSM is doing that.
Quoted 4 lines
Any advice on how to possibly resolve this without rewriting the entire thing?
Mapping that by mmio address in the driver seems too stupid/dirty/bad/etc.
Driver needs that, so why exactly stupid? You do not represent any actual hardware information in DT with these aliases. You want to tell drivers how drivers should behave - that's not a job for DT, that's job for driver data. Of course if there is smarter way than MMIO->ID, I am all in.
Best regards,
Krzysztof
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 52 lines · Krzysztof Kozlowski
Quoted 51 lines · AngeloGioacchino Del Regno
Quoted 38 lines · Krzysztof Kozlowski
Quoted 37 lines · AngeloGioacchino Del Regno
Quoted 35 lines · Krzysztof Kozlowski
Quoted 20 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]>--- 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;Folks, what is happening here? Why Mediatek is adding bunch of undocumented aliases? This should have never been accepted to Mediatek SoC.
Quoted 5 lines
Quoted 1 line
It's always been like this on MediaTek from day 1, what's up with that!?
I wrote what is wrong - they are undocumented. You were never allowed to add undocumented ABI, never. Even 10 years ago.
Well, that's right.
Quoted 3 lines
I don't know what is day 1 in this context, but for a few (5-8 years?) we do not allow more custom aliases. Neither new DTS users of these.
Quoted 9 lines
Quoted 2 lines
That actually poses a severe issue, as mediatek-drm relies on aliases to find out the instance number of the display controller components, on all SoCs.
If someone sent these for DT maintainers review, we would provide review telling they are not allowed and you need to use other methods. The problem is that someone sneaked undocumented ABI.
Instance IDs are not allowed in DT - neither as aliases nor as properties.
Okay.
Quoted 5 lines
If the graph topology or phandles do not point to proper relation between components, then the recommended way I know (happy to learn more myself) is to map instances to IDs in the drivers. For example Qualcomm/MSM is doing that.
They do point to proper relation between components, but connecting one IP to another is one thing, knowing the fixed hardware instance number (so how many of those hardware IPs are there, and which one is that exact one) is another.
Quoted 6 lines
Quoted 4 lines
Any advice on how to possibly resolve this without rewriting the entire thing?
Mapping that by mmio address in the driver seems too stupid/dirty/bad/etc.
Driver needs that, so why exactly stupid?
Really feels like going back to the days when devicetree was not a thing and all of the MMIOs (on ARM at least) were added into a mach file.
Quoted 3 lines
You do not represent any
actual hardware information in DT with these aliases.
That depends on how you see it (as in, on the point of view), really, because well technically the second ReadDMA IP is ... not the ... primary, as it's the secondary one - as much as the third DPI is not the primary one (even though DRM can make it so that it can be used as a primary output, but that's a software thing, not HW).
So... well, with that point of view... those aliases *are* representing information about the hardware.
But I know that you're not complaining just about this, and this reply is not a way to argue all that much, just a bit of thinking out loud.
Quoted 3 lines
You want to tell
drivers how drivers should behave - that's not a job for DT,
I want to tell drivers what is the first or the second or the third hardware instance of the same IP, I don't want to tell drivers how drivers should behave from devicetree.
The drivers are behaving differently with different hardware (read as: hardware that is *physically* located in front of something else, or somewhere else anyway) as in with different hardware instances.
Quoted 3 lines
that's job
for driver data. Of course if there is smarter way thanMMIO->ID, I am all in.
You can't imagine how much I was hoping for you to say something about an alternative solution to that.
As I said, it feels a bit like pre-DT times, but what I get from you is that this is cleaner than just adding information about the real hardware instance number in devicetree (no that's not just MediaTek, qcom also had similar issues as you said).
Cheers,
Angelo
Re: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 10 lines · AngeloGioacchino Del Regno
Quoted 7 lines
Quoted 5 lines
Any advice on how to possibly resolve this without rewriting the entire thing?
Mapping that by mmio address in the driver seems too stupid/dirty/bad/etc.
Driver needs that, so why exactly stupid?
Really feels like going back to the days when devicetree was not a thing and all of the MMIOs (on ARM at least) were added into a mach file.
Well, adding an alias just to tell that device node with MMIO address 0xdeadbeef is ID 0 is very similar, just placed differently. The "aliases" are the mapping between MMIO and ID. Driver code also can do the mapping between MMIO and ID.
Quoted 10 lines
Quoted 4 lines
You do not represent any
actual hardware information in DT with these aliases.That depends on how you see it (as in, on the point of view), really, because well technically the second ReadDMA IP is ... not the ... primary, as it's the secondary one - as much as the third DPI is not the primary one (even though DRM can make it so that it can be used as a primary output, but that's a software thing, not HW).
Quoted 5 lines
So... well, with that point of view... those aliases *are* representing information about the hardware.
But I know that you're not complaining just about this, and this reply is not a way to argue all that much, just a bit of thinking out loud.
Being simply "second" is not alone useful information. It's pointless, it does not matter neither to hardware nor to drivers. If it matters, then probably that "second" has some other meaning and it maps to an actual hardware topology difference, then often it deserves its own compatible or property, depending on the difference.
Quoted 11 lines
Quoted 4 lines
You want to tell
drivers how drivers should behave - that's not a job for DT,I want to tell drivers what is the first or the second or the third hardware instance of the same IP, I don't want to tell drivers how drivers should behave from devicetree.
The drivers are behaving differently with different hardware (read as: hardware that is *physically* located in front of something else, or somewhere else anyway) as in with different hardware instances.
Then alias is not the way to represent these differences.
Quoted 11 lines
Quoted 4 lines
that's job
for driver data. Of course if there is smarter way thanMMIO->ID, I am all in.You can't imagine how much I was hoping for you to say something about an alternative solution to that.
As I said, it feels a bit like pre-DT times, but what I get from you is that this is cleaner than just adding information about the real hardware instance number in devicetree (no that's not just MediaTek, qcom also had similar issues as you said).
Sure, I understand. This is an workaround and might be less applicable here. It might be possible that your hardware needs a dedicated property. Unfortunately, this cannot be a custom per-device alias.
Best regards,
Krzysztof
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Quoted 27 lines · Krzysztof Kozlowski
Quoted 10 lines · AngeloGioacchino Del Regno
Quoted 7 lines
Quoted 5 lines
Any advice on how to possibly resolve this without rewriting the entire thing?
Mapping that by mmio address in the driver seems too stupid/dirty/bad/etc.
Driver needs that, so why exactly stupid?
Really feels like going back to the days when devicetree was not a thing and all of the MMIOs (on ARM at least) were added into a mach file.
Well, adding an alias just to tell that device node with MMIO address
0xdeadbeefis ID 0 is very similar, just placed differently. The "aliases" are the mapping between MMIO and ID. Driver code also can do the mapping between MMIO and ID.Quoted 10 lines
Quoted 4 lines
You do not represent any
actual hardware information in DT with these aliases.That depends on how you see it (as in, on the point of view), really, because well technically the second ReadDMA IP is ... not the ... primary, as it's the secondary one - as much as the third DPI is not the primary one (even though DRM can make it so that it can be used as a primary output, but that's a software thing, not HW).
Quoted 8 lines
Quoted 5 lines
So... well, with that point of view... those aliases *are* representing information about the hardware.
But I know that you're not complaining just about this, and this reply is not a way to argue all that much, just a bit of thinking out loud.
Being simply "second" is not alone useful information. It's pointless, it does not matter neither to hardware nor to drivers.
Hmm... Sorry, but I disagree about this statement - it does matter in some cases.
The driver's POV is of course out of context here, as we're talking about DT//HW.
(I know that you know, this is to avoid misunderstanding from anyone else reading this thread).
Quoted 5 lines
If it matters,
then probably that "second" has some other meaning and it maps to an actual hardware topology difference, then often it deserves its own compatible or property, depending on the difference.
This is a bit more complicated than that: "second" may or may not have another meaning, as in, it may or may not be topologically different in the whole context of the controller.
Having different compatibles wouldn't do either, because having 10 compats for one IP which is 99.9% compatible if not for very very very very (add as many "very" as you wish here) small details that definitely don't deserve a new compatible... and besides, a driver parsing more than 90 compatible strings would be... how can I express that in professional words? :-)))
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
You want to tell
drivers how drivers should behave - that's not a job for DT,
Quoted 9 lines
Quoted 6 lines
I want to tell drivers what is the first or the second or the third hardware instance of the same IP, I don't want to tell drivers how drivers should behave from devicetree.
The drivers are behaving differently with different hardware (read as: hardware that is *physically* located in front of something else, or somewhere else anyway) as in with different hardware instances.Then alias is not the way to represent these differences.
Are we opening a can of worms here?
There are a bunch of (generic, yes, and I think acceptable-because-generic, right?) aliases for other devices like UART, I2C, SPI, etc which instance is actually represented by an alias - and this is *not* for HW, but rather for drivers' device node number consistency in the userspace (of course not just MTK, but all of them).
That makes things a bit weird then when we assert that devicetree describes the HW and, compared to what we're analyzing in this specific MediaTek case (which does in a way describe hardware, as in hw instance number), the LS busses aliases are just software details in an inappropriate place (DT) at this point?
I wonder if there's anything that can be done for that case, because then now I'm kind of sensing that there's something else that is fundamentally wrong and that
1. Leads to confusion (not in experienced people usually, but not granted)
2. May actually help resolving situations that are similar to this one
I'm well aware that whatever comes out of this won't be for this round, nor for the next one, but rather something that may eventually take (a lot of) time to assess and address, but still.
Mind you - I keep thinking out loud - but I believe sometimes this is what makes good (hopefully) ideas come to mind.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
that's job
for driver data. Of course if there is smarter way thanMMIO->ID, I am all in.You can't imagine how much I was hoping for you to say something about an alternative solution to that.
Quoted 7 lines
Quoted 3 lines
As I said, it feels a bit like pre-DT times, but what I get from you is that this is cleaner than just adding information about the real hardware instance number in devicetree (no that's not just MediaTek, qcom also had similar issues as you said).
Sure, I understand. This is an workaround and might be less applicable here. It might be possible that your hardware needs a dedicated property.
I didn't check the others - but from what I remember, Qualcomm also has this kind of workaround somewhere (in some driver[s]) - so that pushes the count to two vendors, let alone the number of SoCs affected which is .. well, more than two :-)
I wonder if someone (unfortunately not me or at least not in the next 6 months) should do ... well, something ... to fix this situation in a good way.
Adding the same workaround to MediaTek would make the argument stronger when that someone actually gets to resolving this situation somehow.
Quoted 2 lines
Unfortunately, this cannot be a custom per-device alias.
I will come up with some way (right now, I have no idea how) to get this situation addressed in MediaTek DRM, maybe it's going to be that MMIO address workaround, or maybe not, let's see what I can do here.
Surely though, either way, that's not good news - not just because it's going to slow down the upstreaming by a whole lot - but mostly because it's all about adding one more workaround for something that is "left in the future-decisions-box" in the kernel.
Having to do this makes me sad, and this is mostly because I have no other choice.
I'm sure you know what I mean here, so I won't add any more words to this already long reply.
P.S.: Luca, you don't need to add the aliases to your SoC, because there's only one instance of the display controller IPs that you're adding; for DSI1/2 DPI1/2 and those final outputs, I guess just leave them out for now and add just the first....
Cheers,
Angelo