From nobody Wed Feb 11 11:33:26 2026 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 2845534DCCA; Wed, 11 Feb 2026 05:42:32 +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=1770788554; cv=none; b=P4yATKzHGYiekHfRlYGW8a/fo95PWF/Mfwf/BSG+RBQknYLrAAQAvNJw9t+2LtykiIl6WP5i97PM1TcOn9YdZXLn7IX0BpxzELWcJqAjL+EUK9VHGlUTRW4oRfyFFnhXyF7G4ZO7RCSzhdwfANUnXYXG/5GZKKArsIYNQmH+fYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770788554; c=relaxed/simple; bh=CBnbEcsfW9rG8jpm+xy+HApI4E0OOSlKcBsJrOCyn8Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W92+n9OjMKCvrrbDd02OXgyeEOIyAqdf/lGpn2nSC0ToqDlQQpbARCNB3gLjvJTEFAz5oitGhzMD389+P/++sNX3WG+Uh373gGrJD0JCqTkai41NjbNJLQg0DinHn6ni87KSE06DWrX2g7gjPwQH/UQerPfGQxYiqOYa0b4LiCA= 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=pMKVR2wa; 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="pMKVR2wa" X-UUID: 7265c4ee070c11f185319dbc3099e8fb-20260211 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=I8JOeYlQ4PIMz2gRUrc87JnjNhfOyg4gIeV6N6y6Lvc=; b=pMKVR2waMuvE+Zu00GnnQny8xHvQ06WazA3uzIfehwhi0Ji9vltwn5oTVCrtBGDhE73Mn7fQXtPrDfufGTO235vM+GybtFYV+qnWISlueotsx9Oy11x22H9Ar3bS/1Wl2YqnMWSsxMBvHjtycE6ly7kdGQBW5Gz+HOf1mYBWNmA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:0c992375-f131-47a7-be83-faa222e0478a,IP:0,U RL: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:89c9d04,CLOUDID:eb682b5b-a957-4259-bcca-d3af718d7034,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|888|898,TC:-5,Content: 0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,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: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 7265c4ee070c11f185319dbc3099e8fb-20260211 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 71550895; Wed, 11 Feb 2026 13:42:26 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Wed, 11 Feb 2026 13:42:26 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Wed, 11 Feb 2026 13:42:25 +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 v3 05/14] media: mediatek: vcodec: get different firmware ipi id Date: Wed, 11 Feb 2026 13:41:32 +0800 Message-ID: <20260211054149.27249-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20260211054149.27249-1-yunfei.dong@mediatek.com> References: <20260211054149.27249-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 | 5 +++-- .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 5 +++-- .../vcodec/decoder/vdec/vdec_hevc_req_multi_if.c | 5 +++-- .../mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c | 5 +++-- .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 5 +++-- 7 files changed, 29 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 7be4b6086920..a22802c9ebea 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 @@ -1877,6 +1877,7 @@ static int vdec_av1_slice_init(struct mtk_vcodec_dec_= ctx *ctx) { struct vdec_av1_slice_instance *instance; struct vdec_av1_slice_init_vsi *vsi; + enum mtk_vcodec_fw_type fw_type =3D ctx->dev->fw_handler->type; int ret; =20 instance =3D kzalloc(sizeof(*instance), GFP_KERNEL); @@ -1884,8 +1885,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(fw_type, MTK_VDEC_LAT0); + instance->vpu.core_id =3D mtk_vcodec_fw_get_ipi(fw_type, 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 9a9dc2f88d6e..2be1f6096de6 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 @@ -1204,6 +1204,7 @@ static int vdec_h264_slice_single_decode(void *h_vdec= , struct mtk_vcodec_mem *bs =20 static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx) { + enum mtk_vcodec_fw_type fw_type =3D ctx->dev->fw_handler->type; struct vdec_h264_slice_inst *inst; int err, vsi_size; unsigned char *temp; @@ -1214,8 +1215,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(fw_type, MTK_VDEC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(fw_type, MTK_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 88eca50c2017..2b0255257384 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 @@ -855,6 +855,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vde= c_hevc_slice_inst *inst, =20 static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx) { + enum mtk_vcodec_fw_type fw_type =3D ctx->dev->fw_handler->type; struct vdec_hevc_slice_inst *inst; int err, vsi_size; =20 @@ -864,8 +865,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(fw_type, MTK_VDEC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(fw_type, MTK_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 e1d4960553f2..36b76a92fdc2 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 @@ -272,6 +272,7 @@ static int vdec_vp8_slice_get_decode_parameters(struct = vdec_vp8_slice_inst *inst =20 static int vdec_vp8_slice_init(struct mtk_vcodec_dec_ctx *ctx) { + enum mtk_vcodec_fw_type fw_type =3D ctx->dev->fw_handler->type; struct vdec_vp8_slice_inst *inst; int err; =20 @@ -281,8 +282,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(fw_type, MTK_VDEC_LAT0); + inst->vpu.core_id =3D mtk_vcodec_fw_get_ipi(fw_type, MTK_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 cd1935014d76..a700532ed7f2 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 @@ -1844,6 +1844,7 @@ static int vdec_vp9_slice_update_core(struct vdec_vp9= _slice_instance *instance, =20 static int vdec_vp9_slice_init(struct mtk_vcodec_dec_ctx *ctx) { + enum mtk_vcodec_fw_type fw_type =3D ctx->dev->fw_handler->type; struct vdec_vp9_slice_instance *instance; struct vdec_vp9_slice_init_vsi *vsi; int ret; @@ -1853,8 +1854,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(fw_type, MTK_VDEC_LAT0); + instance->vpu.core_id =3D mtk_vcodec_fw_get_ipi(fw_type, MTK_VDEC_CORE); instance->vpu.ctx =3D ctx; instance->vpu.codec_type =3D ctx->current_codec; =20 --=20 2.45.2