[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a6qhm6viuldidhtc32l7qajx24yh6wrntxi63jm4n4cvp7ktmu@sum7w5cwpbms>
Date: Wed, 15 Jan 2025 12:01:02 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Renjiang Han <quic_renjiang@...cinc.com>
Cc: Bjorn Andersson <andersson@...nel.org>,
Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>,
Stanimir Varbanov <stanimir.k.varbanov@...il.com>, Vikash Garodia <quic_vgarodia@...cinc.com>,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>, Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org
Subject: Re: [PATCH v3 3/3] venus: pm_helpers: Remove dead code and simplify
power management
On Wed, Jan 15, 2025 at 03:00:54PM +0530, Renjiang Han wrote:
> The functions poweron_coreid(), poweroff_coreid() and vcodec_control_v4()
> are only used for v4 and v6. Remove the dead code by:
> - Removing vcodec_control_v4() function
> - Removing the check for !IS_V6(core) && !IS_V4(core) in poweron_coreid()
> and poweroff_coreid()
>
> Directly call dev_pm_genpd_set_hwmode() without vcodec_control_v4().
>
> Signed-off-by: Renjiang Han <quic_renjiang@...cinc.com>
> ---
> drivers/media/platform/qcom/venus/pm_helpers.c | 73 +++-----------------------
> 1 file changed, 8 insertions(+), 65 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index a2062b366d4aedba3eb5e4be456a005847eaec0b..846aa765edbb33df0b0c39bb463dd68c16ce1b68 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -406,74 +406,29 @@ static const struct venus_pm_ops pm_ops_v3 = {
> .load_scale = load_scale_v1,
> };
>
> -static int vcodec_control_v4(struct venus_core *core, u32 coreid, bool enable)
> -{
> - void __iomem *ctrl, *stat;
> - u32 val;
> - int ret;
> -
> - if (IS_V6(core) || IS_V4(core))
> - return dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[coreid], !enable);
> - else if (coreid == VIDC_CORE_ID_1) {
> - ctrl = core->wrapper_base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL;
> - stat = core->wrapper_base + WRAPPER_VCODEC0_MMCC_POWER_STATUS;
> - } else {
> - ctrl = core->wrapper_base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL;
> - stat = core->wrapper_base + WRAPPER_VCODEC1_MMCC_POWER_STATUS;
> - }
> -
> - if (enable) {
> - writel(0, ctrl);
> -
> - ret = readl_poll_timeout(stat, val, val & BIT(1), 1, 100);
> - if (ret)
> - return ret;
> - } else {
> - writel(1, ctrl);
> -
> - ret = readl_poll_timeout(stat, val, !(val & BIT(1)), 1, 100);
> - if (ret)
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask)
> {
> int ret;
>
> if (coreid_mask & VIDC_CORE_ID_1) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_1, true);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_1], false);
> if (ret)
> return ret;
>
> vcodec_clks_disable(core, core->vcodec0_clks);
>
> - if (!IS_V6(core) && !IS_V4(core)) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false);
> - if (ret)
> - return ret;
> - }
> -
> ret = pm_runtime_put_sync(core->pmdomains->pd_devs[1]);
> if (ret < 0)
> return ret;
> }
>
> if (coreid_mask & VIDC_CORE_ID_2) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_2, true);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_2], false);
> if (ret)
> return ret;
>
> vcodec_clks_disable(core, core->vcodec1_clks);
>
> - if (!IS_V6(core) && !IS_V4(core)) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false);
> - if (ret)
> - return ret;
> - }
> -
> ret = pm_runtime_put_sync(core->pmdomains->pd_devs[2]);
> if (ret < 0)
> return ret;
> @@ -491,17 +446,11 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
> if (ret < 0)
> return ret;
>
> - if (!IS_V6(core) && !IS_V4(core)) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_1, true);
> - if (ret)
> - return ret;
> - }
> -
> ret = vcodec_clks_enable(core, core->vcodec0_clks);
> if (ret)
> return ret;
>
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_1], true);
> if (ret < 0)
> return ret;
> }
> @@ -511,17 +460,11 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
> if (ret < 0)
> return ret;
>
> - if (!IS_V6(core) && !IS_V4(core)) {
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_2, true);
> - if (ret)
> - return ret;
> - }
> -
> ret = vcodec_clks_enable(core, core->vcodec1_clks);
> if (ret)
> return ret;
>
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_2], true);
> if (ret < 0)
> return ret;
> }
> @@ -802,7 +745,7 @@ static int vdec_power_v4(struct device *dev, int on)
> if (!legacy_binding)
> return 0;
>
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_1, true);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_1], false);
> if (ret)
> return ret;
>
> @@ -811,7 +754,7 @@ static int vdec_power_v4(struct device *dev, int on)
> else
> vcodec_clks_disable(core, core->vcodec0_clks);
>
> - vcodec_control_v4(core, VIDC_CORE_ID_1, false);
> + dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_1], true);
Check for the error here.
>
> return ret;
> }
> @@ -847,7 +790,7 @@ static int venc_power_v4(struct device *dev, int on)
> if (!legacy_binding)
> return 0;
>
> - ret = vcodec_control_v4(core, VIDC_CORE_ID_2, true);
> + ret = dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_2], false);
> if (ret)
> return ret;
>
> @@ -856,7 +799,7 @@ static int venc_power_v4(struct device *dev, int on)
> else
> vcodec_clks_disable(core, core->vcodec1_clks);
>
> - vcodec_control_v4(core, VIDC_CORE_ID_2, false);
> + dev_pm_genpd_set_hwmode(core->pmdomains->pd_devs[VIDC_CORE_ID_2], true);
Check for the error here.
>
> return ret;
> }
>
> --
> 2.34.1
>
--
With best wishes
Dmitry
Powered by blists - more mailing lists