[v1,1/6] media: platform: mtk-mdp3: add chip configuration header file

Message ID 20221007031737.5125-2-moudy.ho@mediatek.com (mailing list archive)
State Superseded
Headers
Series Add support for multiple chips |

Commit Message

Moudy Ho (何宗原) Oct. 7, 2022, 3:17 a.m. UTC
  In order to be compatible with more MDP3 chip settings in the future,
move the chip-related configuration to a separate header file.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 .../media/platform/mediatek/mdp3/mt8183_mdp.h | 35 +++++++++++++++++++
 .../platform/mediatek/mdp3/mtk-mdp3-core.c    | 27 ++------------
 2 files changed, 37 insertions(+), 25 deletions(-)
 create mode 100644 drivers/media/platform/mediatek/mdp3/mt8183_mdp.h
  

Comments

AngeloGioacchino Del Regno Oct. 7, 2022, 9:07 a.m. UTC | #1
Il 07/10/22 05:17, Moudy Ho ha scritto:
> In order to be compatible with more MDP3 chip settings in the future,
> move the chip-related configuration to a separate header file.
> 
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
>   .../media/platform/mediatek/mdp3/mt8183_mdp.h | 35 +++++++++++++++++++

What if we choose a better name format for the chip header?
Would mdp3-plat-mt8183.h work for you?

Aside from that, the changes look good... but anyway, what this driver
really needs is an abstraction of `mtk-img-ipi.h` since, as you know, new
SoCs are using a different firmware and even a different architecture for
the MCU.

Is that planned?

I think that such change would perfectly fit inside of this series.

Regards,
Angelo

>   .../platform/mediatek/mdp3/mtk-mdp3-core.c    | 27 ++------------
>   2 files changed, 37 insertions(+), 25 deletions(-)
>   create mode 100644 drivers/media/platform/mediatek/mdp3/mt8183_mdp.h
>
  
Moudy Ho (何宗原) Oct. 11, 2022, 2:02 a.m. UTC | #2
On Fri, 2022-10-07 at 11:07 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/10/22 05:17, Moudy Ho ha scritto:
> > In order to be compatible with more MDP3 chip settings in the
> > future,
> > move the chip-related configuration to a separate header file.
> > 
> > Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> > ---
> >   .../media/platform/mediatek/mdp3/mt8183_mdp.h | 35
> > +++++++++++++++++++
> 
> What if we choose a better name format for the chip header?
> Would mdp3-plat-mt8183.h work for you?
> 
> Aside from that, the changes look good... but anyway, what this
> driver
> really needs is an abstraction of `mtk-img-ipi.h` since, as you know,
> new
> SoCs are using a different firmware and even a different architecture
> for
> the MCU.
> 
> Is that planned?
> 
> I think that such change would perfectly fit inside of this series.
> 
> Regards,
> Angelo
> 

Hi Angelo,

Thanks for all your advice, I will add another patch for SCP shared
memory header separation by chip, and integrate the following series
with the same purpose here.
[1] 
https://patchwork.kernel.org/project/linux-mediatek/list/?series=683671

Sincerely,
Moudy
> >   .../platform/mediatek/mdp3/mtk-mdp3-core.c    | 27 ++------------
> >   2 files changed, 37 insertions(+), 25 deletions(-)
> >   create mode 100644
> > drivers/media/platform/mediatek/mdp3/mt8183_mdp.h
> > 
> 
>
  

Patch

