Add support for the mt8167 display pipeline
Subsystems (5)
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.
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 | 183 ++++++++- 5 files changed, 569 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
PATCH 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
PATCH 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
PATCH 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 | 183 ++++++++++++++++++++++++++-- 1 file changed, 174 insertions(+), 9 deletions(-)
drivers/soc/mediatek/mt8167-mmsys.h +174 -9
@@ -5,35 +5,200 @@#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_COLOR0_SEL_IN ,MT8167_COLOR0_SEL_IN_MASK , +MT8167_WDMA0_SEL_IN_OVL0 ), + +/* DITHER0 outputs */ 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 , +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 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , +MT8167_DITHER_MOUT_EN_WDMA0 ), + +/* 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 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN ,MT8167_DSI0_SEL_IN_MASK , +MT8167_DPI0_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 3/4] soc: mediatek: mt8167-mmsys: add routes for all display paths
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] mmsys: incorrect register for OVL0 to WDMA0 routing - [High] mmsys: missing SEL_IN routes for…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] mmsys: incorrect register for OVL0 to WDMA0 routing
- [High] mmsys: missing SEL_IN routes for DITHER to UFOE and WDMA0
- [High] mmsys: incorrect tuple for RDMA1 to DSI0 SEL_IN routing
--
commit 2f4bc4d4c245498df33e07567c376707ba880cbe
Author: Luca Leonardo Scorcia <[email protected]>
Subject: soc: mediatek: mt8167-mmsys: add routes for all display paths
The commit adds support for additional routes in the mt8167 display output pipeline, aligning with the SoC data sheet and Android sources.
Quoted 4 lines
drivers/soc/mediatek/mt8167-mmsys.h +0
-0
[ ... ]
Quoted 8 lines
static const struct
mtk_mmsys_routesmt8167_mmsys_routing_table[] = {drivers/soc/mediatek/mt8167-mmsys.h +4
-2+/* 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,
drivers/soc/mediatek/mt8167-mmsys.h line 94
Quoted 10 lines
drivers/soc/mediatek/mt8167-mmsys.h +10
-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_COLOR0_SEL_IN ,MT8167_COLOR0_SEL_IN_MASK , + MT8167_WDMA0_SEL_IN_OVL0),
[Severity: High]
Does this route mistakenly use MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN instead of MT8167_DISP_REG_CONFIG_DISP_WDMA0_SEL_IN?
By targeting the COLOR0 input selection register, this configuration might corrupt COLOR0's input selection and fail to properly configure WDMA0's input selection when establishing a route between OVL0 and WDMA0.
Quoted 5 lines
drivers/soc/mediatek/mt8167-mmsys.h +2
-0+ +/* DITHER0 outputs */ MMSYS_ROUTE (DITHER ,0 ,RDMA ,0 ,MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , MT8167_DITHER_MOUT_EN_RDMA0),
drivers/soc/mediatek/mt8167-mmsys.h line 105
Quoted 10 lines
drivers/soc/mediatek/mt8167-mmsys.h +6
-4-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, +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 ,WDMA ,0 , +MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN ,MT8167_DITHER_MOUT_EN_MASK , + MT8167_DITHER_MOUT_EN_WDMA0),
[Severity: High]
Are there missing SEL_IN routes for DITHER to UFOE and WDMA0 here?
The patch defines MT8167_UFOE_SEL_IN_DITHER and MT8167_WDMA0_SEL_IN_DITHER constants and sets up the source output (MOUT_EN) routes above, but appears to omit the MMSYS_ROUTE entries to configure the destination input multiplexers. Without these, UFOE and WDMA0 might not switch their inputs to accept DITHER0.
[ ... ]
drivers/soc/mediatek/mt8167-mmsys.h line 185
Quoted 7 lines
drivers/soc/mediatek/mt8167-mmsys.h +7
-0+/* 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 ,DPI ,0 , +MT8167_DISP_REG_CONFIG_DISP_DSI0_SEL_IN ,MT8167_DSI0_SEL_IN_MASK , + MT8167_DPI0_SEL_IN_RDMA1),
[Severity: High]
Should this tuple be (RDMA, 1, DSI, 0) instead of (RDMA, 1, DPI, 0)?
Because the destination is specified as DPI instead of DSI, this route appears to be applied at the wrong time (when routing to DPI0) and missed when routing to DSI0. This could leave the RDMA1 to DSI0 route unconfigured and mistakenly corrupt the DSI0 input selection register when routing to DPI0.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH 3/4] soc: mediatek: mt8167-mmsys: add routes for all display paths
In reply to Luca Leonardo ScorciaSashiko found [1] some copy-and-paste errors in this patch that are worth correcting. I must have checked it a hundred times but they still slipped in.
I will send a revised v2 after waiting a few days for additional reviews. Thank you
[1] https://sashiko.dev/#/message/20260918175736.355305-4-l.scorcia%40gmail.com
Signature · 2 lines
Luca Leonardo Scorcia [email protected]
PATCH 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
[email protected]
AI reviewRe: [PATCH 4/4] arm64: dts: mediatek: mt8167: Add DRM nodes
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/mediatek: OF graph traversal fails probe due to disconnected rdma0_out --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/mediatek: OF graph traversal fails probe due to disconnected rdma0_out --
commit 09e4433abd1ea0bcfece829092d5582ffb8243ec
Author: Luca Leonardo Scorcia <[email protected]>
arm64: dts: mediatek: mt8167: Add DRM nodes
Add all the DRM nodes required to get DSI and DPI to work on MT8167 SoC.
Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +0
-0
[ ... ]
Quoted 3 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +0
-0@@ -120,10 +136,325 @@ iommu: m4u@10203000 { #iommu-cells = <1>; };
[ ... ]
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 159
Quoted 11 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +7
-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 {
[Severity: High]
Does adding this port to mmsys cause the mtk_drm probe to fail unconditionally on existing boards?
By adding this port, mtk_drm is forced to use OF graph traversal instead of its legacy hardcoded array fallback. This opts the device into graph parsing, making the disconnected rdma0_out a fatal probe failure instead of falling back to legacy arrays. This occurs unconditionally on boot for any MT8167 board that does not explicitly define the connection in its .dts file (such as the existing mt8167-pumpkin.dts).
Quoted 3 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +3
-0+ reg = <0>; + remote-endpoint = <&ovl0_in>; + };
[ ... ]
Quoted 13 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +13
-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 {
arch/arm64/boot/dts/mediatek/mt8167.dtsi iommu: m4u@10203000 { · line 221
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +10
-0+ reg = <0>; + rdma0_in: endpoint { + remote-endpoint = <&dither_out>; + }; + }; + + port@1 { + reg = <1>; + rdma0_out: endpoint { }; + };
[Severity: High]
Will the missing remote-endpoint at rdma0_out cause the OF graph traversal to fail?
The traversal algorithm in mtk_drm_of_ddp_path_build_one walks the endpoints. Because rdma0_out lacks a remote-endpoint property, of_graph_get_remote_port_parent() returns NULL, causing mtk_drm_of_get_ddp_ep_cid() to return -EINVAL.
Since rdma0 is not a valid final display output, the pipeline build fails with -EINVAL and breaks display and DRM driver initialization. If rdma0_out had been properly connected to dsi_in in the .dtsi (which is disabled by default), mtk_drm_of_get_ddp_ep_cid() would have safely returned -ENODEV, allowing the probe to succeed.
Quoted 2 lines
arch/arm64/boot/dts/mediatek/mt8167.dtsi +2
-0+ }; + };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Quoted 14 lines · Luca Leonardo Scorcia
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.
Quoted 8 lines
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
I don't think that it even exists with your SoC. It's fine though, because you're anyway testing the DPI interface in one way or another.
Quoted 2 lines
since DPI1-HDMI works, I feel confident saying that the clocks divisors are correct.
While series is
Quoted 14 lines
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 | 183 ++++++++- 5 files changed, 569 insertions(+), 9 deletions(-)
Re: (subset) [PATCH 0/4] Add support for the mt8167 display pipeline
In reply to Luca Leonardo ScorciaQuoted 11 lines · Luca Leonardo Scorcia
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.
[...]
Applied to v7.3-next/soc, thanks!
[3/4] soc: mediatek: mt8167-mmsys: add routes for all display paths
commit: ae0968038f994d6e275f5dc94a27325ee751fe58
Cheers,
Angelo
Re: (subset) [PATCH 0/4] Add support for the mt8167 display pipeline
Quoted 4 lines
Applied to v7.3-next/soc, thanks!
[3/4] soc: mediatek: mt8167-mmsys: add routes for all display paths
commit: ae0968038f994d6e275f5dc94a27325ee751fe58
I'm sorry Angelo, please revert this - I'll post a v2 with the corrections spotted by Sashiko [1] later today. Thank you
[1] https://lore.kernel.org/linux-mediatek/CAORyz2KEfzcJ_2AphkPU6o-YhLAqudCXVdY+LDoynUx_FsTMJg@mail.gmail.com/
--
Luca Leonardo Scorcia
[email protected]