[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <123d5ef7c1dc28f2723db5d2eca4462b639ebd69.camel@mediatek.com>
Date: Wed, 27 Sep 2023 10:42:17 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: Shawn Sung (宋孝謙)
<Shawn.Sung@...iatek.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
Singo Chang (張興國)
<Singo.Chang@...iatek.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Jason-JH Lin (林睿祥)
<Jason-JH.Lin@...iatek.com>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
"daniel@...ll.ch" <daniel@...ll.ch>,
"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"conor+dt@...nel.org" <conor+dt@...nel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"airlied@...il.com" <airlied@...il.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"nfraprado@...labora.com" <nfraprado@...labora.com>
Subject: Re: [RESEND PATCH v6 14/20] drm/mediatek: Add component ID to
component match structure
Hi, Hsiao-chien:
On Mon, 2023-09-11 at 15:42 +0800, Hsiao Chien Sung wrote:
> Add component ID to component match structure so we can
> configure them with a for-loop.
>
> The main reason we do such code refactoring is that
> there is a new hardware component called "Padding" since
> MT8188, while MT8195 doesn't have this module, we can't
> use the original logic to manage the components.
>
> While MT8195 does not define Padding in the device tree,
> the corresponding components will be NULL and being skipped
> by the functions.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@...iatek.com>
> ---
> .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 69 ++++++++---------
> --
> 1 file changed, 30 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> index 72758e41b1e6..8a52d1301e04 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> @@ -52,6 +52,7 @@ enum mtk_ovl_adaptor_comp_id {
>
> struct ovl_adaptor_comp_match {
> enum mtk_ovl_adaptor_comp_type type;
> + enum mtk_ddp_comp_id comp_id;
> int alias_id;
> };
>
> @@ -68,19 +69,19 @@ static const char * const
> private_comp_stem[OVL_ADAPTOR_TYPE_NUM] = {
> };
>
> static const struct ovl_adaptor_comp_match
> comp_matches[OVL_ADAPTOR_ID_MAX] = {
> - [OVL_ADAPTOR_ETHDR0] = { OVL_ADAPTOR_TYPE_ETHDR, 0 },
> - [OVL_ADAPTOR_MDP_RDMA0] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 0 },
> - [OVL_ADAPTOR_MDP_RDMA1] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 1 },
> - [OVL_ADAPTOR_MDP_RDMA2] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 2 },
> - [OVL_ADAPTOR_MDP_RDMA3] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 3 },
> - [OVL_ADAPTOR_MDP_RDMA4] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 4 },
> - [OVL_ADAPTOR_MDP_RDMA5] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 5 },
> - [OVL_ADAPTOR_MDP_RDMA6] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 6 },
> - [OVL_ADAPTOR_MDP_RDMA7] = { OVL_ADAPTOR_TYPE_MDP_RDMA, 7 },
> - [OVL_ADAPTOR_MERGE0] = { OVL_ADAPTOR_TYPE_MERGE, 1 },
> - [OVL_ADAPTOR_MERGE1] = { OVL_ADAPTOR_TYPE_MERGE, 2 },
> - [OVL_ADAPTOR_MERGE2] = { OVL_ADAPTOR_TYPE_MERGE, 3 },
> - [OVL_ADAPTOR_MERGE3] = { OVL_ADAPTOR_TYPE_MERGE, 4 },
> + [OVL_ADAPTOR_ETHDR0] = { OVL_ADAPTOR_TYPE_ETHDR,
> DDP_COMPONENT_ETHDR_MIXER, 0 },
> + [OVL_ADAPTOR_MDP_RDMA0] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA0, 0 },
> + [OVL_ADAPTOR_MDP_RDMA1] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA1, 1 },
> + [OVL_ADAPTOR_MDP_RDMA2] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA2, 2 },
> + [OVL_ADAPTOR_MDP_RDMA3] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA3, 3 },
> + [OVL_ADAPTOR_MDP_RDMA4] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA4, 4 },
> + [OVL_ADAPTOR_MDP_RDMA5] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA5, 5 },
> + [OVL_ADAPTOR_MDP_RDMA6] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA6, 6 },
> + [OVL_ADAPTOR_MDP_RDMA7] = { OVL_ADAPTOR_TYPE_MDP_RDMA,
> DDP_COMPONENT_MDP_RDMA7, 7 },
> + [OVL_ADAPTOR_MERGE0] = { OVL_ADAPTOR_TYPE_MERGE,
> DDP_COMPONENT_MERGE1, 1 },
> + [OVL_ADAPTOR_MERGE1] = { OVL_ADAPTOR_TYPE_MERGE,
> DDP_COMPONENT_MERGE2, 2 },
> + [OVL_ADAPTOR_MERGE2] = { OVL_ADAPTOR_TYPE_MERGE,
> DDP_COMPONENT_MERGE3, 3 },
> + [OVL_ADAPTOR_MERGE3] = { OVL_ADAPTOR_TYPE_MERGE,
> DDP_COMPONENT_MERGE4, 4 },
> };
>
> void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int
> idx,
> @@ -314,36 +315,26 @@ size_t mtk_ovl_adaptor_get_num_formats(struct
> device *dev)
>
> void mtk_ovl_adaptor_add_comp(struct device *dev, struct mtk_mutex
> *mutex)
> {
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_ETHDR_MIXER);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA0);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA1);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA2);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA3);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA4);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA5);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA6);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MDP_RDMA7);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MERGE1);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MERGE2);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MERGE3);
> - mtk_mutex_add_comp(mutex, DDP_COMPONENT_MERGE4);
> + int i;
> + struct mtk_disp_ovl_adaptor *ovl_adaptor =
> dev_get_drvdata(dev);
> +
> + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) {
> + if (!ovl_adaptor->ovl_adaptor_comp[i])
> + continue;
> + mtk_mutex_add_comp(mutex, comp_matches[i].comp_id);
> + }
> }
>
> void mtk_ovl_adaptor_remove_comp(struct device *dev, struct
> mtk_mutex *mutex)
> {
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_ETHDR_MIXER);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA0);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA1);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA2);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA3);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA4);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA5);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA6);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MDP_RDMA7);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MERGE1);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MERGE2);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MERGE3);
> - mtk_mutex_remove_comp(mutex, DDP_COMPONENT_MERGE4);
> + int i;
> + struct mtk_disp_ovl_adaptor *ovl_adaptor =
> dev_get_drvdata(dev);
> +
> + for (i = 0; i < OVL_ADAPTOR_ID_MAX; i++) {
> + if (!ovl_adaptor->ovl_adaptor_comp[i])
> + continue;
> + mtk_mutex_remove_comp(mutex, comp_matches[i].comp_id);
> + }
> }
>
> void mtk_ovl_adaptor_connect(struct device *dev, struct device
> *mmsys_dev, unsigned int next)
> --
> 2.18.0
>
Powered by blists - more mailing lists