2020-08-20 06:08:03

by Yongqiang Niu

[permalink] [raw]
Subject: [PATCH v1 05/21] mtk-mmsys: add ovl mout on support

add ovl mout on support

Signed-off-by: Yongqiang Niu <[email protected]>
---
drivers/soc/mediatek/mmsys/mt8192-mmsys.c | 23 +++++++++++++++++++++++
drivers/soc/mediatek/mtk-mmsys.c | 8 ++++++++
include/linux/soc/mediatek/mtk-mmsys.h | 3 +++
3 files changed, 34 insertions(+)

diff --git a/drivers/soc/mediatek/mmsys/mt8192-mmsys.c b/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
index 006d41d..06080ad 100644
--- a/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
+++ b/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
@@ -134,10 +134,33 @@ static void mtk_mmsys_ddp_sout_sel(void __iomem *config_regs,
}
}

+static int mtk_mmsys_ovl_mout_en(enum mtk_ddp_comp_id cur,
+ enum mtk_ddp_comp_id next,
+ unsigned int *addr)
+{
+ int value = -1;
+
+ *addr = MT8192_MMSYS_OVL_MOUT_EN;
+
+ if (cur == DDP_COMPONENT_OVL0 && next == DDP_COMPONENT_OVL_2L0)
+ value = DISP_OVL0_GO_BG;
+ else if (cur == DDP_COMPONENT_OVL_2L0 && next == DDP_COMPONENT_OVL0)
+ value = DISP_OVL0_2L_GO_BG;
+ else if (cur == DDP_COMPONENT_OVL0)
+ value = DISP_OVL0_GO_BLEND;
+ else if (cur == DDP_COMPONENT_OVL_2L0)
+ value = DISP_OVL0_2L_GO_BLEND;
+ else
+ value = -1;
+
+ return value;
+}
+
static struct mtk_mmsys_conn_funcs mmsys_funcs = {
.mout_en = mtk_mmsys_ddp_mout_en,
.sel_in = mtk_mmsys_ddp_sel_in,
.sout_sel = mtk_mmsys_ddp_sout_sel,
+ .ovl_mout_en = mtk_mmsys_ovl_mout_en,
};

static int mmsys_probe(struct platform_device *pdev)
diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index 828d59e..1362d01 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -76,6 +76,14 @@ void mtk_mmsys_ddp_connect(struct device *dev,
reg = readl_relaxed(config_regs + addr) | value;
writel_relaxed(reg, config_regs + addr);
}
+
+ if (priv_funcs->ovl_mout_en) {
+ value = priv_funcs->ovl_mout_en(cur, next, &addr);
+ if (value >= 0) {
+ reg = readl_relaxed(config_regs + addr) | value;
+ writel_relaxed(reg, config_regs + addr);
+ }
+ }
}
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_connect);

diff --git a/include/linux/soc/mediatek/mtk-mmsys.h b/include/linux/soc/mediatek/mtk-mmsys.h
index 8ef3eaa..eefc7b1 100644
--- a/include/linux/soc/mediatek/mtk-mmsys.h
+++ b/include/linux/soc/mediatek/mtk-mmsys.h
@@ -55,6 +55,9 @@ struct mtk_mmsys_conn_funcs {
void (*sout_sel)(void __iomem *config_regs,
enum mtk_ddp_comp_id cur,
enum mtk_ddp_comp_id next);
+ int (*ovl_mout_en)(enum mtk_ddp_comp_id cur,
+ enum mtk_ddp_comp_id next,
+ unsigned int *addr);
};

