From: Kyrie Wu <kyrie.wu@mediatek•com>
To: Tiffany Lin <tiffany.lin@mediatek•com>,
Andrew-CT Chen <andrew-ct.chen@mediatek•com>,
Yunfei Dong <yunfei.dong@mediatek•com>,
Mauro Carvalho Chehab <mchehab@kernel•org>,
Rob Herring <robh@kernel•org>,
Krzysztof Kozlowski <krzk+dt@kernel•org>,
Conor Dooley <conor+dt@kernel•org>,
Matthias Brugger <matthias.bgg@gmail•com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora•com>,
Nicolas Dufresne <nicolas.dufresne@collabora•com>,
Ricardo Ribalda <ribalda@chromium•org>,
Kees Cook <kees@kernel•org>,
Hans Verkuil <hverkuil+cisco@kernel•org>,
Haoxiang Li <haoxiang_li2024@163•com>,
Fei Shao <fshao@chromium•org>, Chen-Yu Tsai <wenst@chromium•org>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard•com>,
Sebastian Fricke <sebastian.fricke@collabora•com>,
Benjamin Gaignard <benjamin.gaignard@collabora•com>,
Philipp Zabel <p.zabel@pengutronix•de>,
Qianfeng Rong <rongqianfeng@vivo•com>,
Jacopo Mondi <jacopo.mondi@ideasonboard•com>,
Irui Wang <irui.wang@mediatek•com>, Fan Wu <fanwu01@zju•edu.cn>,
<linux-media@vger•kernel.org>, <devicetree@vger•kernel.org>,
<linux-kernel@vger•kernel.org>,
<linux-arm-kernel@lists•infradead.org>,
<linux-mediatek@lists•infradead.org>,
Kyrie Wu <kyrie.wu@mediatek•com>
Cc: Sakari Ailus <sakari.ailus@linux•intel.com>,
Tzung-Bi Shih <tzungbi@kernel•org>,
Tomasz Figa <tfiga@chromium•org>
Subject: [PATCH v5 04/14] media: mediatek: vcodec: get different firmware ipi id
Date: Wed, 3 Jun 2026 16:40:34 +0800 [thread overview]
Message-ID: <20260603084045.17488-5-kyrie.wu@mediatek.com> (raw)
In-Reply-To: <20260603084045.17488-1-kyrie.wu@mediatek.com>
From: Yunfei Dong <yunfei.dong@mediatek•com>
Getting ipi(inter-processor interrupt) id according to firmware
type and hardware index for different architecture.
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek•com>
---
.../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 64977bcd6abd..a2e6a01272b2 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 2d622e85f827..756fbb7778b1 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 = ctx->dev->fw_handler->type;
int ret;
instance = kzalloc_obj(*instance);
@@ -1884,8 +1885,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(fw_type, MTK_VDEC_LAT0);
+ instance->vpu.core_id = mtk_vcodec_fw_get_ipi(fw_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 10359ce9b934..69d60717181a 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
@@ -1204,6 +1204,7 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs
static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx)
{
+ enum mtk_vcodec_fw_type fw_type = 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)
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(fw_type, MTK_VDEC_LAT0);
+ inst->vpu.core_id = mtk_vcodec_fw_get_ipi(fw_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 02f39954a4c2..dd638ef44083 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
@@ -855,6 +855,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,
static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx)
{
+ enum mtk_vcodec_fw_type fw_type = ctx->dev->fw_handler->type;
struct vdec_hevc_slice_inst *inst;
int err, vsi_size;
@@ -864,8 +865,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(fw_type, MTK_VDEC_LAT0);
+ inst->vpu.core_id = mtk_vcodec_fw_get_ipi(fw_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 391e789a5a13..d65e276f6cea 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
static int vdec_vp8_slice_init(struct mtk_vcodec_dec_ctx *ctx)
{
+ enum mtk_vcodec_fw_type fw_type = ctx->dev->fw_handler->type;
struct vdec_vp8_slice_inst *inst;
int err;
@@ -281,8 +282,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(fw_type, MTK_VDEC_LAT0);
+ inst->vpu.core_id = mtk_vcodec_fw_get_ipi(fw_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 adbacabdbebc..1f0479a8f5cb 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,
static int vdec_vp9_slice_init(struct mtk_vcodec_dec_ctx *ctx)
{
+ enum mtk_vcodec_fw_type fw_type = 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;
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(fw_type, MTK_VDEC_LAT0);
+ instance->vpu.core_id = mtk_vcodec_fw_get_ipi(fw_type, MTK_VDEC_CORE);
instance->vpu.ctx = ctx;
instance->vpu.codec_type = ctx->current_codec;
--
2.45.2
next prev parent reply other threads:[~2026-06-03 8:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 8:40 [PATCH v5 00/14] media: mediatek: vcodec: support video decoder in mt8196 Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 01/14] media: mediatek: vcodec: support vcp architecture Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 02/14] media: mediatek: vcodec: add driver to support vcp Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 03/14] media: mediatek: vcodec: add driver to support vcp encoder Kyrie Wu
2026-06-03 8:40 ` Kyrie Wu [this message]
2026-06-03 8:40 ` [PATCH v5 05/14] media: mediatek: vcodec: get share memory address Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 06/14] media: mediatek: vcodec: define MT8196 vcodec levels Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 07/14] media: mediatek: vcodec: support 36bit iova address Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 08/14] media: mediatek: vcodec: clean xpc status Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 09/14] media: mediatek: vcodec: add debug information Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 10/14] media: mediatek: vcodec: send share memory address to vcp Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 11/14] dt-bindings: media: mediatek: vcodec: add decoder dt-bindings for mt8196 Kyrie Wu
2026-06-03 16:14 ` Conor Dooley
2026-06-03 8:40 ` [PATCH v5 12/14] media: mediatek: vcodec: add decoder compatible to support mt8196 Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 13/14] media: mediatek: decoder: fill av1 buffer size with picinfo Kyrie Wu
2026-06-03 8:40 ` [PATCH v5 14/14] media: mediatek: decoder: support av1 extend vsi Kyrie Wu
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=20260603084045.17488-5-kyrie.wu@mediatek.com \
--to=kyrie.wu@mediatek$(echo .)com \
--cc=andrew-ct.chen@mediatek$(echo .)com \
--cc=angelogioacchino.delregno@collabora$(echo .)com \
--cc=benjamin.gaignard@collabora$(echo .)com \
--cc=conor+dt@kernel$(echo .)org \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=fanwu01@zju$(echo .)edu.cn \
--cc=fshao@chromium$(echo .)org \
--cc=haoxiang_li2024@163$(echo .)com \
--cc=hverkuil+cisco@kernel$(echo .)org \
--cc=irui.wang@mediatek$(echo .)com \
--cc=jacopo.mondi@ideasonboard$(echo .)com \
--cc=kees@kernel$(echo .)org \
--cc=krzk+dt@kernel$(echo .)org \
--cc=laurent.pinchart+renesas@ideasonboard$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-media@vger$(echo .)kernel.org \
--cc=linux-mediatek@lists$(echo .)infradead.org \
--cc=matthias.bgg@gmail$(echo .)com \
--cc=mchehab@kernel$(echo .)org \
--cc=nicolas.dufresne@collabora$(echo .)com \
--cc=p.zabel@pengutronix$(echo .)de \
--cc=ribalda@chromium$(echo .)org \
--cc=robh@kernel$(echo .)org \
--cc=rongqianfeng@vivo$(echo .)com \
--cc=sakari.ailus@linux$(echo .)intel.com \
--cc=sebastian.fricke@collabora$(echo .)com \
--cc=tfiga@chromium$(echo .)org \
--cc=tiffany.lin@mediatek$(echo .)com \
--cc=tzungbi@kernel$(echo .)org \
--cc=wenst@chromium$(echo .)org \
--cc=yunfei.dong@mediatek$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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