From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B6E8C3ABCB for ; Sat, 10 May 2025 08:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WM2txFCEPaQYMq1jlXJj77X8T/UtXcYFikAThJ96dxE=; b=oowWjlOepqNzgOhQ38Iy6396Ec trl1u0LfMltpkWVTtkT7pFZqOOmg67eXKQrus6C/RxQ6Z5vkRGkjkkBpX+aDeEKWtd95vsvPHCURC OOr3gtyE7kv3zdq87iofr4aoGLrDmqorqlKol6VF4KQki0MLAUMim2RR6eJPo6qZ21Csbcgyi/JTM CX9ZQ2BnaxclrIPfIawEef1MYd24iRQuxXC2rGQCtzqI7VzY6Q6sas6pWPNYL380KQNttthZl/UiN dhe2DaoD6/UYgXPZa+u+RV2WokFG6CbgQ3OzwLiWIulcFGvAIERik7eFaC/uwUx9DIb0Xgbq2wGOd 7Ou72qWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uDfQQ-00000005dOB-2qQ7; Sat, 10 May 2025 08:19:14 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uDf6L-00000005anU-3ySm; Sat, 10 May 2025 07:58:31 +0000 X-UUID: 8c59432a2d7411f08d385d50fb11b32d-20250510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=WM2txFCEPaQYMq1jlXJj77X8T/UtXcYFikAThJ96dxE=; b=BWwveVB5Hir30Z4FP1TvLeRQ9VybbJDkVfjKOB9TUcOFXqK4AXybPY9rr8M3J1yzXnI+lPsDjUPZUPEZ6dSYnpMdD8MypEoXmeWnnVQr/GHW81CcIvG2usaTdBS/lCXQORlavEgxZlVjgZaxVXdOJhEX9py0/JN2C3ZjsJBiS+s=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.2.1,REQID:a9717cf4-5e42-4aa0-a4d3-6469352bbac1,IP:0,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-5 X-CID-META: VersionHash:0ef645f,CLOUDID:9e0dcee0-512b-41ef-ab70-9303a9a81417,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 8c59432a2d7411f08d385d50fb11b32d-20250510 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1692704206; Sat, 10 May 2025 00:58:24 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.39; Sat, 10 May 2025 15:58:20 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1258.39 via Frontend Transport; Sat, 10 May 2025 15:58:19 +0800 From: Yunfei Dong To: =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert , Daniel Almeida CC: Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , Yunfei Dong , , , , , , Subject: [PATCH 05/14] media: mediatek: vcodec: get different firmware ipi id Date: Sat, 10 May 2025 15:53:35 +0800 Message-ID: <20250510075357.11761-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250510075357.11761-1-yunfei.dong@mediatek.com> References: <20250510075357.11761-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250510_005829_998009_20E86967 X-CRM114-Status: GOOD ( 12.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Getting ipi(inter-processor interrupt) id according to firmware type and hardware index for different architecture. Signed-off-by: Yunfei Dong --- .../platform/mediatek/vcodec/common/mtk_vcodec_fw.c | 13 +++++++++++++ .../platform/mediatek/vcodec/common/mtk_vcodec_fw.h | 1 + .../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 4 ++-- .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 4 ++-- .../vcodec/decoder/vdec/vdec_hevc_req_multi_if.c | 4 ++-- .../mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c | 4 ++-- .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 ++-- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c index fc547afa4ebf..4ed7639dfa30 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c @@ -5,6 +5,19 @@ #include "mtk_vcodec_fw_priv.h" #include "mtk_vcodec_fw_vcp.h" +int mtk_vcodec_fw_get_ipi(enum mtk_vcodec_fw_type type, int hw_id) +{ + switch (type) { + case SCP: + return hw_id == MTK_VDEC_LAT0 ? SCP_IPI_VDEC_LAT : SCP_IPI_VDEC_CORE; + case VCP: + return hw_id == MTK_VDEC_LAT0 ? VCP_IPI_LAT_DECODER : VCP_IPI_CORE_DECODER; + default: + return -EINVAL; + } +} +EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_ipi); + struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type, enum mtk_vcodec_fw_use fw_use) { diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h index c1642fb09b42..142e2e87905c 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h @@ -41,5 +41,6 @@ int mtk_vcodec_fw_ipi_register(struct mtk_vcodec_fw *fw, int id, int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf, unsigned int len, unsigned int wait); int mtk_vcodec_fw_get_type(struct mtk_vcodec_fw *fw); +int mtk_vcodec_fw_get_ipi(enum mtk_vcodec_fw_type type, int hw_id); #endif /* _MTK_VCODEC_FW_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c index bf21f2467a0f..618064001883 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c @@ -1886,8 +1886,8 @@ static int vdec_av1_slice_init(struct mtk_vcodec_dec_ctx *ctx) return -ENOMEM; instance->ctx = ctx; - instance->vpu.id = SCP_IPI_VDEC_LAT; - instance->vpu.core_id = SCP_IPI_VDEC_CORE; + instance->vpu.id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_LAT0); + instance->vpu.core_id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_CORE); instance->vpu.ctx = ctx; instance->vpu.codec_type = ctx->current_codec; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index 5b25e1679b51..50f81f1cb616 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -1212,8 +1212,8 @@ static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx) inst->ctx = ctx; - inst->vpu.id = SCP_IPI_VDEC_LAT; - inst->vpu.core_id = SCP_IPI_VDEC_CORE; + inst->vpu.id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_LAT0); + inst->vpu.core_id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_CORE); inst->vpu.ctx = ctx; inst->vpu.codec_type = ctx->current_codec; inst->vpu.capture_type = ctx->capture_fourcc; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c index 2725db882e5b..80fbd0309b9e 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c @@ -863,8 +863,8 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx) inst->ctx = ctx; - inst->vpu.id = SCP_IPI_VDEC_LAT; - inst->vpu.core_id = SCP_IPI_VDEC_CORE; + inst->vpu.id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_LAT0); + inst->vpu.core_id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_CORE); inst->vpu.ctx = ctx; inst->vpu.codec_type = ctx->current_codec; inst->vpu.capture_type = ctx->capture_fourcc; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c index 232ef3bd246a..764f4d4054c0 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c @@ -281,8 +281,8 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_dec_ctx *ctx) inst->ctx = ctx; - inst->vpu.id = SCP_IPI_VDEC_LAT; - inst->vpu.core_id = SCP_IPI_VDEC_CORE; + inst->vpu.id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_LAT0); + inst->vpu.core_id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_CORE); inst->vpu.ctx = ctx; inst->vpu.codec_type = ctx->current_codec; inst->vpu.capture_type = ctx->capture_fourcc; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c index 47c302745c1d..0279f66efdf9 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c @@ -1855,8 +1855,8 @@ static int vdec_vp9_slice_init(struct mtk_vcodec_dec_ctx *ctx) return -ENOMEM; instance->ctx = ctx; - instance->vpu.id = SCP_IPI_VDEC_LAT; - instance->vpu.core_id = SCP_IPI_VDEC_CORE; + instance->vpu.id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_LAT0); + instance->vpu.core_id = mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VDEC_CORE); instance->vpu.ctx = ctx; instance->vpu.codec_type = ctx->current_codec; -- 2.46.0