CMDQ driver will occupy GCE clock to execute the task in GCE thread.

So call cmdq_mbox_flush to clear all task in GCE thread before
CMDQ suspend.

Signed-off-by: jason-jh.lin <jason-jh....@mediatek.com>
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c 
b/drivers/mailbox/mtk-cmdq-mailbox.c
index 03f9ed4c5131..28cadfc0091b 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -484,21 +484,18 @@ static int cmdq_suspend(struct device *dev)
        struct cmdq *cmdq = dev_get_drvdata(dev);
        struct cmdq_thread *thread;
        int i;
-       bool task_running = false;
 
        cmdq->suspended = true;
 
        for (i = 0; i < cmdq->thread_nr; i++) {
                thread = &cmdq->thread[i];
                if (!list_empty(&thread->task_busy_list)) {
-                       task_running = true;
-                       break;
+                       /* try to clear all task in this thread */
+                       cmdq_mbox_flush(thread->chan, 2000);
+                       dev_warn(dev, "thread[%d] exist running task(s) in 
suspend\n", i);
                }
        }
 
-       if (task_running)
-               dev_warn(dev, "exist running task(s) in suspend\n");
-
        clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
 
        return 0;
-- 
2.18.0

Reply via email to