[RFC PATCH V0 06/10] media: mtk-mdp3: move clock on to precise place

Moudy Ho
2021-06-23T07:36:16Z

From: daoyuan huang <daoyuan.huang@mediatek.com>

Move clock on to the previous line of cmdq_pkt_flush.

Due to there're two ways(sync/async) to submit CMDQ task,
and for async case we need to prepare callback param struct along
with error checks and error handlings before submit,
if we move clock on after these error check steps,
we can save some clock off code in error handling.

Signed-off-by: daoyuan huang <daoyuan.huang@mediatek.com>
---
drivers/media/platform/mtk-mdp3/mtk-mdp3-cmdq.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mtk-mdp3/mtk-mdp3-cmdq.c
index df956ca3685c..a1bdf92d45f7 100644
--- a/drivers/media/platform/mtk-mdp3/mtk-mdp3-cmdq.c
+++ b/drivers/media/platform/mtk-mdp3/mtk-mdp3-cmdq.c
@@ -445,11 +445,9 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param)
return ret;
}

- // TODO: engine conflict dispatch
- for (i = 0; i < param->config->num_components; i++)
- mdp_comp_clock_on(&mdp->pdev->dev, path.comps[i].comp);
-
if (param->wait) {
+ for (i = 0; i < param->config->num_components; i++)
+ mdp_comp_clock_on(&mdp->pdev->dev, path.comps[i].comp);
ret = cmdq_pkt_flush(cmd.pkt);
#ifdef MDP_DEBUG
if (ret) {
@@ -495,6 +493,9 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param)
cb_param->num_comps = param->config->num_components;
cb_param->mdp_ctx = param->mdp_ctx;

+ mdp_comp_clocks_on(&mdp->pdev->dev, cb_param->comps,
+ cb_param->num_comps);
+
ret = cmdq_pkt_flush_async(cmd.pkt,
mdp_handle_cmdq_callback,
(void *)cb_param);
--
2.18.0