drm/mediatek: Add PQ components support for MT8196
Subsystems (5)
v5 cover drm/mediatek: Add PQ components support for MT8196
This series adds Picture Quality (PQ) component support for the MT8196 SoC, including device tree bindings and driver implementations for GAMMA, DITHER, CCORR, and TDSHP modules.
Patch 1: Add GAMMA compatible string for MT8196 Patch 2: Add DITHER compatible string for MT8196 Patch 3: Add CCORR compatible string for MT8196 Patch 4: Add TDSHP dt-binding documentation Patch 5: Add support for multiple CCORR components Patch 6: Add TDSHP driver support for MT8196
Architecture notes:
MT8196 display pipeline includes two CCORR instances that must be chained in the hardware path, but the CTM API only configures one. Patch 5 ensures the second CCORR instance does not interfere with the configured one.
Testing:
- Verified dt-bindings pass dt_binding_check
- Tested display pipeline with all PQ components on MT8196 EVB
- Confirmed color correction (CCORR CTM and GAMMA LUT) functionality
- Confirmed sharpness enhancement (TDSHP) functionality in relay mode
- Note: dtbs_check will be validated when MT8196 DTS is upstreamed
Changes in v5:
- Cover letter: Fix subject spelling and add subsystem prefix
- tdshp dt-binding: Replace 'disp-tdshp' with 'tdshp' in dt-binding (suggested by Krzysztof)
- Add complete version history and lore links for tracking (suggested by Krzysztof)
Changes in v4:
- tdshp dt-binding: Remove unused 'Sibling' description (suggested by Krzysztof)
- tdshp dt-binding: Use enum directly instead of items list for compatible property
- tdshp dt-binding: Fix indentation and remove extra blank line in example section
- ccorr driver: Rebase on linux-next to resolve conflicts
Changes in v3:
- Fix dt_binding_check errors in all binding patches
- Remove incorrect Signed-off-by line
- Move standalone ccorr fix out of this series
Changes in v2:
- Optimize ccorr ctm_set process to avoid affecting other SoCs
- Remove unnecessary code from tdshp driver
- Update tdshp dt-bindings (clocks, description, examples)
Link to v4: https://lore.kernel.org/all/[email protected]/
Link to v3: https://lore.kernel.org/all/[email protected]/
Link to v2: https://lore.kernel.org/all/[email protected]/
Link to v1: https://lore.kernel.org/all/[email protected]/
Dependencies:
This series depends on the MT8196 display pipeline foundation patches [1].
[1] "Add display path components support for MT8196"
https://patchwork.kernel.org/project/linux-mediatek/list/?series=955361
Jay Liu (6):
dt-bindings: display: mediatek: gamma: Add support for MT8196
dt-bindings: display: mediatek: dither: Add support for MT8196
dt-bindings: display: mediatek: ccorr: Add support for MT8196
dt-bindings: display: mediatek: tdshp: Add support for MT8196 drm/mediatek: Support multiple CCORR component drm/mediatek: Add TDSHP component support for MT8196
.../display/mediatek/mediatek,ccorr.yaml | 1 + .../display/mediatek/mediatek,dither.yaml | 1 + .../display/mediatek/mediatek,gamma.yaml | 1 + .../display/mediatek/mediatek,tdshp.yaml | 46 ++++++++++++++++ drivers/gpu/drm/mediatek/mtk_crtc.c | 5 +- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 52 ++++++++++++++++++- drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 8 +-- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 6 ++- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 + 10 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml
Signature · 1 line
2.46.0
PATCH v5 1/6 dt-bindings: display: mediatek: gamma: Add support for MT8196
Add a compatible string for the GAMMA IP found in the MT8196 SoC. Each GAMMA IP of this SoC is fully compatible with the ones found in MT8195.
--- .../devicetree/bindings/display/mediatek/mediatek,gamma.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml +1 -0
@@ -41,6 +41,7 @@ properties: - items: - enum: - mediatek,mt8188-disp-gamma + - mediatek,mt8196-disp-gamma - const: mediatek,mt8195-disp-gamma reg:
Signature · 1 line
2.46.0
Re: [PATCH v5 1/6] dt-bindings: display: mediatek: gamma: Add support for MT8196
Quoted 3 lines · Jay Liu
Add a compatible string for the GAMMA IP found in the MT8196 SoC. Each GAMMA IP of this SoC is fully compatible with the ones found in MT8195.
Quoted 20 lines
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Jay Liu <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,gamma.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/mediatek/mediatek,gamma.yaml +1
-0@@ -41,6 +41,7 @@ properties: - items: - enum: - mediatek,mt8188-disp-gamma + - mediatek,mt8196-disp-gamma - const: mediatek,mt8195-disp-gamma reg:
PATCH v5 2/6 dt-bindings: display: mediatek: dither: Add support for MT8196
In reply to Jay LiuAdd a compatible string for the DITHER IP found in the MT8196 SoC. Each DITHER IP of this SoC is fully compatible with the ones found in MT8183.
--- .../devicetree/bindings/display/mediatek/mediatek,dither.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,dither.yaml +1 -0
@@ -31,6 +31,7 @@ properties: - mediatek,mt8188-disp-dither - mediatek,mt8192-disp-dither - mediatek,mt8195-disp-dither + - mediatek,mt8196-disp-dither - mediatek,mt8365-disp-dither - const: mediatek,mt8183-disp-dither
Signature · 1 line
2.46.0
Re: [PATCH v5 2/6] dt-bindings: display: mediatek: dither: Add support for MT8196
Quoted 3 lines · Jay Liu
Add a compatible string for the DITHER IP found in the MT8196 SoC. Each DITHER IP of this SoC is fully compatible with the ones found in MT8183.
Quoted 20 lines
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Jay Liu <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,dither.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/mediatek/mediatek,dither.yaml +1
-0@@ -31,6 +31,7 @@ properties: - mediatek,mt8188-disp-dither - mediatek,mt8192-disp-dither - mediatek,mt8195-disp-dither + - mediatek,mt8196-disp-dither - mediatek,mt8365-disp-dither - const: mediatek,mt8183-disp-dither
PATCH v5 3/6 dt-bindings: display: mediatek: ccorr: Add support for MT8196
In reply to Jay LiuAdd a compatible string for the CCORR IP found in the MT8196 SoC. Each CCORR IP of this SoC is fully compatible with the ones found in MT8192.
--- .../devicetree/bindings/display/mediatek/mediatek,ccorr.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml +1 -0
@@ -34,6 +34,7 @@ properties: - mediatek,mt8186-disp-ccorr - mediatek,mt8188-disp-ccorr - mediatek,mt8195-disp-ccorr + - mediatek,mt8196-disp-ccorr - const: mediatek,mt8192-disp-ccorr reg:
Signature · 1 line
2.46.0
Re: [PATCH v5 3/6] dt-bindings: display: mediatek: ccorr: Add support for MT8196
Quoted 3 lines · Jay Liu
Add a compatible string for the CCORR IP found in the MT8196 SoC. Each CCORR IP of this SoC is fully compatible with the ones found in MT8192.
Quoted 20 lines
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Jay Liu <[email protected]>--- .../devicetree/bindings/display/mediatek/mediatek,ccorr.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml +1
-0@@ -34,6 +34,7 @@ properties: - mediatek,mt8186-disp-ccorr - mediatek,mt8188-disp-ccorr - mediatek,mt8195-disp-ccorr + - mediatek,mt8196-disp-ccorr - const: mediatek,mt8192-disp-ccorr reg:
PATCH v5 4/6 dt-bindings: display: mediatek: tdshp: Add support for MT8196
In reply to Jay LiuAdd tdshp hardware description for MediaTek MT8196 SoC
--- .../display/mediatek/mediatek,tdshp.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +46 -0
@@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/mediatek/mediatek,tdshp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek display 2D sharpness processor + +maintainers: + - Chun-Kuang Hu <[email protected]> + - Philipp Zabel <[email protected]> + +description: | + MediaTek display 2D sharpness processor, namely TDSHP, provides a + operation used to adjust sharpness in display system. + +properties: + compatible: + enum: + - mediatek,mt8196-disp-tdshp + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + + tdshp@321e0000 { + compatible = "mediatek,mt8196-disp-tdshp"; + reg = <0 0x321e0000 0 0x1000>; + clocks = <&dispsys_config_clk 107>; + }; + };
Signature · 1 line
2.46.0
Re: [PATCH v5 4/6] dt-bindings: display: mediatek: tdshp: Add support for MT8196
Quoted 18 lines · Jay Liu
Add tdshp hardware description for MediaTek MT8196 SoC
Signed-off-by Jay Liu <[email protected]>--- .../display/mediatek/mediatek,tdshp.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yamlDocumentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +4
-0@@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: https://urldefense.com/v3/__http://devicetree.org/schemas/display/mediatek/mediatek,tdshp.yaml*__;Iw!!CTRNKA9wMg0ARbw!jvLiL6w7ScJqhkM0IyiLok4cwzb-e1gME-mO9r5lLT3JTrgaBBiiV1j8LFkmJkIafaGiBya2GJN6h38e$
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml line 14
Quoted 10 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +10
-0+$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!jvLiL6w7ScJqhkM0IyiLok4cwzb-e1gME-mO9r5lLT3JTrgaBBiiV1j8LFkmJkIafaGiBya2GCPflrFz$ + +title: MediaTek display 2D sharpness processor + +maintainers: + - Chun-Kuang Hu <[email protected]> + - Philipp Zabel <[email protected]> + +description: | + MediaTek display 2D sharpness processor, namely TDSHP, provides a
a -> an
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml line 26
Quoted 12 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +12
-0+ operation used to adjust sharpness in display system. + +properties: + compatible: + enum: + - mediatek,mt8196-disp-tdshp + + reg: + maxItems: 1 + + clocks: + maxItems: 1
Refer to other display block binding document, and find out the common property. Such as power-domains, gce-client-reg, ports.
Regards,
CK
Quoted 20 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +20
-0+ +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + + tdshp@321e0000 { + compatible = "mediatek,mt8196-disp-tdshp"; + reg = <0 0x321e0000 0 0x1000>; + clocks = <&dispsys_config_clk 107>; + }; + };
Re: [PATCH v5 4/6] dt-bindings: display: mediatek: tdshp: Add support for MT8196
Quoted 63 lines · CK Hu (胡俊光)
Quoted 41 lines · Jay Liu
Add tdshp hardware description for MediaTek MT8196 SoC
Signed-off-by Jay Liu <[email protected]>--- .../display/mediatek/mediatek,tdshp.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yamldiff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp .yaml b/Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp .yaml
new file mode 100644
index 000000000000..50b24cc22420
---/dev/null
+++
b/Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp .yamlDocumentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +4
-0@@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id:Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +9
-0+ +title: MediaTek display 2D sharpness processor + +maintainers: + - Chun-Kuang Hu <[email protected]> + - Philipp Zabel <[email protected]> + +description: | + MediaTek display 2D sharpness processor, namely TDSHP, providesQuoted 1 line
a
a -> an
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml line 26
Quoted 12 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +12
-0+ operation used to adjust sharpness in display system. + +properties: + compatible: + enum: + - mediatek,mt8196-disp-tdshp + + reg: + maxItems: 1 + + clocks: + maxItems: 1Refer to other display block binding document, and find out the common property.
Such as power-domains, gce-client-reg, ports.
Quoted 3 lines
Regards,
CK
Thank you for your review and helpful suggestions.
I will review other display block binding documents and identify the common properties, such as power-domains, gce-client-reg, and ports. If I have further questions or need clarification, I will reach out.
Thanks again for your guidance.
Best regards,
Jay
Quoted 22 lines
Quoted 20 lines
Documentation/devicetree/bindings/display/mediatek/mediatek,tdshp.yaml new file +20
-0+ +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <2>; + #size-cells = <2>; + + tdshp@321e0000 { + compatible = "mediatek,mt8196-disp-tdshp"; + reg = <0 0x321e0000 0 0x1000>; + clocks = <&dispsys_config_clk 107>; + }; + };
PATCH v5 5/6 drm/mediatek: Support multiple CCORR component
In reply to Jay LiuAdd CCORR component support for MT8196.
CCORR is a hardware module that optimizes the visual effects of images by adjusting the color matrix, enabling features such as night light.
The 8196 SoC has two CCORR hardware units, which must be chained together in a fixed order in the display path to display the image correctly. the mtk_ccorr_ctm_set API only utilizes one of these units. To prevent the unused CCORR unit from inadvertently taking effect, we need to block it in the mtk_crtc.c.
--- drivers/gpu/drm/mediatek/mtk_crtc.c | 5 ++++- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 3 ++- drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 7 ++++--- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 6 ++++-- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/mediatek/mtk_crtc.c +4 -1
@@ -872,11 +872,14 @@ static void mtk_crtc_atomic_flush(struct drm_crtc *crtc, {struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc);int i; +bool ctm_set = false;if (crtc->state->color_mgmt_changed)for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) {mtk_ddp_gamma_set (mtk_crtc->ddp_comp[i], crtc->state); -mtk_ddp_ctm_set (mtk_crtc->ddp_comp[i], crtc->state); +/* only set ctm once for the pipeline with two CCORR components */ +if (!ctm_set) + ctm_set =mtk_ddp_ctm_set (mtk_crtc->ddp_comp[i], crtc->state); }mtk_crtc_update_config (mtk_crtc, !!mtk_crtc->event); }
drivers/gpu/drm/mediatek/mtk_ddp_comp.c +2 -1
@@ -458,7 +458,8 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_DRM_ID_MAX] [DDP_COMPONENT_AAL0] = { MTK_DISP_AAL, 0, &ddp_aal }, [DDP_COMPONENT_AAL1] = { MTK_DISP_AAL, 1, &ddp_aal }, [DDP_COMPONENT_BLS] = { MTK_DISP_BLS, 0, NULL }, - [DDP_COMPONENT_CCORR] = { MTK_DISP_CCORR, 0, &ddp_ccorr }, + [DDP_COMPONENT_CCORR0] = { MTK_DISP_CCORR, 0, &ddp_ccorr }, + [DDP_COMPONENT_CCORR1] = { MTK_DISP_CCORR, 1, &ddp_ccorr }, [DDP_COMPONENT_COLOR0] = { MTK_DISP_COLOR, 0, &ddp_color }, [DDP_COMPONENT_COLOR1] = { MTK_DISP_COLOR, 1, &ddp_color }, [DDP_COMPONENT_DITHER0] = { MTK_DISP_DITHER, 0, &ddp_dither },
drivers/gpu/drm/mediatek/mtk_ddp_comp.h +4 -3
@@ -77,7 +77,7 @@ struct mtk_ddp_comp_funcs { struct drm_crtc_state *state);void (*bgclr_in_on)(struct device *dev);void (*bgclr_in_off)(struct device *dev); -void (*ctm_set)(struct device *dev, +bool (*ctm_set)(struct device *dev,struct drm_crtc_state *state);struct device * (*dma_dev_get)(struct device *dev);u32 (*get_blend_modes)(struct device *dev);
@@ -254,11 +254,12 @@ static inline void mtk_ddp_comp_bgclr_in_off(struct mtk_ddp_comp *comp) comp->funcs->bgclr_in_off (comp->dev); } -static inline void mtk_ddp_ctm_set (struct mtk_ddp_comp *comp, +static inline bool mtk_ddp_ctm_set (struct mtk_ddp_comp *comp,struct drm_crtc_state *state) {if (comp->funcs && comp->funcs->ctm_set) - comp->funcs->ctm_set (comp->dev, state); +return comp->funcs->ctm_set (comp->dev, state); +return false; }static inline struct device *mtk_ddp_comp_dma_dev_get (struct mtk_ddp_comp *comp)
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +4 -2
@@ -80,7 +80,7 @@ void mtk_ccorr_stop(struct device *dev)writel_relaxed (0x0 , ccorr->regs +DISP_CCORR_EN ); } -void mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state) +bool mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state) {struct mtk_disp_ccorr *ccorr =dev_get_drvdata (dev);struct drm_property_blob *blob = state->ctm;
@@ -92,7 +92,7 @@ void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state)u32 matrix_bits = ccorr->data->matrix_bits;if (!blob) -return ; +return false; ctm = (struct drm_color_ctm *)blob->data; input = ctm->matrix;
@@ -110,6 +110,8 @@ void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state) &ccorr->cmdq_reg, ccorr->regs, DISP_CCORR_COEF_3);mtk_ddp_write (cmdq_pkt, coeffs[8 ] <<16 , &ccorr->cmdq_reg, ccorr->regs,DISP_CCORR_COEF_4 ); + +return true; } static int mtk_disp_ccorr_bind(struct device *dev, struct device *master,
drivers/gpu/drm/mediatek/mtk_disp_drv.h +1 -1
@@ -22,7 +22,7 @@ void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state);void mtk_aal_start (struct device *dev);void mtk_aal_stop (struct device *dev); -void mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state); +bool mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state);int mtk_ccorr_clk_enable (struct device *dev);void mtk_ccorr_clk_disable (struct device *dev); void mtk_ccorr_config(struct device *dev, unsigned int w,
Signature · 1 line
2.46.0
Re: [PATCH v5 5/6] drm/mediatek: Support multiple CCORR component
Quoted 9 lines · Jay Liu
Add CCORR component support for MT8196.
CCORR is a hardware module that optimizes the visual effects of images by adjusting the color matrix, enabling features such as night light.The 8196 SoC has two CCORR hardware units, which must be chained together in a fixed order in the display path to display the image correctly. the
mtk_ccorr_ctm_setAPI only utilizes one of these units. To prevent the unused CCORR unit from inadvertently taking effect, we need to block it in themtk_crtc.c.
Quoted 117 lines
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Jay Liu <[email protected]>--- drivers/gpu/drm/mediatek/mtk_crtc.c | 5 ++++- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 3 ++- drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 7 ++++--- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 6 ++++-- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-)drivers/gpu/drm/mediatek/mtk_crtc.c +4
-1@@ -872,11 +872,14 @@ static void mtk_crtc_atomic_flush(struct drm_crtc *crtc, {struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc);int i; +bool ctm_set = false;if (crtc->state->color_mgmt_changed)for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) {mtk_ddp_gamma_set (mtk_crtc->ddp_comp[i], crtc->state); -mtk_ddp_ctm_set (mtk_crtc->ddp_comp[i], crtc->state); +/* only set ctm once for the pipeline with two CCORR components */ +if (!ctm_set) + ctm_set =mtk_ddp_ctm_set (mtk_crtc->ddp_comp[i], crtc->state); }mtk_crtc_update_config (mtk_crtc, !!mtk_crtc->event); }drivers/gpu/drm/mediatek/mtk_ddp_comp.c +2
-1@@ -458,7 +458,8 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_DRM_ID_MAX] [DDP_COMPONENT_AAL0] = { MTK_DISP_AAL, 0, &ddp_aal }, [DDP_COMPONENT_AAL1] = { MTK_DISP_AAL, 1, &ddp_aal }, [DDP_COMPONENT_BLS] = { MTK_DISP_BLS, 0, NULL }, - [DDP_COMPONENT_CCORR] = { MTK_DISP_CCORR, 0, &ddp_ccorr }, + [DDP_COMPONENT_CCORR0] = { MTK_DISP_CCORR, 0, &ddp_ccorr }, + [DDP_COMPONENT_CCORR1] = { MTK_DISP_CCORR, 1, &ddp_ccorr }, [DDP_COMPONENT_COLOR0] = { MTK_DISP_COLOR, 0, &ddp_color }, [DDP_COMPONENT_COLOR1] = { MTK_DISP_COLOR, 1, &ddp_color }, [DDP_COMPONENT_DITHER0] = { MTK_DISP_DITHER, 0, &ddp_dither },drivers/gpu/drm/mediatek/mtk_ddp_comp.h +4
-3@@ -77,7 +77,7 @@ struct mtk_ddp_comp_funcs { struct drm_crtc_state *state);void (*bgclr_in_on)(struct device *dev);void (*bgclr_in_off)(struct device *dev); -void (*ctm_set)(struct device *dev, +bool (*ctm_set)(struct device *dev,struct drm_crtc_state *state);struct device * (*dma_dev_get)(struct device *dev);u32 (*get_blend_modes)(struct device *dev);@@ -254,11 +254,12 @@ static inline void mtk_ddp_comp_bgclr_in_off(struct mtk_ddp_comp *comp) comp->funcs->bgclr_in_off (comp->dev); } -static inline void mtk_ddp_ctm_set (struct mtk_ddp_comp *comp, +static inline bool mtk_ddp_ctm_set (struct mtk_ddp_comp *comp,struct drm_crtc_state *state) {if (comp->funcs && comp->funcs->ctm_set) - comp->funcs->ctm_set (comp->dev, state); +return comp->funcs->ctm_set (comp->dev, state); +return false; }static inline struct device *mtk_ddp_comp_dma_dev_get (struct mtk_ddp_comp *comp)drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +4
-2@@ -80,7 +80,7 @@ void mtk_ccorr_stop(struct device *dev)writel_relaxed (0x0 , ccorr->regs +DISP_CCORR_EN ); } -void mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state) +bool mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state) {struct mtk_disp_ccorr *ccorr =dev_get_drvdata (dev);struct drm_property_blob *blob = state->ctm;@@ -92,7 +92,7 @@ void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state)u32 matrix_bits = ccorr->data->matrix_bits;if (!blob) -return ; +return false; ctm = (struct drm_color_ctm *)blob->data; input = ctm->matrix;@@ -110,6 +110,8 @@ void mtk_ccorr_ctm_set(struct device *dev, struct drm_crtc_state *state) &ccorr->cmdq_reg, ccorr->regs, DISP_CCORR_COEF_3);mtk_ddp_write (cmdq_pkt, coeffs[8 ] <<16 , &ccorr->cmdq_reg, ccorr->regs,DISP_CCORR_COEF_4 ); + +return true; } static int mtk_disp_ccorr_bind(struct device *dev, struct device *master,drivers/gpu/drm/mediatek/mtk_disp_drv.h +1
-1@@ -22,7 +22,7 @@ void mtk_aal_gamma_set(struct device *dev, struct drm_crtc_state *state);void mtk_aal_start (struct device *dev);void mtk_aal_stop (struct device *dev); -void mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state); +bool mtk_ccorr_ctm_set (struct device *dev,struct drm_crtc_state *state);int mtk_ccorr_clk_enable (struct device *dev);void mtk_ccorr_clk_disable (struct device *dev); void mtk_ccorr_config(struct device *dev, unsigned int w,
PATCH v5 6/6 drm/mediatek: Add TDSHP component support for MT8196
In reply to Jay LiuAdd TDSHP component support for MT8196.
TDSHP is a hardware module designed to enhance the sharpness and clarity of displayed images by analyzing and improving edges and fine details in frames.
--- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 49 +++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 + 3 files changed, 52 insertions(+)
drivers/gpu/drm/mediatek/mtk_ddp_comp.c +49 -0
@@ -57,6 +57,14 @@#define POSTMASK_RELAY_MODE BIT(0)#define DISP_REG_POSTMASK_SIZE 0x0030 +#define DISP_REG_TDSHP_CTRL 0x0100 +#define DISP_TDSHP_CTRL_EN BIT(0) +#define DISP_REG_TDSHP_CFG 0x0110 +#define DISP_TDSHP_RELAY_MODE BIT(0) +#define DISP_REG_TDSHP_INPUT_SIZE 0x0120 +#define DISP_REG_TDSHP_OUTPUT_OFFSET 0x0124 +#define DISP_REG_TDSHP_OUTPUT_SIZE 0x0128 +#define DISP_REG_UFO_START 0x0000#define UFO_BYPASS BIT(2)
@@ -261,6 +269,37 @@ static void mtk_postmask_stop(struct device *dev)writel_relaxed (0x0 , priv->regs +DISP_REG_POSTMASK_EN ); } +static void mtk_disp_tdshp_config (struct device *dev,unsigned int w, +unsigned int h,unsigned int vrefresh, +unsigned int bpc,struct cmdq_pkt *cmdq_pkt) +{ +struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); + +mtk_ddp_write (cmdq_pkt, w <<16 | h, &priv->cmdq_reg, priv->regs, +DISP_REG_TDSHP_INPUT_SIZE ); +mtk_ddp_write (cmdq_pkt, w <<16 | h, &priv->cmdq_reg, priv->regs, +DISP_REG_TDSHP_OUTPUT_SIZE ); +mtk_ddp_write (cmdq_pkt,0x0 , &priv->cmdq_reg, priv->regs, +DISP_REG_TDSHP_OUTPUT_OFFSET ); + +mtk_ddp_write (cmdq_pkt,DISP_TDSHP_RELAY_MODE , &priv->cmdq_reg, + priv->regs,DISP_REG_TDSHP_CFG ); +} + +static void mtk_disp_tdshp_start (struct device *dev) +{ +struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); + +writel (DISP_TDSHP_CTRL_EN , priv->regs +DISP_REG_TDSHP_CTRL ); +} + +static void mtk_disp_tdshp_stop (struct device *dev) +{ +struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev); + +writel (0 , priv->regs +DISP_REG_TDSHP_CTRL ); +} +static void mtk_ufoe_start (struct device *dev) {struct mtk_ddp_comp_dev *priv =dev_get_drvdata (dev);
@@ -268,6 +307,14 @@ static void mtk_ufoe_start(struct device *dev)writel (UFO_BYPASS , priv->regs +DISP_REG_UFO_START ); } +static const struct mtk_ddp_comp_funcs ddp_tdshp = { + .clk_enable = mtk_ddp_clk_enable, + .clk_disable = mtk_ddp_clk_disable, + .config = mtk_disp_tdshp_config, + .start = mtk_disp_tdshp_start, + .stop = mtk_disp_tdshp_stop, +}; +static const struct mtk_ddp_comp_funcs ddp_aal = { .clk_enable = mtk_aal_clk_enable, .clk_disable = mtk_aal_clk_disable,
@@ -441,6 +488,7 @@ static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] = { [MTK_DISP_POSTMASK] = "postmask", [MTK_DISP_PWM] = "pwm", [MTK_DISP_RDMA] = "rdma", + [MTK_DISP_TDSHP] = "tdshp", [MTK_DISP_UFOE] = "ufoe", [MTK_DISP_WDMA] = "wdma", [MTK_DP_INTF] = "dp-intf",
@@ -496,6 +544,7 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_DRM_ID_MAX] [DDP_COMPONENT_RDMA1] = { MTK_DISP_RDMA, 1, &ddp_rdma }, [DDP_COMPONENT_RDMA2] = { MTK_DISP_RDMA, 2, &ddp_rdma }, [DDP_COMPONENT_RDMA4] = { MTK_DISP_RDMA, 4, &ddp_rdma }, + [DDP_COMPONENT_TDSHP0] = { MTK_DISP_TDSHP, 0, &ddp_tdshp }, [DDP_COMPONENT_UFOE] = { MTK_DISP_UFOE, 0, &ddp_ufoe }, [DDP_COMPONENT_WDMA0] = { MTK_DISP_WDMA, 0, NULL }, [DDP_COMPONENT_WDMA1] = { MTK_DISP_WDMA, 1, NULL },
drivers/gpu/drm/mediatek/mtk_ddp_comp.h +1 -0
@@ -38,6 +38,7 @@ enum mtk_ddp_comp_type {MTK_DISP_POSTMASK ,MTK_DISP_PWM ,MTK_DISP_RDMA , +MTK_DISP_TDSHP ,MTK_DISP_UFOE ,MTK_DISP_WDMA , MTK_DPI,
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -794,6 +794,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DISP_RDMA }, { .compatible = "mediatek,mt8195-disp-rdma", .data = (void *)MTK_DISP_RDMA }, + { .compatible = "mediatek,mt8196-disp-tdshp", + .data = (void *)MTK_DISP_TDSHP }, { .compatible = "mediatek,mt8173-disp-ufoe", .data = (void *)MTK_DISP_UFOE }, { .compatible = "mediatek,mt8173-disp-wdma",
Signature · 1 line
2.46.0