[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250829091727.3745415-4-jason-jh.lin@mediatek.com>
Date: Fri, 29 Aug 2025 17:16:00 +0800
From: Jason-JH Lin <jason-jh.lin@...iatek.com>
To: Chun-Kuang Hu <chunkuang.hu@...nel.org>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Jassi Brar
<jassisinghbrar@...il.com>, Mauro Carvalho Chehab <mchehab@...nel.org>
CC: Philipp Zabel <p.zabel@...gutronix.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Jason-JH Lin <jason-jh.lin@...iatek.com>,
Nancy Lin <nancy.lin@...iatek.com>, Singo Chang <singo.chang@...iatek.com>,
Paul-PL Chen <paul-pl.chen@...iatek.com>, Yongqiang Niu
<yongqiang.niu@...iatek.com>, Zhenxing Qin <zhenxing.qin@...iatek.com>,
Xiandong Wang <xiandong.wang@...iatek.com>, Sirius Wang
<sirius.wang@...iatek.com>, Xavier Chang <xavier.chang@...iatek.com>,
"Jarried Lin" <jarried.lin@...iatek.com>, Fei Shao <fshao@...omium.org>,
Chen-yu Tsai <wenst@...omium.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
<dri-devel@...ts.freedesktop.org>, <linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-media@...r.kernel.org>
Subject: [PATCH v2 3/3] media: platform: mtk-mdp3: Add pm_runtime support for GCE power control
Call pm_runtime_resume_and_get() before accessing GCE hardware in
mbox_send_message(), and invoke pm_runtime_put_autosuspend() in the
cmdq callback to release the PM reference and start autosuspend for
GCE. This ensures correct power management for the GCE device.
Fixes: 8afe816b0c99 ("mailbox: mtk-cmdq-mailbox: Implement Runtime PM with autosuspend")
Signed-off-by: Jason-JH Lin <jason-jh.lin@...iatek.com>
---
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
index e5ccf673e152..bb7a895318af 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
@@ -6,6 +6,7 @@
#include <linux/mailbox_controller.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include "mtk-mdp3-cfg.h"
#include "mtk-mdp3-cmdq.h"
#include "mtk-mdp3-comp.h"
@@ -521,6 +522,9 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg)
mdp = cmd->mdp;
dev = &mdp->pdev->dev;
+ pm_runtime_mark_last_busy(mdp->cmdq_clt[cmd->pp_idx]->chan->mbox->dev);
+ pm_runtime_put_autosuspend(mdp->cmdq_clt[cmd->pp_idx]->chan->mbox->dev);
+
INIT_WORK(&cmd->auto_release_work, mdp_auto_release_work);
if (!queue_work(mdp->clock_wq, &cmd->auto_release_work)) {
struct mtk_mutex *mutex;
@@ -702,6 +706,13 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param)
cmd[i]->pkt.pa_base, cmd[i]->pkt.cmd_buf_size,
DMA_TO_DEVICE);
+ ret = pm_runtime_resume_and_get(mdp->cmdq_clt[i]->chan->mbox->dev);
+ if (ret < 0) {
+ dev_err(dev, "pm_runtime_resume_and_get fail: %d!\n", ret);
+ i = pp_used;
+ goto err_clock_off;
+ }
+
ret = mbox_send_message(mdp->cmdq_clt[i]->chan, &cmd[i]->pkt);
if (ret < 0) {
dev_err(dev, "mbox send message fail %d!\n", ret);
--
2.43.0
Powered by blists - more mailing lists