[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAOTY_-Ws7BmYr-87rb=MWYyGwSCCvv0AoPV10J7d+7TU+7OCA@mail.gmail.com>
Date: Fri, 19 Nov 2021 08:01:46 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: "jason-jh.lin" <jason-jh.lin@...iatek.com>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Matthias Brugger <matthias.bgg@...il.com>,
Jassi Brar <jassisinghbrar@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
DRI Development <dri-devel@...ts.freedesktop.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Fei Shao <fshao@...omium.org>, tzungbi@...gle.com,
Nancy Lin <nancy.lin@...iatek.com>, singo.chang@...iatek.com
Subject: Re: [PATCH 2/3] mailbox: add cmdq_mbox_flush to clear all task before suspend
Hi, Jason:
jason-jh.lin <jason-jh.lin@...iatek.com> 於 2021年11月17日 週三 下午2:42寫道:
>
> 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.lin@...iatek.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);
I would like the normal control flow rather than error handling. So
the normal control flow is:
1. Client driver suspend: Flush command.
2. CMDQ driver suspend: There is no command to flush. If there are
command, show error message and debug the client driver.
The error handling flow:
1. Client driver suspend: Does not flush command.
2. CMDQ driver suspend: Flush command and callback to client driver.
Client driver process these callback as error handling.
The client driver may integrate multiple driver. In the suspend flow,
it may need to stop these driver in a sequence such as.
1. Stop driver 1
2. Stop driver 2
3. Stop driver 3 (cmdq)
4. Stop driver 4
5. Stop driver 5.
In the normal flow, client driver could control the stop flow. In the
error handling flow, it does not match the stop flow.
Regards,
Chun-Kuang.
> + 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
>
Powered by blists - more mailing lists