diff --git a/drivers/media/platform/mediatek/mdp3/mt8183_mdp.h b/drivers/media/platform/mediatek/mdp3/mt8183_mdp.h
new file mode 100644
index 000000000000..a75400c8a12b
--- /dev/null
+++ b/drivers/media/platform/mediatek/mdp3/mt8183_mdp.h
@@ -0,0 +1,35 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2022 MediaTek Inc.
+ * Author: Ping-Hsun Wu <ping-hsun.wu@mediatek.com>
+ */
+
+#ifndef __MT8183_MDP_H__
+#define __MT8183_MDP_H__
+
+static const struct mdp_platform_config mt8183_plat_cfg = {
+	.rdma_support_10bit		= true,
+	.rdma_rsz1_sram_sharing		= true,
+	.rdma_upsample_repeat_only	= true,
+	.rsz_disable_dcm_small_sample	= false,
+	.wrot_filter_constraint		= false,
+};
+
+static const struct of_device_id mt8183_mdp_probe_infra[MDP_INFRA_MAX] = {
+	[MDP_INFRA_MMSYS] = { .compatible = "mediatek,mt8183-mmsys" },
+	[MDP_INFRA_MUTEX] = { .compatible = "mediatek,mt8183-disp-mutex" },
+	[MDP_INFRA_SCP] = { .compatible = "mediatek,mt8183-scp" }
+};
+
+static const u32 mt8183_mutex_idx[MDP_MAX_COMP_COUNT] = {
+	[MDP_COMP_RDMA0] = MUTEX_MOD_IDX_MDP_RDMA0,
+	[MDP_COMP_RSZ0] = MUTEX_MOD_IDX_MDP_RSZ0,
+	[MDP_COMP_RSZ1] = MUTEX_MOD_IDX_MDP_RSZ1,
+	[MDP_COMP_TDSHP0] = MUTEX_MOD_IDX_MDP_TDSHP0,
+	[MDP_COMP_WROT0] = MUTEX_MOD_IDX_MDP_WROT0,
+	[MDP_COMP_WDMA] = MUTEX_MOD_IDX_MDP_WDMA,
+	[MDP_COMP_AAL0] = MUTEX_MOD_IDX_MDP_AAL0,
+	[MDP_COMP_CCORR0] = MUTEX_MOD_IDX_MDP_CCORR0,
+};
+
+#endif  // __MT8183_MDP_H__
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index 2d1f6ae9f080..e720e1564991 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -12,33 +12,10 @@ 
 #include <linux/remoteproc.h>
 #include <linux/remoteproc/mtk_scp.h>
 #include <media/videobuf2-dma-contig.h>
+
 #include "mtk-mdp3-core.h"
 #include "mtk-mdp3-m2m.h"
-
-static const struct mdp_platform_config mt8183_plat_cfg = {
-	.rdma_support_10bit		= true,
-	.rdma_rsz1_sram_sharing		= true,
-	.rdma_upsample_repeat_only	= true,
-	.rsz_disable_dcm_small_sample	= false,
-	.wrot_filter_constraint		= false,
-};
-
-static const struct of_device_id mt8183_mdp_probe_infra[MDP_INFRA_MAX] = {
-	[MDP_INFRA_MMSYS] = { .compatible = "mediatek,mt8183-mmsys" },
-	[MDP_INFRA_MUTEX] = { .compatible = "mediatek,mt8183-disp-mutex" },
-	[MDP_INFRA_SCP] = { .compatible = "mediatek,mt8183-scp" }
-};
-
-static const u32 mt8183_mutex_idx[MDP_MAX_COMP_COUNT] = {
-	[MDP_COMP_RDMA0] = MUTEX_MOD_IDX_MDP_RDMA0,
-	[MDP_COMP_RSZ0] = MUTEX_MOD_IDX_MDP_RSZ0,
-	[MDP_COMP_RSZ1] = MUTEX_MOD_IDX_MDP_RSZ1,
-	[MDP_COMP_TDSHP0] = MUTEX_MOD_IDX_MDP_TDSHP0,
-	[MDP_COMP_WROT0] = MUTEX_MOD_IDX_MDP_WROT0,
-	[MDP_COMP_WDMA] = MUTEX_MOD_IDX_MDP_WDMA,
-	[MDP_COMP_AAL0] = MUTEX_MOD_IDX_MDP_AAL0,
-	[MDP_COMP_CCORR0] = MUTEX_MOD_IDX_MDP_CCORR0,
-};
+#include "mt8183_mdp.h"
 
 static const struct mtk_mdp_driver_data mt8183_mdp_driver_data = {
 	.mdp_probe_infra = mt8183_mdp_probe_infra,