void mtk_mmsys_register_conn_funcs(struct device *dev,
--
1.8.1.1.dirty


2020-08-21 00:02:43

by Chun-Kuang Hu

[permalink] [raw]
Subject: Re: [PATCH v1 05/21] mtk-mmsys: add ovl mout on support

Hi, Yongqiang:

Yongqiang Niu <[email protected]> 於 2020年8月20日 週四 下午2:16寫道:
>
> add ovl mout on support
>
> Signed-off-by: Yongqiang Niu <[email protected]>
> ---
> drivers/soc/mediatek/mmsys/mt8192-mmsys.c | 23 +++++++++++++++++++++++
> drivers/soc/mediatek/mtk-mmsys.c | 8 ++++++++
> include/linux/soc/mediatek/mtk-mmsys.h | 3 +++
> 3 files changed, 34 insertions(+)
>
> diff --git a/drivers/soc/mediatek/mmsys/mt8192-mmsys.c b/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
> index 006d41d..06080ad 100644
> --- a/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
> +++ b/drivers/soc/mediatek/mmsys/mt8192-mmsys.c
> @@ -134,10 +134,33 @@ static void mtk_mmsys_ddp_sout_sel(void __iomem *config_regs,
> }
> }
>
> +static int mtk_mmsys_ovl_mout_en(enum mtk_ddp_comp_id cur,
> + enum mtk_ddp_comp_id next,
> + unsigned int *addr)
> +{
> + int value = -1;
> +
> + *addr = MT8192_MMSYS_OVL_MOUT_EN;
> +
> + if (cur == DDP_COMPONENT_OVL0 && next == DDP_COMPONENT_OVL_2L0)
> + value = DISP_OVL0_GO_BG;
> + else if (cur == DDP_COMPONENT_OVL_2L0 && next == DDP_COMPONENT_OVL0)
> + value = DISP_OVL0_2L_GO_BG;
> + else if (cur == DDP_COMPONENT_OVL0)
> + value = DISP_OVL0_GO_BLEND;
> + else if (cur == DDP_COMPONENT_OVL_2L0)
> + value = DISP_OVL0_2L_GO_BLEND;
> + else
> + value = -1;
> +
> + return value;
> +}
> +
> static struct mtk_mmsys_conn_funcs mmsys_funcs = {
> .mout_en = mtk_mmsys_ddp_mout_en,
> .sel_in = mtk_mmsys_ddp_sel_in,
> .sout_sel = mtk_mmsys_ddp_sout_sel,
> + .ovl_mout_en = mtk_mmsys_ovl_mout_en,
> };
>
> static int mmsys_probe(struct platform_device *pdev)
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index 828d59e..1362d01 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -76,6 +76,14 @@ void mtk_mmsys_ddp_connect(struct device *dev,
> reg = readl_relaxed(config_regs + addr) | value;
> writel_relaxed(reg, config_regs + addr);
> }
> +
> + if (priv_funcs->ovl_mout_en) {
> + value = priv_funcs->ovl_mout_en(cur, next, &addr);
> + if (value >= 0) {
> + reg = readl_relaxed(config_regs + addr) | value;
> + writel_relaxed(reg, config_regs + addr);
> + }
> + }

I would like to do routing control like [1].

[1] https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2345186

Regards,
Chun-Kuang.

> }
> EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_connect);
>
> diff --git a/include/linux/soc/mediatek/mtk-mmsys.h b/include/linux/soc/mediatek/mtk-mmsys.h
> index 8ef3eaa..eefc7b1 100644
> --- a/include/linux/soc/mediatek/mtk-mmsys.h
> +++ b/include/linux/soc/mediatek/mtk-mmsys.h
> @@ -55,6 +55,9 @@ struct mtk_mmsys_conn_funcs {
> void (*sout_sel)(void __iomem *config_regs,
> enum mtk_ddp_comp_id cur,
> enum mtk_ddp_comp_id next);
> + int (*ovl_mout_en)(enum mtk_ddp_comp_id cur,
> + enum mtk_ddp_comp_id next,
> + unsigned int *addr);
> };
>
> void mtk_mmsys_register_conn_funcs(struct device *dev,
> --
> 1.8.1.1.dirty
> _______________________________________________
> Linux-mediatek mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-mediatek