drm/mediatek: add support for mediatek SOC MT8183
Subsystems (4)
v11 cover drm/mediatek: add support for mediatek SOC MT8183
This series is based on kernel/git/chunkuang.hu/linux.git mediatek-drm-next The series is tested on a mt8183 krane device.
Change since v10
- fix review comments in v9
Change since v9
- change several function to rebase to mediatek-drm-next
Change since v8
- fix some review comment in v8
- separate gamma module for mt8183 has no dither function in gamma
- enable dither function for 5 or 6 bpc panel display
- separate ddp mutex patch from the whole Soc patch
Change since v7
- add dt-binding for mt8183 display
- base mmsys patch
https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
- base dts patch
https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
- add mt8183 function call for setting the routing registers
- add RDMA fifo size error handle
Change since v6
- move ddp component define into mtk_mmsys.h
- add mmsys private data to support different ic path connection
- add mt8183-mmsys.c to support 8183 path connection
- fix reviewed issue in v6
Change since v5
- fix reviewed issue in v5
base https://patchwork.kernel.org/project/linux-mediatek/list/?series=213219
Change since v4
- fix reviewed issue in v4
Change since v3
- fix reviewed issue in v3
- fix type error in v3
- fix conflict with iommu patch
Change since v2
- fix reviewed issue in v2
- add mutex node into dts file
Changes since v1:
- fix reviewed issue in v1
- add dts for mt8183 display nodes
- adjust display clock control flow in patch 22
- add vmap support for mediatek drm in patch 23
- fix page offset issue for mmap function in patch 24
- enable allow_fb_modifiers for mediatek drm in patch 25
Hsin-Yi Wang (1):
drm/mediatek: add mtk_dither_set_common() function
Yongqiang Niu (8):
arm64: dts: mt8183: rename rdma fifo size
arm64: dts: mt8183: refine gamma compatible name drm/mediatek: add RDMA fifo size error handle drm/mediatek: separate gamma module drm/mediatek: add has_dither private data for gamma drm/mediatek: enable dither function
soc: mediatek: add mtk mutex support for MT8183 drm/mediatek: add support for mediatek SOC MT8183
arch/arm64/boot/dts/mediatek/mt8183.dtsi | 7 +- drivers/gpu/drm/mediatek/Makefile | 1 + drivers/gpu/drm/mediatek/mtk_disp_drv.h | 14 ++ drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 196 ++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 ++ drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 10 + drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 138 +++++++------- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 49 ++++- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 + drivers/soc/mediatek/mtk-mutex.c | 50 +++++ 10 files changed, 410 insertions(+), 74 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_gamma.c
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v11 1/9 arm64: dts: mt8183: rename rdma fifo size
From: Yongqiang Niu <[email protected]>
property name must include only lowercase and '-'
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +2 -2
@@ -1011,7 +1011,7 @@ rdma0: rdma@1400b000 { clocks = <&mmsys CLK_MM_DISP_RDMA0>; iommus = <&iommu M4U_PORT_DISP_RDMA0>; mediatek,larb = <&larb0>; - mediatek,rdma_fifo_size = <5120>; + mediatek,rdma-fifo-size = <5120>; mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>; };
@@ -1023,7 +1023,7 @@ rdma1: rdma@1400c000 { clocks = <&mmsys CLK_MM_DISP_RDMA1>; iommus = <&iommu M4U_PORT_DISP_RDMA1>; mediatek,larb = <&larb0>; - mediatek,rdma_fifo_size = <2048>; + mediatek,rdma-fifo-size = <2048>; mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>; };
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 1/9] arm64: dts: mt8183: rename rdma fifo size
Hi Hsin-Yi,
Thank you for the patch.
Missatge de Hsin-Yi Wang <[email protected]> del dia dj., 28 de gen. 2021 a les 8:28:
Quoted 5 lines
From: Yongqiang Niu <[email protected]>
property name must include only lowercase and '-'
This is a leftover while I forward ported the patch, the rdma_fifo_size only existed on the downstream kernels, in mainline it is with '-', so we should probably add the fixes tag here.
Quoted 3 lines
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Chun-Kuang Hu <[email protected]>
Quoted 30 lines
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm64/boot/dts/mediatek/mt8183.dtsi +2
-3@@ -1011,7 +1011,7 @@ rdma0: rdma@1400b000 { clocks = <&mmsys CLK_MM_DISP_RDMA0>; iommus = <&iommu M4U_PORT_DISP_RDMA0>; mediatek,larb = <&larb0>; - mediatek,rdma_fifo_size = <5120>; + mediatek,rdma-fifo-size = <5120>; mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>; };@@ -1023,7 +1023,7 @@ rdma1: rdma@1400c000 { clocks = <&mmsys CLK_MM_DISP_RDMA1>; iommus = <&iommu M4U_PORT_DISP_RDMA1>; mediatek,larb = <&larb0>; - mediatek,rdma_fifo_size = <2048>; + mediatek,rdma-fifo-size = <2048>; mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>; }; --2.30.0.280.ga3ce27912f-goog
Quoted 4 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v11 2/9 arm64: dts: mt8183: refine gamma compatible name
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
mt8183 gamma is different with mt8173
remove mt8173 compatible name for mt8183 gamma
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +1 -2
@@ -1055,8 +1055,7 @@ aal0: aal@14010000 { }; gamma0: gamma@14011000 { - compatible = "mediatek,mt8183-disp-gamma", - "mediatek,mt8173-disp-gamma"; + compatible = "mediatek,mt8183-disp-gamma"; reg = <0 0x14011000 0 0x1000>; interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_LOW>; power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 2/9] arm64: dts: mt8183: refine gamma compatible name
Hi Hsin-Yi,
Thank you for your patch.
Missatge de Hsin-Yi Wang <[email protected]> del dia dj., 28 de gen. 2021 a les 8:28:
Quoted 6 lines
From: Yongqiang Niu <[email protected]>
mt8183 gamma is different with mt8173
remove mt8173 compatible name for mt8183 gamma
Should this patch contain?
Quoted 2 lines
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>
Quoted 22 lines
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arm64/boot/dts/mediatek/mt8183.dtsi +1
-3@@ -1055,8 +1055,7 @@ aal0: aal@14010000 { }; gamma0: gamma@14011000 { - compatible = "mediatek,mt8183-disp-gamma", - "mediatek,mt8173-disp-gamma"; + compatible = "mediatek,mt8183-disp-gamma"; reg = <0 0x14011000 0 0x1000>; interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_LOW>; power-domains = <&spm MT8183_POWER_DOMAIN_DISP>; --2.30.0.280.ga3ce27912f-goog
Quoted 4 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v11 3/9 drm/mediatek: add RDMA fifo size error handle
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
This patch add RDMA fifo size error handle
rdma fifo size will not always bigger than the calculated threshold if that case happened, we need set fifo size as the threshold
--- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +4 -0
@@ -168,6 +168,10 @@ void mtk_rdma_config(struct device *dev, unsigned int width,* account for blanking, and with a pixel depth of 4 bytes: */ threshold = width * height * vrefresh *4 *7 /1000000 ; + +if (threshold > rdma_fifo_size) + threshold = rdma_fifo_size; + reg =RDMA_FIFO_UNDERFLOW_EN |RDMA_FIFO_PSEUDO_SIZE (rdma_fifo_size) |RDMA_OUTPUT_VALID_FIFO_THRESHOLD (threshold);
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 3/9] drm/mediatek: add RDMA fifo size error handle
Hi, Hsin-Yi:
Quoted 17 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
This patch add RDMA fifo size error handle
rdma fifo size will not always bigger than the calculated threshold if that case happened, we need set fifo size as the thresholdSigned-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/mediatek/mtk_disp_rdma.c +0
-0
drivers/gpu/drm/mediatek/mtk_disp_rdma.c void mtk_rdma_config(struct device *dev, unsigned int width, · line 174
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +4
-0@@ -168,6 +168,10 @@ void mtk_rdma_config(struct device *dev, unsigned int width,* account for blanking, and with a pixel depth of 4 bytes: */ threshold = width * height * vrefresh *4 *7 /1000000 ; + +if (threshold > rdma_fifo_size) + threshold = rdma_fifo_size; +
Please see the discussion in [1].
[1]
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
Regards,
CK
drivers/gpu/drm/mediatek/mtk_disp_rdma.c void mtk_rdma_config(struct device *dev, unsigned int width, · line 177
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +0
-0reg =RDMA_FIFO_UNDERFLOW_EN |RDMA_FIFO_PSEUDO_SIZE (rdma_fifo_size) |RDMA_OUTPUT_VALID_FIFO_THRESHOLD (threshold);
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 3/9] drm/mediatek: add RDMA fifo size error handle
Quoted 31 lines · CK Hu
Hi, Hsin-Yi:
Quoted 17 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
This patch add RDMA fifo size error handle
rdma fifo size will not always bigger than the calculated threshold if that case happened, we need set fifo size as the thresholdSigned-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/mediatek/mtk_disp_rdma.c +0
-0drivers/gpu/drm/mediatek/mtk_disp_rdma.c void mtk_rdma_config(struct device *dev, unsigned int width, · line 174
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +4
-0@@ -168,6 +168,10 @@ void mtk_rdma_config(struct device *dev, unsigned int width,* account for blanking, and with a pixel depth of 4 bytes: */ threshold = width * height * vrefresh *4 *7 /1000000 ; + +if (threshold > rdma_fifo_size) + threshold = rdma_fifo_size; +Please see the discussion in [1].
Quoted 6 lines
[1]
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/Regards,
CK
Hi CK,
Even if we set threshold to
threshold = RDMA_FIFO_PSEUDO_SIZE(rdma_fifo_size) * width * height * vrefresh / 2 / MAX_WIDTH / MAX_HEIGHT / MAX_VREFRESH;
I'm not sure what value MAX_WIDTH, MAX_HEIGHT, and MAX_VREFRESH should set to for each SoC.
Since there's no conclusion yet, I'll drop this patch in the series, as this seems not an mt8183 specific fix.
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_disp_rdma.c void mtk_rdma_config(struct device *dev, unsigned int width, · line 177
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +0
-0reg =RDMA_FIFO_UNDERFLOW_EN |RDMA_FIFO_PSEUDO_SIZE (rdma_fifo_size) |RDMA_OUTPUT_VALID_FIFO_THRESHOLD (threshold);
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v11 4/9 drm/mediatek: add mtk_dither_set_common() function
In reply to Hsin-Yi WangCurrent implementation of mtk_dither_set() cast dev data to struct mtk_ddp_comp_dev. But other devices with different dev data would also call this function.
Separate necessary parameters out so other device components (dither, gamma) can call this function.
--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 4 ++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 25 +++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_drv.h +4 -0
@@ -17,6 +17,10 @@ void mtk_color_config(struct device *dev, unsigned int w, unsigned int bpc, struct cmdq_pkt *cmdq_pkt);void mtk_color_start (struct device *dev); +void mtk_dither_set_common (void __iomem *regs,struct cmdq_client_reg *cmdq_reg, +unsigned int bpc,unsigned int CFG , +struct cmdq_pkt *cmdq_pkt); +void mtk_dpi_start (struct device *dev);void mtk_dpi_stop (struct device *dev);
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +16 -9
@@ -151,33 +151,40 @@ static void mtk_ddp_clk_disable(struct device *dev)clk_disable_unprepare (priv->clk); } -static void mtk_dither_set (struct device *dev,unsigned int bpc, -unsigned int CFG ,struct cmdq_pkt *cmdq_pkt) -{ -struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); +void mtk_dither_set_common (void __iomem *regs,struct cmdq_client_reg *cmdq_reg, +unsigned int bpc,unsigned int CFG ,struct cmdq_pkt *cmdq_pkt) +{/* If bpc equal to 0, the dithering function didn't be enabled */ if (bpc ==0 )return ;if (bpc >=MTK_MIN_BPC ) { -mtk_ddp_write (cmdq_pkt,0 , &priv->cmdq_reg, priv->regs,DISP_DITHER_5 ); -mtk_ddp_write (cmdq_pkt,0 , &priv->cmdq_reg, priv->regs,DISP_DITHER_7 ); +mtk_ddp_write (cmdq_pkt,0 , cmdq_reg, regs,DISP_DITHER_5 ); +mtk_ddp_write (cmdq_pkt,0 , cmdq_reg, regs,DISP_DITHER_7 );mtk_ddp_write (cmdq_pkt,DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) |DITHER_NEW_BIT_MODE , - &priv->cmdq_reg, priv->regs,DISP_DITHER_15 ); + cmdq_reg, regs,DISP_DITHER_15 );mtk_ddp_write (cmdq_pkt,DITHER_LSB_ERR_SHIFT_B (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_B (MTK_MAX_BPC - bpc) |DITHER_LSB_ERR_SHIFT_G (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_G (MTK_MAX_BPC - bpc), - &priv->cmdq_reg, priv->regs,DISP_DITHER_16 ); -mtk_ddp_write (cmdq_pkt,DISP_DITHERING , &priv->cmdq_reg, priv->regs,CFG ); + cmdq_reg, regs,DISP_DITHER_16 ); +mtk_ddp_write (cmdq_pkt,DISP_DITHERING , cmdq_reg, regs,CFG ); } } +static void mtk_dither_set (struct device *dev,unsigned int bpc, +unsigned int CFG ,struct cmdq_pkt *cmdq_pkt) +{ +struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); + +mtk_dither_set_common (priv->regs, &priv->cmdq_reg, bpc,CFG , cmdq_pkt); +} +static void mtk_od_config (struct device *dev,unsigned int w,unsigned int h,unsigned int vrefresh,unsigned int bpc,struct cmdq_pkt *cmdq_pkt)
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 4/9] drm/mediatek: add mtk_dither_set_common() function
Quoted 6 lines · Hsin-Yi Wang
Current implementation of
mtk_dither_set()cast dev data to structmtk_ddp_comp_dev. But other devices with different dev data would also call this function.Separate necessary parameters out so other device components (dither, gamma) can call this function.
Quoted 66 lines
Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 4 ++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 25 +++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-)drivers/gpu/drm/mediatek/mtk_disp_drv.h +4
-0@@ -17,6 +17,10 @@ void mtk_color_config(struct device *dev, unsigned int w, unsigned int bpc, struct cmdq_pkt *cmdq_pkt);void mtk_color_start (struct device *dev); +void mtk_dither_set_common (void __iomem *regs,struct cmdq_client_reg *cmdq_reg, +unsigned int bpc,unsigned int CFG , +struct cmdq_pkt *cmdq_pkt); +void mtk_dpi_start (struct device *dev);void mtk_dpi_stop (struct device *dev);drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +9
-9@@ -151,33 +151,40 @@ static void mtk_ddp_clk_disable(struct device *dev)clk_disable_unprepare (priv->clk); } -static void mtk_dither_set (struct device *dev,unsigned int bpc, -unsigned int CFG ,struct cmdq_pkt *cmdq_pkt) -{ -struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); +void mtk_dither_set_common (void __iomem *regs,struct cmdq_client_reg *cmdq_reg, +unsigned int bpc,unsigned int CFG ,struct cmdq_pkt *cmdq_pkt) +{/* If bpc equal to 0, the dithering function didn't be enabled */ if (bpc ==0 )return ;if (bpc >=MTK_MIN_BPC ) { -mtk_ddp_write (cmdq_pkt,0 , &priv->cmdq_reg, priv->regs,DISP_DITHER_5 ); -mtk_ddp_write (cmdq_pkt,0 , &priv->cmdq_reg, priv->regs,DISP_DITHER_7 ); +mtk_ddp_write (cmdq_pkt,0 , cmdq_reg, regs,DISP_DITHER_5 ); +mtk_ddp_write (cmdq_pkt,0 , cmdq_reg, regs,DISP_DITHER_7 );mtk_ddp_write (cmdq_pkt,DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) |DITHER_NEW_BIT_MODE , - &priv->cmdq_reg, priv->regs,DISP_DITHER_15 ); + cmdq_reg, regs,DISP_DITHER_15 );mtk_ddp_write (cmdq_pkt,DITHER_LSB_ERR_SHIFT_B (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_B (MTK_MAX_BPC - bpc) |DITHER_LSB_ERR_SHIFT_G (MTK_MAX_BPC - bpc) |DITHER_ADD_LSHIFT_G (MTK_MAX_BPC - bpc), - &priv->cmdq_reg, priv->regs,DISP_DITHER_16 ); -mtk_ddp_write (cmdq_pkt,DISP_DITHERING , &priv->cmdq_reg, priv->regs,CFG ); + cmdq_reg, regs,DISP_DITHER_16 ); +mtk_ddp_write (cmdq_pkt,DISP_DITHERING , cmdq_reg, regs,CFG ); } } +static void mtk_dither_set(struct device *dev, unsigned int bpc,
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_ddp_clk_disable(struct device *dev) · line 190
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +7
-0+ unsigned int CFG, struct cmdq_pkt *cmdq_pkt) +{ + struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev); + +mtk_dither_set_common (priv->regs, &priv->cmdq_reg, bpc,CFG , cmdq_pkt); +} +static void mtk_od_config (struct device *dev,unsigned int w,unsigned int h,unsigned int vrefresh,unsigned int bpc,struct cmdq_pkt *cmdq_pkt)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v11 5/9 drm/mediatek: separate gamma module
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
mt8183 gamma module will different with mt8173
separate gamma for add private data
--- drivers/gpu/drm/mediatek/Makefile | 1 + drivers/gpu/drm/mediatek/mtk_disp_drv.h | 10 ++ drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 189 ++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 71 ++------ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 + 6 files changed, 215 insertions(+), 61 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_gamma.c
drivers/gpu/drm/mediatek/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 mediatek-drm-y := mtk_disp_color.o \ + mtk_disp_gamma.o \ mtk_disp_ovl.o \ mtk_disp_rdma.o \ mtk_drm_crtc.o \
drivers/gpu/drm/mediatek/mtk_disp_drv.h +10 -0
@@ -27,6 +27,16 @@ void mtk_dpi_stop(struct device *dev);void mtk_dsi_ddp_start (struct device *dev);void mtk_dsi_ddp_stop (struct device *dev); +int mtk_gamma_clk_enable (struct device *dev); +void mtk_gamma_clk_disable (struct device *dev); +void mtk_gamma_config (struct device *dev,unsigned int w, +unsigned int h,unsigned int vrefresh, +unsigned int bpc,struct cmdq_pkt *cmdq_pkt); +void mtk_gamma_set (struct device *dev,struct drm_crtc_state *state); +void mtk_gamma_set_common (void __iomem *regs,struct drm_crtc_state *state); +void mtk_gamma_start (struct device *dev); +void mtk_gamma_stop (struct device *dev); +void mtk_ovl_bgclr_in_on (struct device *dev);void mtk_ovl_bgclr_in_off (struct device *dev);void mtk_ovl_bypass_shadow (struct device *dev);
drivers/gpu/drm/mediatek/mtk_disp_gamma.c new file +189 -0
189 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +11 -60
116 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -1
@@ -486,11 +486,12 @@ static int mtk_drm_probe(struct platform_device *pdev) private->comp_node[comp_id] =of_node_get (node);/* -* Currently only the COLOR, OVL, RDMA, DSI, and DPI blocks have +* Currently only the COLOR, GAMMA, OVL, RDMA, DSI, and DPI blocks have * separate component platform drivers and initialize their own * DDP component structure. The others are initialized here. */ if (comp_type == MTK_DISP_COLOR || + comp_type == MTK_DISP_GAMMA || comp_type == MTK_DISP_OVL || comp_type == MTK_DISP_OVL_2L || comp_type == MTK_DISP_RDMA ||
@@ -589,6 +590,7 @@ static struct platform_driver mtk_drm_platform_driver = {static struct platform_driver *const mtk_drm_drivers[] = { &mtk_disp_color_driver, + &mtk_disp_gamma_driver, &mtk_disp_ovl_driver, &mtk_disp_rdma_driver, &mtk_dpi_driver,
drivers/gpu/drm/mediatek/mtk_drm_drv.h +1 -0
@@ -47,6 +47,7 @@ struct mtk_drm_private { };extern struct platform_driver mtk_disp_color_driver; +extern struct platform_driver mtk_disp_gamma_driver;extern struct platform_driver mtk_disp_ovl_driver;extern struct platform_driver mtk_disp_rdma_driver;extern struct platform_driver mtk_dpi_driver;
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v11 6/9 drm/mediatek: add has_dither private data for gamma
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
Not all SoC has dither function in gamma module. Add private data to control this function setting.
--- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_gamma.c +9 -3
@@ -26,7 +26,7 @@#define LUT_10BIT_MASK 0x03ffstruct mtk_disp_gamma_data { -u32 reserved; +bool has_dither; };/**
@@ -92,7 +92,8 @@ void mtk_gamma_config(struct device *dev, unsigned int w,mtk_ddp_write (cmdq_pkt, h <<16 | w, &gamma->cmdq_reg, gamma->regs,DISP_GAMMA_SIZE ); -mtk_dither_set_common (gamma->regs, &gamma->cmdq_reg, bpc,DISP_GAMMA_CFG , cmdq_pkt); +if (gamma->data && gamma->data->has_dither) +mtk_dither_set_common (gamma->regs, &gamma->cmdq_reg, bpc,DISP_GAMMA_CFG , cmdq_pkt); }void mtk_gamma_start (struct device *dev)
@@ -172,8 +173,13 @@ static int mtk_disp_gamma_remove(struct platform_device *pdev)return 0 ; } +static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = { + .has_dither = true, +}; +static const struct of_device_id mtk_disp_gamma_driver_dt_match[] = { - { .compatible ="mediatek,mt8173-disp-gamma" }, + { .compatible ="mediatek,mt8173-disp-gamma" , + .data = &mt8173_gamma_driver_data}, {}, };MODULE_DEVICE_TABLE (of, mtk_disp_gamma_driver_dt_match);
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v11 7/9 drm/mediatek: enable dither function
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +43 -1
@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff
@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); +bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = { +0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ +0x00000000 ,/* 14 */ + }; + +if (bpc ==5 || bpc ==6 ) { + enable = true; +mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); +mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_B (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_B (MTK_MAX_BPC - bpc) | +DITHER_LSB_ERR_SHIFT_G (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_G (MTK_MAX_BPC - bpc), + &priv->cmdq_reg, priv->regs,DITHER_REG (16 )); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }static void mtk_dither_start (struct device *dev)
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Hi, Hsin-Yi:
Quoted 33 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +6
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); +bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */
Could you explain what is this?
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),
This result in 0x50505050, but previous version is 0x50504040, so this version is correct and previous version is incorrect?
Regards,
CK
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +8
-0+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +5
-1+mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 like mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5); mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +9
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true; +mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 ));
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +5
-0+ mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?
the new version set r g b 3 channel same, seams more reasonable
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +9
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true; +mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 ));Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +5
-0+ mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of DISP_DITHER_5, DISP_DITHER_7, DISP_DITHER_15, DISP_DITHER_16 is identical to mtk_dither_set(), so call mtk_dither_set() instead of duplication here.
Regards,
CK
Quoted 21 lines
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?
Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.
dither enable set in mtk_dither_set is mtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);
that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
Quoted 30 lines
Regards,
CKQuoted 26 lines
Quoted 24 lines
Regards,
CKQuoted 18 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list [email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 88 lines · Yongqiang Niu
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.
Quoted 8 lines
dither enable set in
mtk_dither_setismtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
We can still call mtk_dither_set() for bpc is 5 or 6 here, though it will be set to bit2,
but later in mtk_ddp_write(cmdq_pkt, enable ? DITHER_ENGINE_EN :DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs, DISP_DITHER_CFG); it will be correct back to bit 1.
Is this reasonable?
Quoted 23 lines
Quoted 23 lines
Regards,
CKQuoted 21 lines
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 99 lines · Hsin-Yi Wang
Quoted 88 lines · Yongqiang Niu
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.Quoted 8 lines
dither enable set in
mtk_dither_setismtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
Quoted 7 lines
We can still call
mtk_dither_set()for bpc is 5 or 6 here, though it will be set to bit2,
but later in mtk_ddp_write(cmdq_pkt, enable ?DITHER_ENGINE_EN:DITHER_RELAY_MODE,&priv->cmdq_reg,priv->regs,DISP_DITHER_CFG); it will be correct back to bit 1.Is this reasonable?
the result is ok.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Regards,
CKQuoted 21 lines
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
In reply to Hsin-Yi WangQuoted 99 lines · Hsin-Yi Wang
Quoted 88 lines · Yongqiang Niu
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.Quoted 8 lines
dither enable set in
mtk_dither_setismtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
Quoted 7 lines
We can still call
mtk_dither_set()for bpc is 5 or 6 here, though it will be set to bit2,
but later in mtk_ddp_write(cmdq_pkt, enable ?DITHER_ENGINE_EN:DITHER_RELAY_MODE,&priv->cmdq_reg,priv->regs,DISP_DITHER_CFG); it will be correct back to bit 1.Is this reasonable?
Looks weird. Maybe pass some information into mtk_dither_set() to set DISP_DITHERING correctly.
I find one thing need to be fixed. CFG should be lower case.
Regards,
CK
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Regards,
CKQuoted 21 lines
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 106 lines · CK Hu
Quoted 105 lines · Hsin-Yi Wang
Quoted 88 lines · Yongqiang Niu
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.Quoted 8 lines
dither enable set in
mtk_dither_setismtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
We can still call
mtk_dither_set()for bpc is 5 or 6 here, though it will be set to bit2,
but later in mtk_ddp_write(cmdq_pkt, enable ?DITHER_ENGINE_EN:DITHER_RELAY_MODE,&priv->cmdq_reg,priv->regs,DISP_DITHER_CFG); it will be correct back to bit 1.
Quoted 6 lines
Quoted 1 line
Is this reasonable?
Looks weird. Maybe pass some information into
mtk_dither_set()to setDISP_DITHERINGcorrectly.I find one thing need to be fixed. CFG should be lower case.
we could modify this like this:
void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc,
unsigned int cfg, u32 dither_enable, struct cmdq_pkt *cmdq_pkt) mtk_ddp_write(cmdq_pkt, dither_enable, comp, cfg);
Quoted 38 lines
Regards,
CKQuoted 32 lines
Quoted 32 lines
Quoted 31 lines
Regards,
CKQuoted 26 lines
Quoted 24 lines
Regards,
CKQuoted 18 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 7/9] drm/mediatek: enable dither function
Quoted 113 lines · Yongqiang Niu
Quoted 111 lines · CK Hu
Quoted 99 lines · Hsin-Yi Wang
Quoted 88 lines · Yongqiang Niu
Quoted 77 lines · CK Hu
Quoted 76 lines · Yongqiang Niu
Quoted 32 lines · CK Hu
Hi, Hsin-Yi:
Quoted 29 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
for 5 or 6 bpc panel, we need enable dither function to improve the display quality
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +2
-0@@ -53,7 +53,9 @@#define DITHER_EN BIT(0)#define DISP_DITHER_CFG 0x0020#define DITHER_RELAY_MODE BIT(0) +#define DITHER_ENGINE_EN BIT(1)#define DISP_DITHER_SIZE 0x0030 +#define DITHER_REG (idx) (0x100 + (idx) * 4)#define LUT_10BIT_MASK 0x03ff@@ -313,8 +315,48 @@ static void mtk_dither_config(struct device *dev, unsigned int w, {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+bool enable = false; + +/* default value for dither reg 5 to 14 */ +const u32 dither_setting[] = {drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 331
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+0x00000000 ,/* 5 */ +0x00003002 ,/* 6 */ +0x00000000 ,/* 7 */ +0x00000000 ,/* 8 */ +0x00000000 ,/* 9 */ +0x00000000 ,/* 10 */ +0x00000000 ,/* 11 */ +0x00000011 ,/* 12 */ +0x00000000 ,/* 13 */ + 0x00000000, /* 14 */Could you explain what is this?
this is dither 5 to dither 14 setting
this will be useless, we just need set dither 5 and dither 7 likemtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_5);mtk_ddp_write(cmdq_pkt, 0, comp, DISP_DITHER_7);
other value is same with hardware default value.Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4
-0+ }; + +if (bpc ==5 || bpc ==6 ) { + enable = true;drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 345
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +10
-0+mtk_ddp_write (cmdq_pkt, +DITHER_LSB_ERR_SHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_ADD_LSHIFT_R (MTK_MAX_BPC - bpc) | +DITHER_NEW_BIT_MODE , + &priv->cmdq_reg, priv->regs,DITHER_REG (15 )); + mtk_ddp_write(cmdq_pkt, + DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) | + DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) | + DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),This result in
0x50505050, but previous version is0x50504040, so this version is correct and previous version is incorrect?Quoted 8 lines
Quoted 3 lines
the new version set r g b 3 channel same, seams more reasonable
So all the setting of
DISP_DITHER_5,DISP_DITHER_7,DISP_DITHER_15,DISP_DITHER_16is identical tomtk_dither_set(), so callmtk_dither_set()instead of duplication here.Quoted 8 lines
dither enable set in
mtk_dither_setismtk_ddp_write(cmdq_pkt, DISP_DITHERING, comp, CFG);that is different 8183 and mt8192. mt8173 dither enable in gamma is bit2 mt8183 and mt8192 dither engine enable is bit 1
Quoted 7 lines
We can still call
mtk_dither_set()for bpc is 5 or 6 here, though it will be set to bit2,
but later in mtk_ddp_write(cmdq_pkt, enable ?DITHER_ENGINE_EN:DITHER_RELAY_MODE,&priv->cmdq_reg,priv->regs,DISP_DITHER_CFG); it will be correct back to bit 1.Is this reasonable?
Looks weird. Maybe pass some information into
mtk_dither_set()to setDISP_DITHERINGcorrectly.
Quoted 11 lines
Quoted 1 line
I find one thing need to be fixed. CFG should be lower case.
we could modify this like this:
void mtk_dither_set(struct
mtk_ddp_comp*comp, unsigned int bpc,
unsigned int cfg, u32dither_enable, structcmdq_pkt*cmdq_pkt)
mtk_ddp_write(cmdq_pkt, dither_enable, comp, cfg);
Thanks, I'll add another flag to mtk_dither_set_common.
Quoted 28 lines
Quoted 28 lines
Regards,
CKQuoted 24 lines
Quoted 24 lines
Quoted 24 lines
Regards,
CKQuoted 21 lines
Quoted 21 lines
Regards,
CKQuoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +13
-1+ &priv->cmdq_reg, priv->regs, DITHER_REG(16)); + } + + +if (enable) { +u32 idx; + +for (idx =0 ; idx <ARRAY_SIZE (dither_setting); idx++) +mtk_ddp_write (cmdq_pkt, dither_setting[idx], &priv->cmdq_reg, priv->regs, +DITHER_REG (idx +5 )); + } +mtk_ddp_write (cmdq_pkt, h <<16 | w, &priv->cmdq_reg, priv->regs,DISP_DITHER_SIZE ); -mtk_ddp_write (cmdq_pkt,DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); +mtk_ddp_write (cmdq_pkt, enable ?DITHER_ENGINE_EN :DITHER_RELAY_MODE , &priv->cmdq_reg, priv->regs,DISP_DITHER_CFG ); }
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c static void mtk_dither_config(struct device *dev, unsigned int w, · line 362
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +0
-0static void mtk_dither_start (struct device *dev)
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v11 8/9 soc: mediatek: add mtk mutex support for MT8183
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
Add mtk mutex support for MT8183 SoC.
--- drivers/soc/mediatek/mtk-mutex.c | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/soc/mediatek/mtk-mutex.c +50 -0
@@ -14,6 +14,8 @@#define MT2701_MUTEX0_MOD0 0x2c#define MT2701_MUTEX0_SOF0 0x30 +#define MT8183_DISP_MUTEX0_MOD0 0x30 +#define MT8183_DISP_MUTEX0_SOF0 0x2c#define DISP_REG_MUTEX_EN (n) (0x20 + 0x20 * (n))#define DISP_REG_MUTEX (n) (0x24 + 0x20 * (n))
@@ -37,6 +39,18 @@#define MT8167_MUTEX_MOD_DISP_DITHER 15#define MT8167_MUTEX_MOD_DISP_UFOE 16 +#define MT8183_MUTEX_MOD_DISP_RDMA0 0 +#define MT8183_MUTEX_MOD_DISP_RDMA1 1 +#define MT8183_MUTEX_MOD_DISP_OVL0 9 +#define MT8183_MUTEX_MOD_DISP_OVL0_2L 10 +#define MT8183_MUTEX_MOD_DISP_OVL1_2L 11 +#define MT8183_MUTEX_MOD_DISP_WDMA0 12 +#define MT8183_MUTEX_MOD_DISP_COLOR0 13 +#define MT8183_MUTEX_MOD_DISP_CCORR0 14 +#define MT8183_MUTEX_MOD_DISP_AAL0 15 +#define MT8183_MUTEX_MOD_DISP_GAMMA0 16 +#define MT8183_MUTEX_MOD_DISP_DITHER0 17 +#define MT8173_MUTEX_MOD_DISP_OVL0 11#define MT8173_MUTEX_MOD_DISP_OVL1 12#define MT8173_MUTEX_MOD_DISP_RDMA0 13
@@ -87,6 +101,11 @@#define MT2712_MUTEX_SOF_DSI3 6#define MT8167_MUTEX_SOF_DPI0 2#define MT8167_MUTEX_SOF_DPI1 3 +#define MT8183_MUTEX_SOF_DSI0 1 +#define MT8183_MUTEX_SOF_DPI0 2 + +#define MT8183_MUTEX_EOF_DSI0 (MT8183_MUTEX_SOF_DSI0 << 6) +#define MT8183_MUTEX_EOF_DPI0 (MT8183_MUTEX_SOF_DPI0 << 6)struct mtk_mutex {int id;
@@ -181,6 +200,20 @@ static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = { [DDP_COMPONENT_WDMA1] = MT8173_MUTEX_MOD_DISP_WDMA1, }; +static const unsigned int mt8183_mutex_mod[DDP_COMPONENT_ID_MAX ] = { + [DDP_COMPONENT_AAL0 ] =MT8183_MUTEX_MOD_DISP_AAL0 , + [DDP_COMPONENT_CCORR ] =MT8183_MUTEX_MOD_DISP_CCORR0 , + [DDP_COMPONENT_COLOR0 ] =MT8183_MUTEX_MOD_DISP_COLOR0 , + [DDP_COMPONENT_DITHER ] =MT8183_MUTEX_MOD_DISP_DITHER0 , + [DDP_COMPONENT_GAMMA ] =MT8183_MUTEX_MOD_DISP_GAMMA0 , + [DDP_COMPONENT_OVL0 ] =MT8183_MUTEX_MOD_DISP_OVL0 , + [DDP_COMPONENT_OVL_2L0 ] =MT8183_MUTEX_MOD_DISP_OVL0_2L , + [DDP_COMPONENT_OVL_2L1 ] =MT8183_MUTEX_MOD_DISP_OVL1_2L , + [DDP_COMPONENT_RDMA0 ] =MT8183_MUTEX_MOD_DISP_RDMA0 , + [DDP_COMPONENT_RDMA1 ] =MT8183_MUTEX_MOD_DISP_RDMA1 , + [DDP_COMPONENT_WDMA0 ] =MT8183_MUTEX_MOD_DISP_WDMA0 , +}; +static const unsigned int mt2712_mutex_sof[MUTEX_SOF_DSI3 +1 ] = { [MUTEX_SOF_SINGLE_MODE ] =MUTEX_SOF_SINGLE_MODE , [MUTEX_SOF_DSI0 ] =MUTEX_SOF_DSI0 ,
@@ -198,6 +231,13 @@ static const unsigned int mt8167_mutex_sof[MUTEX_SOF_DSI3 + 1] = { [MUTEX_SOF_DPI1] = MT8167_MUTEX_SOF_DPI1, }; +/* Add EOF setting so overlay hardware can receive frame done irq */ +static const unsigned int mt8183_mutex_sof[MUTEX_SOF_DSI3 +1 ] = { + [MUTEX_SOF_SINGLE_MODE ] =MUTEX_SOF_SINGLE_MODE , + [MUTEX_SOF_DSI0 ] =MUTEX_SOF_DSI0 |MT8183_MUTEX_EOF_DSI0 , + [MUTEX_SOF_DPI0 ] =MT8183_MUTEX_SOF_DPI0 |MT8183_MUTEX_EOF_DPI0 , +}; +static const struct mtk_mutex_data mt2701_mutex_driver_data = { .mutex_mod = mt2701_mutex_mod, .mutex_sof = mt2712_mutex_sof,
@@ -227,6 +267,14 @@ static const struct mtk_mutex_data mt8173_mutex_driver_data = { .mutex_sof_reg = MT2701_MUTEX0_SOF0, }; +static const struct mtk_mutex_data mt8183_mutex_driver_data = { + .mutex_mod = mt8183_mutex_mod, + .mutex_sof = mt8183_mutex_sof, + .mutex_mod_reg =MT8183_DISP_MUTEX0_MOD0 , + .mutex_sof_reg =MT8183_DISP_MUTEX0_SOF0 , + .no_clk = true, +}; +struct mtk_mutex *mtk_mutex_get (struct device *dev) {struct mtk_mutex_ctx *mtx =dev_get_drvdata (dev);
@@ -457,6 +505,8 @@ static const struct of_device_id mutex_driver_dt_match[] = { .data = &mt8167_mutex_driver_data}, { .compatible = "mediatek,mt8173-disp-mutex", .data = &mt8173_mutex_driver_data}, + { .compatible = "mediatek,mt8183-disp-mutex", + .data = &mt8183_mutex_driver_data}, {}, };MODULE_DEVICE_TABLE (of, mutex_driver_dt_match);
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v11 8/9] soc: mediatek: add mtk mutex support for MT8183
Hi, Hsin-Yi:
Quoted 15 lines · Hsin-Yi Wang
From: Yongqiang Niu <[email protected]>
Add mtk mutex support for MT8183 SoC.
Signed-off-by Yongqiang Niu <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>--- drivers/soc/mediatek/mtk-mutex.c | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)drivers/soc/mediatek/mtk-mutex.c +0
-0
drivers/soc/mediatek/mtk-mutex.c line 18
Quoted 5 lines
drivers/soc/mediatek/mtk-mutex.c +2
-0@@ -14,6 +14,8 @@#define MT2701_MUTEX0_MOD0 0x2c#define MT2701_MUTEX0_SOF0 0x30 +#define MT8183_DISP_MUTEX0_MOD0 0x30 +#define MT8183_DISP_MUTEX0_SOF0 0x2c
Modify 'DISP_MUTEX' to 'MUTEX'
Regards,
CK
Quoted 85 lines
drivers/soc/mediatek/mtk-mutex.c +46
-0#define DISP_REG_MUTEX_EN (n) (0x20 + 0x20 * (n))#define DISP_REG_MUTEX (n) (0x24 + 0x20 * (n))@@ -37,6 +39,18 @@#define MT8167_MUTEX_MOD_DISP_DITHER 15#define MT8167_MUTEX_MOD_DISP_UFOE 16 +#define MT8183_MUTEX_MOD_DISP_RDMA0 0 +#define MT8183_MUTEX_MOD_DISP_RDMA1 1 +#define MT8183_MUTEX_MOD_DISP_OVL0 9 +#define MT8183_MUTEX_MOD_DISP_OVL0_2L 10 +#define MT8183_MUTEX_MOD_DISP_OVL1_2L 11 +#define MT8183_MUTEX_MOD_DISP_WDMA0 12 +#define MT8183_MUTEX_MOD_DISP_COLOR0 13 +#define MT8183_MUTEX_MOD_DISP_CCORR0 14 +#define MT8183_MUTEX_MOD_DISP_AAL0 15 +#define MT8183_MUTEX_MOD_DISP_GAMMA0 16 +#define MT8183_MUTEX_MOD_DISP_DITHER0 17 +#define MT8173_MUTEX_MOD_DISP_OVL0 11#define MT8173_MUTEX_MOD_DISP_OVL1 12#define MT8173_MUTEX_MOD_DISP_RDMA0 13@@ -87,6 +101,11 @@#define MT2712_MUTEX_SOF_DSI3 6#define MT8167_MUTEX_SOF_DPI0 2#define MT8167_MUTEX_SOF_DPI1 3 +#define MT8183_MUTEX_SOF_DSI0 1 +#define MT8183_MUTEX_SOF_DPI0 2 + +#define MT8183_MUTEX_EOF_DSI0 (MT8183_MUTEX_SOF_DSI0 << 6) +#define MT8183_MUTEX_EOF_DPI0 (MT8183_MUTEX_SOF_DPI0 << 6)struct mtk_mutex {int id;@@ -181,6 +200,20 @@ static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = { [DDP_COMPONENT_WDMA1] = MT8173_MUTEX_MOD_DISP_WDMA1, }; +static const unsigned int mt8183_mutex_mod[DDP_COMPONENT_ID_MAX ] = { + [DDP_COMPONENT_AAL0 ] =MT8183_MUTEX_MOD_DISP_AAL0 , + [DDP_COMPONENT_CCORR ] =MT8183_MUTEX_MOD_DISP_CCORR0 , + [DDP_COMPONENT_COLOR0 ] =MT8183_MUTEX_MOD_DISP_COLOR0 , + [DDP_COMPONENT_DITHER ] =MT8183_MUTEX_MOD_DISP_DITHER0 , + [DDP_COMPONENT_GAMMA ] =MT8183_MUTEX_MOD_DISP_GAMMA0 , + [DDP_COMPONENT_OVL0 ] =MT8183_MUTEX_MOD_DISP_OVL0 , + [DDP_COMPONENT_OVL_2L0 ] =MT8183_MUTEX_MOD_DISP_OVL0_2L , + [DDP_COMPONENT_OVL_2L1 ] =MT8183_MUTEX_MOD_DISP_OVL1_2L , + [DDP_COMPONENT_RDMA0 ] =MT8183_MUTEX_MOD_DISP_RDMA0 , + [DDP_COMPONENT_RDMA1 ] =MT8183_MUTEX_MOD_DISP_RDMA1 , + [DDP_COMPONENT_WDMA0 ] =MT8183_MUTEX_MOD_DISP_WDMA0 , +}; +static const unsigned int mt2712_mutex_sof[MUTEX_SOF_DSI3 +1 ] = { [MUTEX_SOF_SINGLE_MODE ] =MUTEX_SOF_SINGLE_MODE , [MUTEX_SOF_DSI0 ] =MUTEX_SOF_DSI0 ,@@ -198,6 +231,13 @@ static const unsigned int mt8167_mutex_sof[MUTEX_SOF_DSI3 + 1] = { [MUTEX_SOF_DPI1] = MT8167_MUTEX_SOF_DPI1, }; +/* Add EOF setting so overlay hardware can receive frame done irq */ +static const unsigned int mt8183_mutex_sof[MUTEX_SOF_DSI3 +1 ] = { + [MUTEX_SOF_SINGLE_MODE ] =MUTEX_SOF_SINGLE_MODE , + [MUTEX_SOF_DSI0 ] =MUTEX_SOF_DSI0 |MT8183_MUTEX_EOF_DSI0 , + [MUTEX_SOF_DPI0 ] =MT8183_MUTEX_SOF_DPI0 |MT8183_MUTEX_EOF_DPI0 , +}; +static const struct mtk_mutex_data mt2701_mutex_driver_data = { .mutex_mod = mt2701_mutex_mod, .mutex_sof = mt2712_mutex_sof,@@ -227,6 +267,14 @@ static const struct mtk_mutex_data mt8173_mutex_driver_data = { .mutex_sof_reg = MT2701_MUTEX0_SOF0, }; +static const struct mtk_mutex_data mt8183_mutex_driver_data = { + .mutex_mod = mt8183_mutex_mod, + .mutex_sof = mt8183_mutex_sof, + .mutex_mod_reg =MT8183_DISP_MUTEX0_MOD0 , + .mutex_sof_reg =MT8183_DISP_MUTEX0_SOF0 , + .no_clk = true, +}; +struct mtk_mutex *mtk_mutex_get (struct device *dev) {struct mtk_mutex_ctx *mtx =dev_get_drvdata (dev);
drivers/soc/mediatek/mtk-mutex.c static const struct of_device_id mutex_driver_dt_match[] = { · line 512
Quoted 8 lines
drivers/soc/mediatek/mtk-mutex.c +2
-0@@ -457,6 +505,8 @@ static const struct of_device_id mutex_driver_dt_match[] = { .data = &mt8167_mutex_driver_data}, { .compatible = "mediatek,mt8173-disp-mutex", .data = &mt8173_mutex_driver_data}, + { .compatible = "mediatek,mt8183-disp-mutex", + .data = &mt8183_mutex_driver_data}, {}, };MODULE_DEVICE_TABLE (of, mutex_driver_dt_match);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v11 9/9 drm/mediatek: add support for mediatek SOC MT8183
In reply to Hsin-Yi WangFrom: Yongqiang Niu <[email protected]>
1. add ovl private data
2. add rdma private data
3. add gamma privte data
4. add main and external path module for crtc create
--- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 +++++++++ drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 6 +++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 45 +++++++++++++++++++++++ 4 files changed, 70 insertions(+)
drivers/gpu/drm/mediatek/mtk_disp_gamma.c +1 -0
@@ -180,6 +180,7 @@ static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = {static const struct of_device_id mtk_disp_gamma_driver_dt_match[] = { { .compatible ="mediatek,mt8173-disp-gamma" , .data = &mt8173_gamma_driver_data}, + { .compatible ="mediatek,mt8183-disp-gamma" }, {}, };MODULE_DEVICE_TABLE (of, mtk_disp_gamma_driver_dt_match);
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +18 -0
@@ -424,11 +424,29 @@ static const struct mtk_disp_ovl_data mt8173_ovl_driver_data = { .fmt_rgb565_is_0 = true, }; +static const struct mtk_disp_ovl_data mt8183_ovl_driver_data = { + .addr =DISP_REG_OVL_ADDR_MT8173 , + .gmc_bits =10 , + .layer_nr =4 , + .fmt_rgb565_is_0 = true, +}; + +static const struct mtk_disp_ovl_data mt8183_ovl_2l_driver_data = { + .addr =DISP_REG_OVL_ADDR_MT8173 , + .gmc_bits =10 , + .layer_nr =2 , + .fmt_rgb565_is_0 = true, +}; +static const struct of_device_id mtk_disp_ovl_driver_dt_match[] = { { .compatible ="mediatek,mt2701-disp-ovl" , .data = &mt2701_ovl_driver_data}, { .compatible ="mediatek,mt8173-disp-ovl" , .data = &mt8173_ovl_driver_data}, + { .compatible ="mediatek,mt8183-disp-ovl" , + .data = &mt8183_ovl_driver_data}, + { .compatible ="mediatek,mt8183-disp-ovl-2l" , + .data = &mt8183_ovl_2l_driver_data}, {}, };MODULE_DEVICE_TABLE (of, mtk_disp_ovl_driver_dt_match);
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +6 -0
@@ -355,11 +355,17 @@ static const struct mtk_disp_rdma_data mt8173_rdma_driver_data = { .fifo_size = SZ_8K, }; +static const struct mtk_disp_rdma_data mt8183_rdma_driver_data = { + .fifo_size =5 *SZ_1K , +}; +static const struct of_device_id mtk_disp_rdma_driver_dt_match[] = { { .compatible ="mediatek,mt2701-disp-rdma" , .data = &mt2701_rdma_driver_data}, { .compatible ="mediatek,mt8173-disp-rdma" , .data = &mt8173_rdma_driver_data}, + { .compatible ="mediatek,mt8183-disp-rdma" , + .data = &mt8183_rdma_driver_data}, {}, };MODULE_DEVICE_TABLE (of, mtk_disp_rdma_driver_dt_match);
drivers/gpu/drm/mediatek/mtk_drm_drv.c +45 -0
97 lines not on this page · raw message
Signature · 7 lines
2.30.0.280.ga3ce27912f-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek