From: Xiandong Wang <xiandong.wang@mediatek.com>
To: Jassi Brar <jassisinghbrar@gmail.com>,
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>,
Yongqiang Niu <yongqiang.niu@mediatek.com>
Cc: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>, <sirius.wang@mediatek.com>,
<vince-wl.liu@mediatek.com>, <jh.hsu@mediatek.com>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
Xiandong Wang <xiandong.wang@mediatek.com>
Subject: [PATCH v3 4/4] mailbox: mtk-cmdq: modify clk api for suspend/resume
Date: Tue, 19 Aug 2025 11:36:11 +0800 [thread overview]
Message-ID: <20250819033746.16405-5-xiandong.wang@mediatek.com> (raw)
In-Reply-To: <20250819033746.16405-1-xiandong.wang@mediatek.com>
Since it is necessary to use clk_bulk_prepare_enable
and clk_bulk_disable_unprepare instead of clk_bulk
enable and clk_bulk_disable because, on 8189, the
gce clk is mounted on the mminfra clk. When disabling
and enabling, the parent clk must be enabled and
disabled first to correctly switch the clk for gce usage.
Modify the clk api for suspend and resume, modify the api for
suspend and resume to disable/enable clk, so it can disable/enable
module clk and parent clk successfully.
Signed-off-by: Xiandong Wang <xiandong.wang@mediatek.com>
---
drivers/mailbox/mtk-cmdq-mailbox.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 543cd86b5bb0..590f0f6e51b0 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -161,14 +161,14 @@ static void cmdq_init(struct cmdq *cmdq)
{
int i;
- WARN_ON(clk_bulk_enable(cmdq->pdata->gce_num, cmdq->clocks));
+ WARN_ON(clk_bulk_prepare_enable(cmdq->pdata->gce_num, cmdq->clocks));
cmdq_gctl_value_toggle(cmdq, true);
writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
for (i = 0; i <= CMDQ_MAX_EVENT; i++)
writel(i, cmdq->base + CMDQ_SYNC_TOKEN_UPDATE);
- clk_bulk_disable(cmdq->pdata->gce_num, cmdq->clocks);
+ clk_bulk_disable_unprepare(cmdq->pdata->gce_num, cmdq->clocks);
}
static int cmdq_thread_reset(struct cmdq *cmdq, struct cmdq_thread *thread)
@@ -332,7 +332,7 @@ static int cmdq_runtime_resume(struct device *dev)
struct cmdq *cmdq = dev_get_drvdata(dev);
int ret;
- ret = clk_bulk_enable(cmdq->pdata->gce_num, cmdq->clocks);
+ ret = clk_bulk_prepare_enable(cmdq->pdata->gce_num, cmdq->clocks);
if (ret)
return ret;
@@ -345,7 +345,7 @@ static int cmdq_runtime_suspend(struct device *dev)
struct cmdq *cmdq = dev_get_drvdata(dev);
cmdq_gctl_value_toggle(cmdq, false);
- clk_bulk_disable(cmdq->pdata->gce_num, cmdq->clocks);
+ clk_bulk_disable_unprepare(cmdq->pdata->gce_num, cmdq->clocks);
return 0;
}
@@ -384,12 +384,8 @@ static int cmdq_resume(struct device *dev)
static void cmdq_remove(struct platform_device *pdev)
{
- struct cmdq *cmdq = platform_get_drvdata(pdev);
-
if (!IS_ENABLED(CONFIG_PM))
cmdq_runtime_suspend(&pdev->dev);
-
- clk_bulk_unprepare(cmdq->pdata->gce_num, cmdq->clocks);
}
static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
@@ -708,8 +704,6 @@ static int cmdq_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, cmdq);
- WARN_ON(clk_bulk_prepare(cmdq->pdata->gce_num, cmdq->clocks));
-
cmdq_init(cmdq);
err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
--
2.46.0
next prev parent reply other threads:[~2025-08-19 3:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 3:36 [PATCH v3 0/4] Add GCE driver for 8189 Xiandong Wang
2025-08-19 3:36 ` [PATCH v3 1/4] dt-bindings: mailbox: add cmdq yaml for MT8189 Xiandong Wang
2025-08-19 3:36 ` [PATCH v3 2/4] arm64: dts: mediatek: Add GCE header for mt8189 Xiandong Wang
2025-08-19 3:36 ` [PATCH v3 3/4] mailbox: mtk-cmdq: Add cmdq driver " Xiandong Wang
2025-08-22 17:07 ` kernel test robot
2025-08-19 3:36 ` Xiandong Wang [this message]
2025-08-19 6:50 ` [PATCH v3 0/4] Add GCE driver for 8189 Krzysztof Kozlowski
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=20250819033746.16405-5-xiandong.wang@mediatek.com \
--to=xiandong.wang@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=jh.hsu@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
--cc=sirius.wang@mediatek.com \
--cc=vince-wl.liu@mediatek.com \
--cc=yongqiang.niu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).