From: Jason-JH Lin <jason-jh.lin@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
<fshao@google.com>, Nancy Lin <nancy.lin@mediatek.com>,
<singo.chang@mediatek.com>
Subject: Re: [PATCH v3 11/12] drm/mediatek: add DSC support for MT8195
Date: Fri, 23 Jul 2021 10:45:11 +0800 [thread overview]
Message-ID: <751b870b61c099deb47ccaa9b6f41bc400163815.camel@mediatek.com> (raw)
In-Reply-To: <CAAOTY__4LUowqv6T6s5bC94Ed8HjM2qWbB4M3_G3m_sDh6nkSg@mail.gmail.com>
Hi CK,
On Fri, 2021-07-16 at 07:21 +0800, Chun-Kuang Hu wrote:
> Hi, Jason:
>
> jason-jh.lin <jason-jh.lin@mediatek.com> 於 2021年7月16日 週五 上午1:38寫道:
> >
> > Add DSC module file:
> > DSC is designed for real-time systems with real-time compression,
> > transmission, decompression and display.
> > The DSC standard is a specification of the algorithms used for
> > compressing and decompressing image display streams, including
> > the specification of the syntax and semantics of the compressed
> > video bit stream.
> >
> > Signed-off-by: jason-jh.lin <jason-jh.lin@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/Makefile | 1 +
> > drivers/gpu/drm/mediatek/mtk_disp_drv.h | 8 +
> > drivers/gpu/drm/mediatek/mtk_disp_dsc.c | 161
> > ++++++++++++++++++++
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 19 ++-
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
> > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +-
> > drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 +
> > 7 files changed, 194 insertions(+), 5 deletions(-)
> > create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_dsc.c
> >
> > diff --git a/drivers/gpu/drm/mediatek/Makefile
> > b/drivers/gpu/drm/mediatek/Makefile
> > index dc54a7a69005..44948e221fd3 100644
> > --- a/drivers/gpu/drm/mediatek/Makefile
> > +++ b/drivers/gpu/drm/mediatek/Makefile
> > @@ -2,6 +2,7 @@
> >
> > mediatek-drm-y := mtk_disp_ccorr.o \
> > mtk_disp_color.o \
> > + mtk_disp_dsc.o \
> > mtk_disp_gamma.o \
> > mtk_disp_ovl.o \
> > mtk_disp_rdma.o \
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > index cafd9df2d63b..c7e9bd370acd 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > @@ -33,6 +33,14 @@ void mtk_dither_set_common(void __iomem *regs,
> > struct cmdq_client_reg *cmdq_reg,
> > void mtk_dpi_start(struct device *dev);
> > void mtk_dpi_stop(struct device *dev);
> >
> > +int mtk_dsc_clk_enable(struct device *dev);
> > +void mtk_dsc_clk_disable(struct device *dev);
> > +void mtk_dsc_config(struct device *dev, unsigned int width,
> > + unsigned int height, unsigned int vrefresh,
> > + unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
> > +void mtk_dsc_start(struct device *dev);
> > +void mtk_dsc_stop(struct device *dev);
> > +
> > void mtk_dsi_ddp_start(struct device *dev);
> > void mtk_dsi_ddp_stop(struct device *dev);
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_dsc.c
> > b/drivers/gpu/drm/mediatek/mtk_disp_dsc.c
> > new file mode 100644
> > index 000000000000..6a196220c532
> > --- /dev/null
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_dsc.c
> > @@ -0,0 +1,161 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2021 MediaTek Inc.
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/component.h>
> > +#include <linux/of_device.h>
> > +#include <linux/of_irq.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/soc/mediatek/mtk-cmdq.h>
> > +
> > +#include "mtk_drm_crtc.h"
> > +#include "mtk_drm_ddp_comp.h"
> > +#include "mtk_drm_gem.h"
> > +#include "mtk_disp_drv.h"
> > +
> > +#define DISP_REG_DSC_CON 0x0000
> > +#define DSC_EN BIT(0)
> > +#define DSC_DUAL_INOUT BIT(2)
> > +#define DSC_BYPASS BIT(4)
> > +#define DSC_UFOE_SEL BIT(16)
> > +
> > +/**
> > + * struct mtk_disp_dsc - DISP_DSC driver structure
> > + * @clk - clk of dsc hardware
> > + * @regs - hardware register address of dsc
> > + * @cmdq_reg - structure containing cmdq hardware resource
> > + */
> > +struct mtk_disp_dsc {
> > + struct clk *clk;
> > + void __iomem *regs;
> > + struct cmdq_client_reg cmdq_reg;
> > +};
>
> Squash mtk_disp_dsc.c into mtk_drm_ddp_comp.c and this patch would be
> much simpler.
>
OK, I'll squash it into mtk_drm_ddp_comp.c at next version.
> > +
> > +void mtk_dsc_start(struct device *dev)
> > +{
> > + struct mtk_disp_dsc *dsc = dev_get_drvdata(dev);
> > + void __iomem *baddr = dsc->regs;
>
> baddr is used only once, so use dsc->regs directly.
OK, I'll fix this.
>
> > +
> > + mtk_ddp_write_mask(NULL, DSC_EN, &dsc->cmdq_reg, baddr,
> > + DISP_REG_DSC_CON, DSC_EN);
> > +}
> > +
> > +void mtk_dsc_stop(struct device *dev)
> > +{
> > + struct mtk_disp_dsc *dsc = dev_get_drvdata(dev);
> > + void __iomem *baddr = dsc->regs;
>
> Ditto.
>
OK, I'll fix this.
> > +
> > + mtk_ddp_write_mask(NULL, 0x0, &dsc->cmdq_reg, baddr,
> > + DISP_REG_DSC_CON, DSC_EN);
> > +}
> > +
> > +int mtk_dsc_clk_enable(struct device *dev)
> > +{
> > + struct mtk_disp_dsc *dsc = dev_get_drvdata(dev);
> > +
> > + return clk_prepare_enable(dsc->clk);
> > +}
> > +
> > +void mtk_dsc_clk_disable(struct device *dev)
> > +{
> > + struct mtk_disp_dsc *dsc = dev_get_drvdata(dev);
> > +
> > + clk_disable_unprepare(dsc->clk);
> > +}
> > +
> > +void mtk_dsc_config(struct device *dev, unsigned int w,
> > + unsigned int h, unsigned int vrefresh,
> > + unsigned int bpc, struct cmdq_pkt *handle)
> > +{
> > + struct mtk_disp_dsc *dsc = dev_get_drvdata(dev);
> > +
> > + /* dsc bypass mode */
> > + mtk_ddp_write_mask(handle, DSC_BYPASS, &dsc->cmdq_reg, dsc-
> > >regs,
> > + DISP_REG_DSC_CON, DSC_BYPASS);
> > + mtk_ddp_write_mask(handle, DSC_UFOE_SEL, &dsc->cmdq_reg,
> > dsc->regs,
> > + DISP_REG_DSC_CON, DSC_UFOE_SEL);
> > + mtk_ddp_write_mask(handle, DSC_DUAL_INOUT, &dsc->cmdq_reg,
> > dsc->regs,
> > + DISP_REG_DSC_CON, DSC_DUAL_INOUT);
> > +}
> > +
> > +static int mtk_disp_dsc_bind(struct device *dev, struct device
> > *master,
> > + void *data)
> > +{
> > + return 0;
> > +}
> > +
> > +static void mtk_disp_dsc_unbind(struct device *dev, struct device
> > *master,
> > + void *data)
> > +{
> > +}
> > +
> > +static const struct component_ops mtk_disp_dsc_component_ops = {
> > + .bind = mtk_disp_dsc_bind,
> > + .unbind = mtk_disp_dsc_unbind,
> > +};
> > +
> > +static int mtk_disp_dsc_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct resource *res;
> > + struct mtk_disp_dsc *priv;
> > + int irq;
> > + int ret;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + priv->clk = devm_clk_get(dev, NULL);
> > + if (IS_ERR(priv->clk)) {
> > + dev_err(dev, "failed to get dsc clk\n");
> > + return PTR_ERR(priv->clk);
> > + }
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + priv->regs = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(priv->regs)) {
> > + dev_err(dev, "failed to ioremap dsc\n");
> > + return PTR_ERR(priv->regs);
> > + }
> > +
> > +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> > + ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0);
> > + if (ret)
> > + dev_dbg(dev, "get mediatek,gce-client-reg
> > fail!\n");
> > +#endif
> > +
> > + platform_set_drvdata(pdev, priv);
> > +
> > + ret = component_add(dev, &mtk_disp_dsc_component_ops);
> > + if (ret != 0)
> > + dev_err(dev, "Failed to add component: %d\n", ret);
> > +
> > + return ret;
> > +}
> > +
> > +static int mtk_disp_dsc_remove(struct platform_device *pdev)
> > +{
> > + component_del(&pdev->dev, &mtk_disp_dsc_component_ops);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id mtk_disp_dsc_driver_dt_match[] =
> > {
> > + { .compatible = "mediatek,mt8195-disp-dsc", },
> > + {},
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, mtk_disp_dsc_driver_dt_match);
> > +
> > +struct platform_driver mtk_disp_dsc_driver = {
> > + .probe = mtk_disp_dsc_probe,
> > + .remove = mtk_disp_dsc_remove,
> > + .driver = {
> > + .name = "mediatek-disp-dsc",
> > + .owner = THIS_MODULE,
> > + .of_match_table = mtk_disp_dsc_driver_dt_match,
> > + },
> > +};
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > index 75bc00e17fc4..ba3d7a1ce7ab 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > @@ -333,6 +333,14 @@ static const struct mtk_ddp_comp_funcs
> > ddp_rdma = {
> > .layer_config = mtk_rdma_layer_config,
> > };
> >
> > +static const struct mtk_ddp_comp_funcs ddp_dsc = {
> > + .config = mtk_dsc_config,
> > + .start = mtk_dsc_start,
> > + .stop = mtk_dsc_stop,
> > + .clk_enable = mtk_dsc_clk_enable,
> > + .clk_disable = mtk_dsc_clk_disable,
> > +};
> > +
> > static const struct mtk_ddp_comp_funcs ddp_ufoe = {
> > .clk_enable = mtk_ddp_clk_enable,
> > .clk_disable = mtk_ddp_clk_disable,
> > @@ -356,6 +364,7 @@ static const char * const
> > mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] = {
> > [MTK_DISP_MUTEX] = "mutex",
> > [MTK_DISP_OD] = "od",
> > [MTK_DISP_BLS] = "bls",
> > + [MTK_DISP_DSC] = "dsc",
> > };
> >
> > struct mtk_ddp_comp_match {
> > @@ -374,6 +383,9 @@ static const struct mtk_ddp_comp_match
> > mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
> > [DDP_COMPONENT_DITHER] = { MTK_DISP_DITHER, 0,
> > &ddp_dither },
> > [DDP_COMPONENT_DPI0] = { MTK_DPI, 0, &ddp_dpi
> > },
> > [DDP_COMPONENT_DPI1] = { MTK_DPI, 1, &ddp_dpi
> > },
> > + [DDP_COMPONENT_DSC0] = { MTK_DISP_DSC, 0, &ddp_dsc
> > },
> > + [DDP_COMPONENT_DSC1] = { MTK_DISP_DSC, 1, &ddp_dsc
> > },
> > + [DDP_COMPONENT_DSC1_VIRTUAL0] = { MTK_DISP_DSC, -1,
> > &ddp_dsc },
>
> What is DDP_COMPONENT_DSC1_VIRTUAL0? If use less, remove it.
DDP_COMPONENT_DSC1_VIRTUAL0 is the MUX without a physical module.
It will be used as the sel_in for DITHER1 and DSC1 and the sel_out for
DSI1, DP_INTF0, SINA_VIRTUAL0 and MERGE0.
So I think we sholud keep this component enum to supoort DITHER1 or
DSC1 sel_in and DSI1 or DP_INTF0 sel_out for dual pipe in the future.
>
> > [DDP_COMPONENT_DSI0] = { MTK_DSI, 0, &ddp_dsi
> > },
> > [DDP_COMPONENT_DSI1] = { MTK_DSI, 1, &ddp_dsi
> > },
> > [DDP_COMPONENT_DSI2] = { MTK_DSI, 2, &ddp_dsi
> > },
> > @@ -508,13 +520,14 @@ int mtk_ddp_comp_init(struct device_node
> > *node, struct mtk_ddp_comp *comp,
> > if (type == MTK_DISP_BLS ||
> > type == MTK_DISP_CCORR ||
> > type == MTK_DISP_COLOR ||
> > + type == MTK_DISP_DSC ||
> > type == MTK_DISP_GAMMA ||
> > - type == MTK_DPI ||
> > - type == MTK_DSI ||
> > type == MTK_DISP_OVL ||
> > type == MTK_DISP_OVL_2L ||
> > type == MTK_DISP_PWM ||
> > - type == MTK_DISP_RDMA)
> > + type == MTK_DISP_RDMA ||
> > + type == MTK_DPI ||
> > + type == MTK_DSI)
>
> Moving MTK_DPI and MTK_DSI is not related to DSC, so move this
> modification to another patch.
>
OK, I will rollback this modification.
> > return 0;
> >
> > priv = devm_kzalloc(comp->dev, sizeof(*priv), GFP_KERNEL);
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > index bb914d976cf5..661fb620e266 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> > @@ -34,6 +34,7 @@ enum mtk_ddp_comp_type {
> > MTK_DISP_MUTEX,
> > MTK_DISP_OD,
> > MTK_DISP_BLS,
> > + MTK_DISP_DSC,
> > MTK_DDP_COMP_TYPE_MAX,
> > };
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > index d6f6d1bdad85..990a54049a7d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > @@ -446,6 +446,8 @@ static const struct of_device_id
> > mtk_ddp_comp_dt_ids[] = {
> > .data = (void *)MTK_DISP_GAMMA, },
> > { .compatible = "mediatek,mt8183-disp-dither",
> > .data = (void *)MTK_DISP_DITHER },
> > + { .compatible = "mediatek,mt8195-disp-dsc",
> > + .data = (void *)MTK_DISP_DSC },
> > { .compatible = "mediatek,mt8173-disp-ufoe",
> > .data = (void *)MTK_DISP_UFOE },
> > { .compatible = "mediatek,mt2701-dsi",
> > @@ -562,12 +564,13 @@ static int mtk_drm_probe(struct
> > platform_device *pdev)
> > */
> > if (comp_type == MTK_DISP_CCORR ||
> > comp_type == MTK_DISP_COLOR ||
> > + comp_type == MTK_DISP_DSC ||
> > comp_type == MTK_DISP_GAMMA ||
> > comp_type == MTK_DISP_OVL ||
> > comp_type == MTK_DISP_OVL_2L ||
> > comp_type == MTK_DISP_RDMA ||
> > - comp_type == MTK_DSI ||
> > - comp_type == MTK_DPI) {
> > + comp_type == MTK_DPI ||
> > + comp_type == MTK_DSI) {
> > dev_info(dev, "Adding component match for
> > %pOF\n",
> > node);
> > drm_of_component_match_add(dev, &match,
> > compare_of,
> > @@ -662,6 +665,7 @@ static struct platform_driver
> > mtk_drm_platform_driver = {
> > static struct platform_driver * const mtk_drm_drivers[] = {
> > &mtk_disp_ccorr_driver,
> > &mtk_disp_color_driver,
> > + &mtk_disp_dsc_driver,
> > &mtk_disp_gamma_driver,
> > &mtk_disp_ovl_driver,
> > &mtk_disp_rdma_driver,
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> > b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> > index 637f5669e895..8b722330ef7d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> > @@ -51,6 +51,7 @@ 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_disp_dsc_driver;
>
> Alphabetic order.
OK, I'll fix this.
>
> Regards,
> Chun-Kuang.
>
> > extern struct platform_driver mtk_dpi_driver;
> > extern struct platform_driver mtk_dsi_driver;
> >
> > --
> > 2.18.0
> >
Regards,
Jason-JH Lin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-07-23 2:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 17:37 [PATCH v3 00/12] Add MediaTek SoC DRM (vdosys0) support for mt8195 jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 01/12] dt-bindings: mediatek: display: change txt to yaml file jason-jh.lin
2021-07-16 17:47 ` Rob Herring
2021-07-15 17:37 ` [PATCH v3 02/12] dt-bindings: mediatek: display: add definition for mt8195 jason-jh.lin
2021-07-16 6:14 ` Fei Shao
2021-07-15 17:37 ` [PATCH v3 03/12] dt-bindings: mediatek: display: add MERGE additional description jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 04/12] dt-bindings: mediatek: add DSC definition for mt8195 jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 05/12] dt-bindings: arm: mediatek: change mmsys txt to yaml file jason-jh.lin
2021-07-16 7:46 ` Fei Shao
2021-07-16 17:42 ` Rob Herring
2021-07-15 17:37 ` [PATCH v3 06/12] dt-bindings: arm: mediatek: add definition for mt8195 mmsys jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 07/12] arm64: dts: mt8195: add display node for vdosys0 jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 08/12] soc: mediatek: add mtk-mmsys support for mt8195 vdosys0 jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 09/12] soc: mediatek: add mtk-mutex " jason-jh.lin
2021-07-15 17:37 ` [PATCH v3 10/12] drm/mediatek: add mediatek-drm of vdosys0 support for MT8195 jason-jh.lin
2021-07-16 4:35 ` CK Hu
2021-07-15 17:37 ` [PATCH v3 11/12] drm/mediatek: add DSC " jason-jh.lin
2021-07-15 23:21 ` Chun-Kuang Hu
2021-07-23 2:45 ` Jason-JH Lin [this message]
2021-07-15 17:37 ` [PATCH v3 12/12] drm/mediatek: add MERGE " jason-jh.lin
2021-07-15 23:50 ` Chun-Kuang Hu
2021-07-23 2:41 ` Jason-JH Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=751b870b61c099deb47ccaa9b6f41bc400163815.camel@mediatek.com \
--to=jason-jh.lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=chunkuang.hu@kernel.org \
--cc=fshao@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nancy.lin@mediatek.com \
--cc=singo.chang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox