Commit afcfb6c8 authored by Jason-JH Lin's avatar Jason-JH Lin Committed by Chun-Kuang Hu
Browse files

drm/mediatek: 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: 8afe816b ("mailbox: mtk-cmdq-mailbox: Implement Runtime PM with autosuspend")
Signed-off-by: default avatarJason-JH Lin <jason-jh.lin@mediatek.com>
Reviewed-by: default avatarCK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20250829091727.3745415-3-jason-jh.lin@mediatek.com/


Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent 9882a406
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -283,6 +283,10 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
	unsigned int i;
	unsigned long flags;

	/* release GCE HW usage and start autosuspend */
	pm_runtime_mark_last_busy(cmdq_cl->chan->mbox->dev);
	pm_runtime_put_autosuspend(cmdq_cl->chan->mbox->dev);

	if (data->sta < 0)
		return;

@@ -618,6 +622,9 @@ static void mtk_crtc_update_config(struct mtk_crtc *mtk_crtc, bool needs_vblank)
		mtk_crtc->config_updating = false;
		spin_unlock_irqrestore(&mtk_crtc->config_lock, flags);

		if (pm_runtime_resume_and_get(mtk_crtc->cmdq_client.chan->mbox->dev) < 0)
			goto update_config_out;

		mbox_send_message(mtk_crtc->cmdq_client.chan, cmdq_handle);
		mbox_client_txdone(mtk_crtc->cmdq_client.chan, 0);
		goto update_config_out;