public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Moudy Ho <moudy.ho@mediatek.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	<linux-media@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	Moudy Ho <moudy.ho@mediatek.com>
Subject: [PATCH v3 08/13] media: platform: mtk-mdp3: extend GCE event waiting in RDMA and WROT
Date: Fri, 13 Jan 2023 17:03:16 +0800	[thread overview]
Message-ID: <20230113090321.25128-9-moudy.ho@mediatek.com> (raw)
In-Reply-To: <20230113090321.25128-1-moudy.ho@mediatek.com>

Support for multiple RDMA/WROT waits for GCE events.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
 .../mediatek/mdp3/mt8183/mdp3-plat-mt8183.h     |  2 ++
 .../platform/mediatek/mdp3/mtk-mdp3-comp.c      | 17 +++++++++++------
 .../platform/mediatek/mdp3/mtk-mdp3-core.h      |  2 ++
 3 files changed, 15 insertions(+), 6 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 6dd06131e256..35425299e9bd 100644
--- a/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
+++ b/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
@@ -11,8 +11,10 @@ static const struct mdp_platform_config mt8183_plat_cfg = {
 	.rdma_support_10bit		= true,
 	.rdma_rsz1_sram_sharing		= true,
 	.rdma_upsample_repeat_only	= true,
+	.rdma_event_num			= 1,
 	.rsz_disable_dcm_small_sample	= false,
 	.wrot_filter_constraint		= false,
+	.wrot_event_num			= 1,
 };
 
 static const struct of_device_id mt8183_mdp_probe_infra[MDP_INFRA_MAX] = {
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
index 576b90a2fb9d..9b1b7fbb3d6b 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
@@ -280,14 +280,17 @@ static int config_rdma_subfrm(struct mdp_comp_ctx *ctx,
 
 static int wait_rdma_event(struct mdp_comp_ctx *ctx, struct mdp_cmdq_cmd *cmd)
 {
+	const struct mdp_platform_config *mdp_cfg = __get_plat_cfg(ctx);
 	struct device *dev = &ctx->comp->mdp_dev->pdev->dev;
 	phys_addr_t base = ctx->comp->reg_base;
 	u8 subsys_id = ctx->comp->subsys_id;
 
-	if (ctx->comp->alias_id == 0)
+	if (ctx->comp->alias_id < mdp_cfg->rdma_event_num) {
 		MM_REG_WAIT(cmd, ctx->comp->gce_event[MDP_GCE_EVENT_EOF]);
-	else
-		dev_err(dev, "Do not support RDMA1_DONE event\n");
+	} else {
+		dev_err(dev, "Invalid RDMA event %d\n", ctx->comp->alias_id);
+		return -EINVAL;
+	}
 
 	/* Disable RDMA */
 	MM_REG_WRITE(cmd, subsys_id, base, MDP_RDMA_EN, 0x0, BIT(0));
@@ -582,10 +585,12 @@ static int wait_wrot_event(struct mdp_comp_ctx *ctx, struct mdp_cmdq_cmd *cmd)
 	phys_addr_t base = ctx->comp->reg_base;
 	u8 subsys_id = ctx->comp->subsys_id;
 
-	if (ctx->comp->alias_id == 0)
+	if (ctx->comp->alias_id < mdp_cfg->wrot_event_num) {
 		MM_REG_WAIT(cmd, ctx->comp->gce_event[MDP_GCE_EVENT_EOF]);
-	else
-		dev_err(dev, "Do not support WROT1_DONE event\n");
+	} else {
+		dev_err(dev, "Invalid WROT event %d!\n", ctx->comp->alias_id);
+		return -EINVAL;
+	}
 
 	if (mdp_cfg && mdp_cfg->wrot_filter_constraint)
 		MM_REG_WRITE(cmd, subsys_id, base, VIDO_MAIN_BUF_SIZE, 0x0,
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
index e3e60b106c72..a9beb8bd440b 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
@@ -40,8 +40,10 @@ struct mdp_platform_config {
 	bool	rdma_support_10bit;
 	bool	rdma_rsz1_sram_sharing;
 	bool	rdma_upsample_repeat_only;
+	u32	rdma_event_num;
 	bool	rsz_disable_dcm_small_sample;
 	bool	wrot_filter_constraint;
+	u32	wrot_event_num;
 };
 
 /* indicate which mutex is used by each pipepline */
-- 
2.18.0


  parent reply	other threads:[~2023-01-13  9:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  9:03 [PATCH v3 00/13] add support MDP3 on MT8195 platform Moudy Ho
2023-01-13  9:03 ` [PATCH v3 01/13] dt-binding: mediatek: add bindings for MediaTek mt8195 MDP3 components Moudy Ho
2023-01-13 10:23   ` Krzysztof Kozlowski
2023-01-16  2:12     ` Moudy Ho (何宗原)
2023-01-13  9:03 ` [PATCH v3 02/13] arm64: dts: mediatek: mt8195: add MDP3 nodes Moudy Ho
2023-01-13  9:03 ` [PATCH v3 03/13] media: platform: mtk-mdp3: add support second sets of MMSYS Moudy Ho
2023-01-13  9:03 ` [PATCH v3 04/13] media: platform: mtk-mdp3: add support second sets of MUTEX Moudy Ho
2023-01-13  9:03 ` [PATCH v3 05/13] media: platform: mtk-mdp3: introduce more MDP3 components Moudy Ho
2023-01-13  9:03 ` [PATCH v3 06/13] media: platform: mtk-mdp3: add checks for dummy components Moudy Ho
2023-01-13  9:03 ` [PATCH v3 07/13] media: platform: mtk-mdp3: avoid multiple driver registrations Moudy Ho
2023-01-13  9:03 ` Moudy Ho [this message]
2023-01-13  9:03 ` [PATCH v3 09/13] media: platform: mtk-mdp3: add the blend of component in MUTEX MOD Moudy Ho
2023-01-13  9:03 ` [PATCH v3 10/13] media: platform: mtk-mdp3: add mt8195 platform configuration Moudy Ho
2023-01-13  9:03 ` [PATCH v3 11/13] media: platform: mtk-mdp3: add mt8195 shared memory configurations Moudy Ho
2023-01-13  9:03 ` [PATCH v3 12/13] media: platform: mtk-mdp3: add mt8195 MDP3 component settings Moudy Ho
2023-01-13  9:03 ` [PATCH v3 13/13] media: platform: mtk-mdp3: add support for parallel pipe to improve FPS Moudy Ho

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=20230113090321.25128-9-moudy.ho@mediatek.com \
    --to=moudy.ho@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    /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