2023-01-13 09:41:58

by Moudy Ho (何宗原)

[permalink] [raw]
Subject: [PATCH v3 00/13] add support MDP3 on MT8195 platform

Changes since v2:
- Depend on :
[1] MMSYS/MUTEX: https://patchwork.kernel.org/project/linux-mediatek/list/?series=711592
[2] MDP3: https://patchwork.kernel.org/project/linux-mediatek/list/?series=711618
- Suggested by Rob to revise MDP3 bindings to pass dtbs check
- Add parallel paths feature.
- Add blended components settings.

Changes since v1:
- Depend on :
[1] MDP3 : https://patchwork.kernel.org/project/linux-mediatek/list/?series=698872
[2] MMSYS/MUTEX: https://patchwork.kernel.org/project/linux-mediatek/list/?series=684959
- Fix compilation failure due to use of undeclared identifier in file "mtk-mdp3-cmdq.c"

Hello,

This patch is used to add support for MDP3 on the MT8195 platform that
contains more picture quality components, and can arrange more pipelines
through two sets of MMSYS and MUTEX respectively.

Moudy Ho (13):
dt-binding: mediatek: add bindings for MediaTek mt8195 MDP3 components
arm64: dts: mediatek: mt8195: add MDP3 nodes
media: platform: mtk-mdp3: add support second sets of MMSYS
media: platform: mtk-mdp3: add support second sets of MUTEX
media: platform: mtk-mdp3: introduce more MDP3 components
media: platform: mtk-mdp3: add checks for dummy components
media: platform: mtk-mdp3: avoid multiple driver registrations
media: platform: mtk-mdp3: extend GCE event waiting in RDMA and WROT
media: platform: mtk-mdp3: add the blend of component in MUTEX MOD
media: platform: mtk-mdp3: add mt8195 platform configuration
media: platform: mtk-mdp3: add mt8195 shared memory configurations
media: platform: mtk-mdp3: add mt8195 MDP3 component settings
media: platform: mtk-mdp3: add support for parallel pipe to improve
FPS

.../bindings/media/mediatek,mdp3-aal.yaml | 63 ++
.../bindings/media/mediatek,mdp3-color.yaml | 63 ++
.../bindings/media/mediatek,mdp3-fg.yaml | 63 ++
.../bindings/media/mediatek,mdp3-hdr.yaml | 62 ++
.../bindings/media/mediatek,mdp3-merge.yaml | 63 ++
.../bindings/media/mediatek,mdp3-ovl.yaml | 63 ++
.../bindings/media/mediatek,mdp3-pad.yaml | 63 ++
.../bindings/media/mediatek,mdp3-rdma.yaml | 30 +-
.../bindings/media/mediatek,mdp3-rsz.yaml | 11 +-
.../bindings/media/mediatek,mdp3-split.yaml | 75 ++
.../bindings/media/mediatek,mdp3-stitch.yaml | 63 ++
.../bindings/media/mediatek,mdp3-tcc.yaml | 62 ++
.../bindings/media/mediatek,mdp3-tdshp.yaml | 63 ++
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 420 +++++++++
.../platform/mediatek/mdp3/mdp_reg_aal.h | 25 +
.../platform/mediatek/mdp3/mdp_reg_color.h | 31 +
.../media/platform/mediatek/mdp3/mdp_reg_fg.h | 23 +
.../platform/mediatek/mdp3/mdp_reg_hdr.h | 31 +
.../platform/mediatek/mdp3/mdp_reg_merge.h | 25 +
.../platform/mediatek/mdp3/mdp_reg_ovl.h | 25 +
.../platform/mediatek/mdp3/mdp_reg_pad.h | 21 +
.../platform/mediatek/mdp3/mdp_reg_rdma.h | 24 +
.../platform/mediatek/mdp3/mdp_reg_rsz.h | 2 +
.../platform/mediatek/mdp3/mdp_reg_tdshp.h | 34 +
.../platform/mediatek/mdp3/mdp_reg_wrot.h | 8 +
.../mediatek/mdp3/mt8183/mdp3-plat-mt8183.h | 38 +-
.../mediatek/mdp3/mt8195/mdp3-comp-mt8195.h | 283 ++++++
.../mediatek/mdp3/mt8195/mdp3-plat-mt8195.h | 669 ++++++++++++++
.../platform/mediatek/mdp3/mtk-img-ipi.h | 4 +
.../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 453 +++++++---
.../platform/mediatek/mdp3/mtk-mdp3-cmdq.h | 1 +
.../platform/mediatek/mdp3/mtk-mdp3-comp.c | 834 +++++++++++++++++-
.../platform/mediatek/mdp3/mtk-mdp3-comp.h | 92 +-
.../platform/mediatek/mdp3/mtk-mdp3-core.c | 115 ++-
.../platform/mediatek/mdp3/mtk-mdp3-core.h | 33 +-
.../platform/mediatek/mdp3/mtk-mdp3-m2m.c | 15 +
.../platform/mediatek/mdp3/mtk-mdp3-regs.c | 18 +
.../platform/mediatek/mdp3/mtk-mdp3-regs.h | 1 +
.../platform/mediatek/mdp3/mtk-mdp3-vpu.c | 3 +-
39 files changed, 3791 insertions(+), 181 deletions(-)
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-aal.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-color.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-fg.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-hdr.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-merge.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-ovl.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-pad.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-split.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-stitch.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-tcc.yaml
create mode 100644 Documentation/devicetree/bindings/media/mediatek,mdp3-tdshp.yaml
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_aal.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_color.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_fg.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_hdr.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_merge.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_ovl.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_pad.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_tdshp.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mt8195/mdp3-comp-mt8195.h
create mode 100644 drivers/media/platform/mediatek/mdp3/mt8195/mdp3-plat-mt8195.h

