[PATCH] media: mediatek: vpu: Prefix IPI IDs with MTK_VPU_
From: Romain Mahoux
Date: Fri Dec 04 2026 - 10:45:18 EST
The IPI IDs used by the MediaTek media drivers, such as IPI_MDP, have
generic names that can conflict with identifiers defined in other
headers. The former IPI_MAX already clashed with the RISC-V IPI_MAX
from asm/smp.h, and was renamed to IPI_VPU_MAX in commit d1d2645e755b
("media: mtk-vpu: rename IPI_MAX to IPI_VPU_MAX").
Prefix all of them with MTK_VPU_IPI_, consistent with the SCP_IPI_
names used by the MediaTek SCP driver.
No functional change intended.
Suggested-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
Link: https://lore.kernel.org/all/arDSR9S3tZPB91Zm@monoceros/
Signed-off-by: Romain Mahoux <romain@xxxxxxxxx>
---
Follow-up to the IPI_MAX discussion in the thread linked below:
https://lore.kernel.org/all/arDSR9S3tZPB91Zm@monoceros/
Build-tested with allmodconfig on arm64 and riscv (LLVM=1), no new warnings.
---
drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h | 6 ++--
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c | 12 +++++---
.../mediatek/vcodec/decoder/vdec/vdec_h264_if.c | 2 +-
.../mediatek/vcodec/decoder/vdec/vdec_vp8_if.c | 2 +-
.../mediatek/vcodec/decoder/vdec/vdec_vp9_if.c | 2 +-
.../mediatek/vcodec/encoder/venc/venc_h264_if.c | 2 +-
.../mediatek/vcodec/encoder/venc/venc_vp8_if.c | 2 +-
drivers/media/platform/mediatek/vpu/mtk_vpu.c | 18 +++++------
drivers/media/platform/mediatek/vpu/mtk_vpu.h | 36 +++++++++++-----------
9 files changed, 42 insertions(+), 40 deletions(-)
diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h b/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h
index 9744e00b0066..f18a56794970 100644
--- a/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h
+++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h
@@ -25,7 +25,7 @@ enum mdp_ipi_msgid {
/**
* struct mdp_ipi_init - for AP_MDP_INIT
* @msg_id : AP_MDP_INIT
- * @ipi_id : IPI_MDP
+ * @ipi_id : MTK_VPU_IPI_MDP
* @ap_inst : AP mtk_mdp_vpu address
*/
struct mdp_ipi_init {
@@ -37,7 +37,7 @@ struct mdp_ipi_init {
/**
* struct mdp_ipi_comm - for AP_MDP_PROCESS, AP_MDP_DEINIT
* @msg_id : AP_MDP_PROCESS, AP_MDP_DEINIT
- * @ipi_id : IPI_MDP
+ * @ipi_id : MTK_VPU_IPI_MDP
* @ap_inst : AP mtk_mdp_vpu address
* @vpu_inst_addr : VPU MDP instance address
* @padding : Alignment padding
@@ -53,7 +53,7 @@ struct mdp_ipi_comm {
/**
* struct mdp_ipi_comm_ack - for VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
* @msg_id : VPU_MDP_DEINIT_ACK, VPU_MDP_PROCESS_ACK
- * @ipi_id : IPI_MDP
+ * @ipi_id : MTK_VPU_IPI_MDP
* @ap_inst : AP mtk_mdp_vpu address
* @vpu_inst_addr : VPU MDP instance address
* @status : VPU execution result
diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c b/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
index 378a1cba0144..d22b8c113c73 100644
--- a/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
+++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
@@ -63,7 +63,7 @@ int mtk_mdp_vpu_register(struct platform_device *pdev)
struct mtk_mdp_dev *mdp = platform_get_drvdata(pdev);
int err;
- err = vpu_ipi_register(mdp->vpu_dev, IPI_MDP,
+ err = vpu_ipi_register(mdp->vpu_dev, MTK_VPU_IPI_MDP,
mtk_mdp_vpu_ipi_handler, "mdp_vpu", NULL);
if (err)
dev_err(&mdp->pdev->dev,
@@ -99,10 +99,11 @@ static int mtk_mdp_vpu_send_ap_ipi(struct mtk_mdp_vpu *vpu, uint32_t msg_id)
struct mdp_ipi_comm msg;
msg.msg_id = msg_id;
- msg.ipi_id = IPI_MDP;
+ msg.ipi_id = MTK_VPU_IPI_MDP;
msg.vpu_inst_addr = vpu->inst_addr;
msg.ap_inst = (unsigned long)vpu;
- err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu, IPI_MDP);
+ err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu,
+ MTK_VPU_IPI_MDP);
if (!err && vpu->failure)
err = -EINVAL;
@@ -118,9 +119,10 @@ int mtk_mdp_vpu_init(struct mtk_mdp_vpu *vpu)
vpu->pdev = ctx->mdp_dev->vpu_dev;
msg.msg_id = AP_MDP_INIT;
- msg.ipi_id = IPI_MDP;
+ msg.ipi_id = MTK_VPU_IPI_MDP;
msg.ap_inst = (unsigned long)vpu;
- err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu, IPI_MDP);
+ err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu,
+ MTK_VPU_IPI_MDP);
if (!err && vpu->failure)
err = -EINVAL;
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c
index a95327388f57..09db52fbfc4d 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c
@@ -276,7 +276,7 @@ static int vdec_h264_init(struct mtk_vcodec_dec_ctx *ctx)
inst->ctx = ctx;
- inst->vpu.id = IPI_VDEC_H264;
+ inst->vpu.id = MTK_VPU_IPI_VDEC_H264;
inst->vpu.ctx = ctx;
err = vpu_dec_init(&inst->vpu);
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c
index fd15d462b168..368521a1c54a 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c
@@ -396,7 +396,7 @@ static int vdec_vp8_init(struct mtk_vcodec_dec_ctx *ctx)
inst->ctx = ctx;
- inst->vpu.id = IPI_VDEC_VP8;
+ inst->vpu.id = MTK_VPU_IPI_VDEC_VP8;
inst->vpu.ctx = ctx;
err = vpu_dec_init(&inst->vpu);
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c
index 80554b2c26c0..342e7c86240c 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c
@@ -783,7 +783,7 @@ static int vdec_vp9_init(struct mtk_vcodec_dec_ctx *ctx)
inst->total_frm_cnt = 0;
inst->ctx = ctx;
- inst->vpu.id = IPI_VDEC_VP9;
+ inst->vpu.id = MTK_VPU_IPI_VDEC_VP9;
inst->vpu.ctx = ctx;
if (vpu_dec_init(&inst->vpu)) {
diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
index d2f4d732d2f7..7c99bf0ebfa1 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
@@ -597,7 +597,7 @@ static int h264_enc_init(struct mtk_vcodec_enc_ctx *ctx)
if (is_ext)
inst->vpu_inst.id = SCP_IPI_VENC_H264;
else
- inst->vpu_inst.id = IPI_VENC_H264;
+ inst->vpu_inst.id = MTK_VPU_IPI_VENC_H264;
inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_SYS);
diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c
index f739fd5fafcc..f429f3797a52 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c
@@ -322,7 +322,7 @@ static int vp8_enc_init(struct mtk_vcodec_enc_ctx *ctx)
inst->ctx = ctx;
inst->vpu_inst.ctx = ctx;
- inst->vpu_inst.id = IPI_VENC_VP8;
+ inst->vpu_inst.id = MTK_VPU_IPI_VENC_VP8;
inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base, VENC_LT_SYS);
ret = vpu_enc_init(&inst->vpu_inst);
diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
index 437ad492374f..3505d3dfa02d 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
@@ -211,7 +211,7 @@ struct mtk_vpu {
struct vpu_regs reg;
struct vpu_run run;
struct vpu_wdt wdt;
- struct vpu_ipi_desc ipi_desc[IPI_VPU_MAX];
+ struct vpu_ipi_desc ipi_desc[MTK_VPU_IPI_MAX];
struct share_obj __iomem *recv_buf;
struct share_obj __iomem *send_buf;
struct device *dev;
@@ -221,7 +221,7 @@ struct mtk_vpu {
struct mutex vpu_mutex; /* for protecting vpu data data structure */
u32 wdt_refcnt;
wait_queue_head_t ack_wq;
- bool ipi_id_ack[IPI_VPU_MAX];
+ bool ipi_id_ack[MTK_VPU_IPI_MAX];
};
static inline void vpu_cfg_writel(struct mtk_vpu *vpu, u32 val, u32 offset)
@@ -296,7 +296,7 @@ int vpu_ipi_register(struct platform_device *pdev,
return -EPROBE_DEFER;
}
- if (id < IPI_VPU_MAX && handler) {
+ if (id < MTK_VPU_IPI_MAX && handler) {
ipi_desc = vpu->ipi_desc;
ipi_desc[id].name = name;
ipi_desc[id].handler = handler;
@@ -319,7 +319,7 @@ int vpu_ipi_send(struct platform_device *pdev,
unsigned long timeout;
int ret = 0;
- if (id <= IPI_VPU_INIT || id >= IPI_VPU_MAX ||
+ if (id <= MTK_VPU_IPI_INIT || id >= MTK_VPU_IPI_MAX ||
len > sizeof(send_obj->share_buf) || !buf) {
dev_err(vpu->dev, "failed to send ipi message\n");
return -EINVAL;
@@ -748,10 +748,10 @@ static void vpu_ipi_handler(struct mtk_vpu *vpu)
s32 id = readl(&rcv_obj->id);
memcpy_fromio(data, rcv_obj->share_buf, sizeof(data));
- if (id < IPI_VPU_MAX && ipi_desc[id].handler) {
+ if (id < MTK_VPU_IPI_MAX && ipi_desc[id].handler) {
ipi_desc[id].handler(data, readl(&rcv_obj->len),
ipi_desc[id].priv);
- if (id > IPI_VPU_INIT) {
+ if (id > MTK_VPU_IPI_INIT) {
vpu->ipi_id_ack[id] = true;
wake_up(&vpu->ack_wq);
}
@@ -869,10 +869,10 @@ static int mtk_vpu_probe(struct platform_device *pdev)
}
/* register vpu initialization IPI */
- ret = vpu_ipi_register(pdev, IPI_VPU_INIT, vpu_init_ipi_handler,
+ ret = vpu_ipi_register(pdev, MTK_VPU_IPI_INIT, vpu_init_ipi_handler,
"vpu_init", vpu);
if (ret) {
- dev_err(dev, "Failed to register IPI_VPU_INIT\n");
+ dev_err(dev, "Failed to register MTK_VPU_IPI_INIT\n");
goto vpu_mutex_destroy;
}
@@ -934,7 +934,7 @@ static int mtk_vpu_probe(struct platform_device *pdev)
#ifdef CONFIG_DEBUG_FS
debugfs_remove(vpu_debugfs);
#endif
- memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_VPU_MAX);
+ memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * MTK_VPU_IPI_MAX);
vpu_mutex_destroy:
mutex_destroy(&vpu->vpu_mutex);
disable_vpu_clk:
diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
index 44ab631ec904..f2ea880c7a3a 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
@@ -24,43 +24,43 @@ typedef void (*ipi_handler_t) (void *data,
/**
* enum ipi_id - the id of inter-processor interrupt
*
- * @IPI_VPU_INIT: The interrupt from vpu is to notfiy kernel
+ * @MTK_VPU_IPI_INIT: The interrupt from vpu is to notfiy kernel
* VPU initialization completed.
- * IPI_VPU_INIT is sent from VPU when firmware is
- * loaded. AP doesn't need to send IPI_VPU_INIT
+ * MTK_VPU_IPI_INIT is sent from VPU when firmware is
+ * loaded. AP doesn't need to send MTK_VPU_IPI_INIT
* command to VPU.
* For other IPI below, AP should send the request
* to VPU to trigger the interrupt.
- * @IPI_VDEC_H264: The interrupt from vpu is to notify kernel to
+ * @MTK_VPU_IPI_VDEC_H264: The interrupt from vpu is to notify kernel to
* handle H264 vidoe decoder job, and vice versa.
* Decode output format is always MT21 no matter what
* the input format is.
- * @IPI_VDEC_VP8: The interrupt from is to notify kernel to
+ * @MTK_VPU_IPI_VDEC_VP8: The interrupt from is to notify kernel to
* handle VP8 video decoder job, and vice versa.
* Decode output format is always MT21 no matter what
* the input format is.
- * @IPI_VDEC_VP9: The interrupt from vpu is to notify kernel to
+ * @MTK_VPU_IPI_VDEC_VP9: The interrupt from vpu is to notify kernel to
* handle VP9 video decoder job, and vice versa.
* Decode output format is always MT21 no matter what
* the input format is.
- * @IPI_VENC_H264: The interrupt from vpu is to notify kernel to
+ * @MTK_VPU_IPI_VENC_H264: The interrupt from vpu is to notify kernel to
* handle H264 video encoder job, and vice versa.
- * @IPI_VENC_VP8: The interrupt fro vpu is to notify kernel to
+ * @MTK_VPU_IPI_VENC_VP8: The interrupt fro vpu is to notify kernel to
* handle VP8 video encoder job,, and vice versa.
- * @IPI_MDP: The interrupt from vpu is to notify kernel to
+ * @MTK_VPU_IPI_MDP: The interrupt from vpu is to notify kernel to
* handle MDP (Media Data Path) job, and vice versa.
- * @IPI_VPU_MAX: The maximum VPU IPI number
+ * @MTK_VPU_IPI_MAX: The maximum VPU IPI number
*/
enum ipi_id {
- IPI_VPU_INIT = 0,
- IPI_VDEC_H264,
- IPI_VDEC_VP8,
- IPI_VDEC_VP9,
- IPI_VENC_H264,
- IPI_VENC_VP8,
- IPI_MDP,
- IPI_VPU_MAX,
+ MTK_VPU_IPI_INIT = 0,
+ MTK_VPU_IPI_VDEC_H264,
+ MTK_VPU_IPI_VDEC_VP8,
+ MTK_VPU_IPI_VDEC_VP9,
+ MTK_VPU_IPI_VENC_H264,
+ MTK_VPU_IPI_VENC_VP8,
+ MTK_VPU_IPI_MDP,
+ MTK_VPU_IPI_MAX,
};
/**
---
base-commit: 50d38f9c1359c0bd13963cc6bc09f4323ee212a2
change-id: 20261204-mtk-vpu-prefix-997995c810fd
Best regards,
--
Romain Mahoux <romain@xxxxxxxxx>