From nobody Sat Oct 4 16:21:28 2025 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5371429B23E; Fri, 15 Aug 2025 08:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755247983; cv=none; b=gvYBJlh+CEoOTo6jRuugr2DC59yv0SqviGNZq0kkEEeOHJzhnl3Zlaj2oxtv9/b+BeiN2w5Nrt+ijlCCU0u1pqIOWMwkm59IGtBBdqRw07WlqTZfYgP+Zhj861ljFKSYJkQkNSW0xlEUHO7j98Hn7o5+F9Dh948hT18Z4up5Uhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755247983; c=relaxed/simple; bh=0L9n7HYDoKQ+Z3CTG9JAKhTVomnnTkKGPHbehQWCwSA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EhS/lU1eSeNVDECL7Fi7+MhtbZ9kzqFUp5ZrDy+I1ZZjitpq77rtqmYxnj1Oko3YbBOzyFZZvWRfPEiKNDFr6Ey4466o/neBHfnSfYpI1PPOywO4KcrJpOpVQkZQZE4BwMV46GwAfN7VN9zangbRbgvaXP67hC/W8Cc5gKYUmDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=KpcDn83q; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="KpcDn83q" X-UUID: 3abf38ca79b511f08729452bf625a8b4-20250815 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=K3SB+OfBqJDAsw585kRDbpa1FOinnMBPtPiSI4/DVLM=; b=KpcDn83qfCdoFBFmP+m6otN1sj2faRk1GzlllxCtE5gbgKmZsTLlx67KMZMxldy03hKnC/ceowO6KWDycNe7CRZzyI/y257+oEQGHNYtRRC/eo7+3sPFLGNvM7w5xpr8K0Z7VENZFowMNwRKKQQUtpttA2KEkWC+aqs3QFf0610=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.3,REQID:384d7050-41fa-45d7-a40b-2202d95642da,IP:0,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:25 X-CID-META: VersionHash:f1326cf,CLOUDID:4784416d-c2f4-47a6-876f-59a53e9ecc6e,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:-5,Content:0|15|50,EDM: 5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,A V:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 3abf38ca79b511f08729452bf625a8b4-20250815 Received: from mtkmbs09n1.mediatek.inc [(172.21.101.35)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 611124060; Fri, 15 Aug 2025 16:52:53 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.39; Fri, 15 Aug 2025 16:52:50 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1258.39 via Frontend Transport; Fri, 15 Aug 2025 16:52:49 +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 v2 05/14] media: mediatek: vcodec: get different firmware ipi id Date: Fri, 15 Aug 2025 16:52:18 +0800 Message-ID: <20250815085232.30240-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250815085232.30240-1-yunfei.dong@mediatek.com> References: <20250815085232.30240-1-yunfei.dong@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MTK: N Content-Type: text/plain; charset="utf-8" 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" =20 +int mtk_vcodec_fw_get_ipi(enum mtk_vcodec_fw_type type, int hw_id) +{ + switch (type) { + case SCP: + return hw_id =3D=3D MTK_VDEC_LAT0 ? SCP_IPI_VDEC_LAT : SCP_IPI_VDEC_CORE; + case VCP: + return hw_id =3D=3D MTK_VDEC_LAT0 ? VCP_IPI_LAT_DECODER : VCP_IPI_CORE_D= ECODER; + 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); =20 #endif /* _MTK_VCODEC_FW_H_ */ diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_r= eq_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; =20 instance->ctx =3D ctx; - instance->vpu.id =3D SCP_IPI_VDEC_LAT; - instance->vpu.core_id =3D SCP_IPI_VDEC_CORE; + instance->vpu.id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MT= K_VDEC_LAT0); + instance->vpu.core_id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->typ= e, MTK_VDEC_CORE); instance->vpu.ctx =3D ctx; instance->vpu.codec_type =3D ctx->current_codec; =20 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_h= 264_req_multi_if.c index 5b25e1679b51..50f81f1cb616 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_mul= ti_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_mul= ti_if.c @@ -1212,8 +1212,8 @@ static int vdec_h264_slice_init(struct mtk_vcodec_dec= _ctx *ctx) =20 inst->ctx =3D ctx; =20 - inst->vpu.id =3D SCP_IPI_VDEC_LAT; - inst->vpu.core_id =3D SCP_IPI_VDEC_CORE; + inst->vpu.id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VD= EC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, M= TK_VDEC_CORE); inst->vpu.ctx =3D ctx; inst->vpu.codec_type =3D ctx->current_codec; inst->vpu.capture_type =3D 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_h= evc_req_multi_if.c index 2725db882e5b..80fbd0309b9e 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_mul= ti_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_mul= ti_if.c @@ -863,8 +863,8 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_dec_c= tx *ctx) =20 inst->ctx =3D ctx; =20 - inst->vpu.id =3D SCP_IPI_VDEC_LAT; - inst->vpu.core_id =3D SCP_IPI_VDEC_CORE; + inst->vpu.id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VD= EC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, M= TK_VDEC_CORE); inst->vpu.ctx =3D ctx; inst->vpu.codec_type =3D ctx->current_codec; inst->vpu.capture_type =3D ctx->capture_fourcc; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_r= eq_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_ct= x *ctx) =20 inst->ctx =3D ctx; =20 - inst->vpu.id =3D SCP_IPI_VDEC_LAT; - inst->vpu.core_id =3D SCP_IPI_VDEC_CORE; + inst->vpu.id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MTK_VD= EC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, M= TK_VDEC_CORE); inst->vpu.ctx =3D ctx; inst->vpu.codec_type =3D ctx->current_codec; inst->vpu.capture_type =3D ctx->capture_fourcc; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_r= eq_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; =20 instance->ctx =3D ctx; - instance->vpu.id =3D SCP_IPI_VDEC_LAT; - instance->vpu.core_id =3D SCP_IPI_VDEC_CORE; + instance->vpu.id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->type, MT= K_VDEC_LAT0); + instance->vpu.core_id =3D mtk_vcodec_fw_get_ipi(ctx->dev->fw_handler->typ= e, MTK_VDEC_CORE); instance->vpu.ctx =3D ctx; instance->vpu.codec_type =3D ctx->current_codec; =20 --=20 2.45.2