--
2.18.0


2023-01-13 09:44:08

by Moudy Ho (何宗原)

[permalink] [raw]
Subject: [PATCH v3 03/13] media: platform: mtk-mdp3: add support second sets of MMSYS

In MT8195, there are two sets of MMSYS named VPPSYS0 and VPPSYS1,
which are used to coordinate and control the clock, power and
register settings required by the components of MDP3.

Signed-off-by: Moudy Ho <[email protected]>
---
.../mediatek/mdp3/mt8183/mdp3-plat-mt8183.h | 36 ++++++++---------
.../platform/mediatek/mdp3/mtk-mdp3-comp.h | 1 +
.../platform/mediatek/mdp3/mtk-mdp3-core.c | 40 +++++++++++++------
.../platform/mediatek/mdp3/mtk-mdp3-core.h | 3 ++
4 files changed, 49 insertions(+), 31 deletions(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h b/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
index b1d4cbeda932..6dd06131e256 100644
--- a/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
+++ b/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
@@ -89,75 +89,75 @@ enum mt8183_mdp_comp_id {

static const struct mdp_comp_data mt8183_mdp_comp_data[MDP_MAX_COMP_COUNT] = {
[MDP_COMP_WPEI] = {
- {MDP_COMP_TYPE_WPEI, 0, MT8183_MDP_COMP_WPEI},
+ {MDP_COMP_TYPE_WPEI, 0, MT8183_MDP_COMP_WPEI, 0},
{0, 0, 0}
},
[MDP_COMP_WPEO] = {
- {MDP_COMP_TYPE_EXTO, 2, MT8183_MDP_COMP_WPEO},
+ {MDP_COMP_TYPE_EXTO, 2, MT8183_MDP_COMP_WPEO, 0},
{0, 0, 0}
},
[MDP_COMP_WPEI2] = {
- {MDP_COMP_TYPE_WPEI, 1, MT8183_MDP_COMP_WPEI2},
+ {MDP_COMP_TYPE_WPEI, 1, MT8183_MDP_COMP_WPEI2, 0},
{0, 0, 0}
},
[MDP_COMP_WPEO2] = {
- {MDP_COMP_TYPE_EXTO, 3, MT8183_MDP_COMP_WPEO2},
+ {MDP_COMP_TYPE_EXTO, 3, MT8183_MDP_COMP_WPEO2, 0},
{0, 0, 0}
},
[MDP_COMP_ISP_IMGI] = {
- {MDP_COMP_TYPE_IMGI, 0, MT8183_MDP_COMP_ISP_IMGI},
+ {MDP_COMP_TYPE_IMGI, 0, MT8183_MDP_COMP_ISP_IMGI, 0},
{0, 0, 4}
},
[MDP_COMP_ISP_IMGO] = {
- {MDP_COMP_TYPE_EXTO, 0, MT8183_MDP_COMP_ISP_IMGO},
+ {MDP_COMP_TYPE_EXTO, 0, MT8183_MDP_COMP_ISP_IMGO, 0},
{0, 0, 4}
},
[MDP_COMP_ISP_IMG2O] = {
- {MDP_COMP_TYPE_EXTO, 1, MT8183_MDP_COMP_ISP_IMG2O},
+ {MDP_COMP_TYPE_EXTO, 1, MT8183_MDP_COMP_ISP_IMG2O, 0},
{0, 0, 0}
},
[MDP_COMP_CAMIN] = {
- {MDP_COMP_TYPE_DL_PATH, 0, MT8183_MDP_COMP_CAMIN},
+ {MDP_COMP_TYPE_DL_PATH, 0, MT8183_MDP_COMP_CAMIN, 0},
{2, 2, 1}
},
[MDP_COMP_CAMIN2] = {
- {MDP_COMP_TYPE_DL_PATH, 1, MT8183_MDP_COMP_CAMIN2},
+ {MDP_COMP_TYPE_DL_PATH, 1, MT8183_MDP_COMP_CAMIN2, 0},
{2, 4, 1}
},
[MDP_COMP_RDMA0] = {
- {MDP_COMP_TYPE_RDMA, 0, MT8183_MDP_COMP_RDMA0},
+ {MDP_COMP_TYPE_RDMA, 0, MT8183_MDP_COMP_RDMA0, 0},
{2, 0, 0}
},
[MDP_COMP_CCORR0] = {
- {MDP_COMP_TYPE_CCORR, 0, MT8183_MDP_COMP_CCORR0},
+ {MDP_COMP_TYPE_CCORR, 0, MT8183_MDP_COMP_CCORR0, 0},
{1, 0, 0}
},
[MDP_COMP_RSZ0] = {
- {MDP_COMP_TYPE_RSZ, 0, MT8183_MDP_COMP_RSZ0},
+ {MDP_COMP_TYPE_RSZ, 0, MT8183_MDP_COMP_RSZ0, 0},
{1, 0, 0}
},
[MDP_COMP_RSZ1] = {
- {MDP_COMP_TYPE_RSZ, 1, MT8183_MDP_COMP_RSZ1},
+ {MDP_COMP_TYPE_RSZ, 1, MT8183_MDP_COMP_RSZ1, 0},
{1, 0, 0}
},
[MDP_COMP_TDSHP0] = {
- {MDP_COMP_TYPE_TDSHP, 0, MT8183_MDP_COMP_TDSHP0},
+ {MDP_COMP_TYPE_TDSHP, 0, MT8183_MDP_COMP_TDSHP0, 0},
{0, 0, 0}
},
[MDP_COMP_PATH0_SOUT] = {
- {MDP_COMP_TYPE_PATH, 0, MT8183_MDP_COMP_PATH0_SOUT},
+ {MDP_COMP_TYPE_PATH, 0, MT8183_MDP_COMP_PATH0_SOUT, 0},
{0, 0, 0}
},
[MDP_COMP_PATH1_SOUT] = {
- {MDP_COMP_TYPE_PATH, 1, MT8183_MDP_COMP_PATH1_SOUT},
+ {MDP_COMP_TYPE_PATH, 1, MT8183_MDP_COMP_PATH1_SOUT, 0},
{0, 0, 0}
},
[MDP_COMP_WROT0] = {
- {MDP_COMP_TYPE_WROT, 0, MT8183_MDP_COMP_WROT0},
+ {MDP_COMP_TYPE_WROT, 0, MT8183_MDP_COMP_WROT0, 0},
{1, 0, 0}
},
[MDP_COMP_WDMA] = {
- {MDP_COMP_TYPE_WDMA, 0, MT8183_MDP_COMP_WDMA},
+ {MDP_COMP_TYPE_WDMA, 0, MT8183_MDP_COMP_WDMA, 0},
{1, 0, 0}
},
};
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h
index 8d2ab9184f58..acb7ce69dbf3 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h
@@ -138,6 +138,7 @@ struct mdp_comp_match {
enum mdp_comp_type type;
u32 alias_id;
s32 inner_id;
+ u32 mmsys_id;
};

/* Used to describe the item order in MDP property */
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index 8daa7245c90b..927d3d65751a 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -41,39 +41,45 @@ static const struct of_device_id mdp_of_ids[] = {
MODULE_DEVICE_TABLE(of, mdp_of_ids);

static struct platform_device *__get_pdev_by_id(struct platform_device *pdev,
+ struct platform_device *from,
enum mdp_infra_id id)
{
- struct device_node *node;
+ struct device_node *node, *f = NULL;
struct platform_device *mdp_pdev = NULL;
const struct mtk_mdp_driver_data *mdp_data;
const char *compat;

if (!pdev)
- return NULL;
+ return ERR_PTR(-ENODEV);

if (id < MDP_INFRA_MMSYS || id >= MDP_INFRA_MAX) {
dev_err(&pdev->dev, "Illegal infra id %d\n", id);
- return NULL;
+ return ERR_PTR(-ENODEV);
}

mdp_data = of_device_get_match_data(&pdev->dev);
if (!mdp_data) {
dev_err(&pdev->dev, "have no driver data to find node\n");
- return NULL;
+ return ERR_PTR(-ENODEV);
}
+
compat = mdp_data->mdp_probe_infra[id].compatible;
+ if (strlen(compat) == 0)
+ return NULL;

- node = of_find_compatible_node(NULL, NULL, compat);
+ if (from)
+ f = from->dev.of_node;
+ node = of_find_compatible_node(f, NULL, compat);
if (WARN_ON(!node)) {
dev_err(&pdev->dev, "find node from id %d failed\n", id);
- return NULL;
+ return ERR_PTR(-ENODEV);
}

mdp_pdev = of_find_device_by_node(node);
of_node_put(node);
if (WARN_ON(!mdp_pdev)) {
dev_err(&pdev->dev, "find pdev from id %d failed\n", id);
- return NULL;
+ return ERR_PTR(-ENODEV);
}

return mdp_pdev;
@@ -167,7 +173,7 @@ static int mdp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct mdp_dev *mdp;
- struct platform_device *mm_pdev;
+ struct platform_device *mm_pdev, *mm2_pdev;
int ret, i, mutex_id;

mdp = kzalloc(sizeof(*mdp), GFP_KERNEL);
@@ -179,15 +185,23 @@ static int mdp_probe(struct platform_device *pdev)
mdp->pdev = pdev;
mdp->mdp_data = of_device_get_match_data(&pdev->dev);

- mm_pdev = __get_pdev_by_id(pdev, MDP_INFRA_MMSYS);
- if (!mm_pdev) {
+ mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_MMSYS);
+ if (IS_ERR_OR_NULL(mm_pdev)) {
ret = -ENODEV;
goto err_destroy_device;
}
mdp->mdp_mmsys = &mm_pdev->dev;

- mm_pdev = __get_pdev_by_id(pdev, MDP_INFRA_MUTEX);
- if (WARN_ON(!mm_pdev)) {
+ /* Not all chips have MMSYS2, config may be null */
+ mm2_pdev = __get_pdev_by_id(pdev, mm_pdev, MDP_INFRA_MMSYS2);
+ if (IS_ERR(mm2_pdev)) {
+ ret = PTR_ERR(mm2_pdev);
+ goto err_destroy_device;
+ }
+ mdp->mdp_mmsys2 = &mm2_pdev->dev;
+
+ mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_MUTEX);
+ if (IS_ERR_OR_NULL(mm_pdev)) {
ret = -ENODEV;
goto err_destroy_device;
}
@@ -223,7 +237,7 @@ static int mdp_probe(struct platform_device *pdev)
goto err_destroy_job_wq;
}

- mm_pdev = __get_pdev_by_id(pdev, MDP_INFRA_SCP);
+ mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP);
if (WARN_ON(!mm_pdev)) {
dev_err(&pdev->dev, "Could not get scp device\n");
ret = -ENODEV;
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
index b7288fe15134..0b40ccfd376c 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
@@ -20,6 +20,7 @@

enum mdp_infra_id {
MDP_INFRA_MMSYS,
+ MDP_INFRA_MMSYS2,
MDP_INFRA_MUTEX,
MDP_INFRA_SCP,
MDP_INFRA_MAX
@@ -68,6 +69,7 @@ struct mtk_mdp_driver_data {
struct mdp_dev {
struct platform_device *pdev;
struct device *mdp_mmsys;
+ struct device *mdp_mmsys2;
struct mtk_mutex *mdp_mutex[MDP_PIPE_MAX];
struct mdp_comp *comp[MDP_MAX_COMP_COUNT];
const struct mtk_mdp_driver_data *mdp_data;
@@ -96,6 +98,7 @@ struct mdp_dev {

struct mdp_pipe_info {
enum mdp_pipe_id pipe_id;
+ u32 mmsys_id;
u32 mutex_id;
};

--
2.18.0