From: Renjiang Han <quic_renjiang@quicinc.com>
To: Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
Vikash Garodia <quic_vgarodia@quicinc.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-clk@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
Renjiang Han <quic_renjiang@quicinc.com>
Subject: [PATCH v3 3/3] venus: pm_helpers: Remove dead code and simplify power management
Date: Wed, 15 Jan 2025 15:00:54 +0530 [thread overview]
Message-ID: <20250115-switch_gdsc_mode-v3-3-9a24d2fd724c@quicinc.com> (raw)
In-Reply-To: <20250115-switch_gdsc_mode-v3-0-9a24d2fd724c@quicinc.com>
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@quicinc.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);
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);
return ret;
}
--
2.34.1
next prev parent reply other threads:[~2025-01-15 9:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 9:30 [PATCH v3 0/3] Use APIs in gdsc genpd to switch gdsc mode for venus v4 core Renjiang Han
2025-01-15 9:30 ` [PATCH v3 1/3] clk: qcom: videocc: Use HW_CTRL_TRIGGER flag for video GDSC's Renjiang Han
2025-01-15 9:30 ` [PATCH v3 2/3] venus: pm_helpers: Use dev_pm_genpd_set_hwmode to switch GDSC mode on V4 Renjiang Han
2025-01-15 12:02 ` Bryan O'Donoghue
2025-01-15 20:22 ` Bjorn Andersson
2025-01-15 20:36 ` Bjorn Andersson
2025-01-17 4:19 ` Renjiang Han
2025-01-15 9:30 ` Renjiang Han [this message]
2025-01-15 10:01 ` [PATCH v3 3/3] venus: pm_helpers: Remove dead code and simplify power management Dmitry Baryshkov
2025-01-17 4:01 ` Renjiang Han
2025-01-15 9:59 ` [PATCH v3 0/3] Use APIs in gdsc genpd to switch gdsc mode for venus v4 core Dmitry Baryshkov
2025-01-17 4:17 ` Renjiang Han
2025-02-17 10:15 ` Renjiang Han
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=20250115-switch_gdsc_mode-v3-3-9a24d2fd724c@quicinc.com \
--to=quic_renjiang@quicinc.com \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mturquette@baylibre.com \
--cc=quic_vgarodia@quicinc.com \
--cc=sboyd@kernel.org \
--cc=stanimir.k.varbanov@gmail.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
all inboxes | Powered by JetHome®