[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230911-topic-mars-v1-19-a7d38bf87bdb@linaro.org>
Date: Mon, 11 Sep 2023 17:10:33 +0200
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Stanimir Varbanov <stanimir.k.varbanov@...il.com>,
Vikash Garodia <quic_vgarodia@...cinc.com>,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Dikshita Agarwal <quic_dikshita@...cinc.com>,
Philipp Zabel <p.zabel@...gutronix.de>
Cc: Marijn Suijten <marijn.suijten@...ainline.org>,
Stanimir Varbanov <stanimir.varbanov@...aro.org>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Konrad Dybcio <konrad.dybcio@...aro.org>
Subject: [PATCH RFT 19/20] media: venus: pm_helpers: Commonize vdec_get()
This function can be very easily commonized between the supported gens.
Do so!
Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
---
drivers/media/platform/qcom/venus/pm_helpers.c | 21 +--------------------
drivers/media/platform/qcom/venus/pm_helpers.h | 2 +-
drivers/media/platform/qcom/venus/vdec.c | 9 +++++++--
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 6e282a69c7c5..dfb89d2e7387 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -125,7 +125,7 @@ static int core_clks_set_rate(struct venus_core *core, unsigned long freq)
return 0;
}
-static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id)
+int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id)
{
char buf[13] = { 0 }; /* vcodecX_core\0 */
@@ -345,13 +345,6 @@ vcodec_control_v3(struct venus_core *core, u32 session_type, bool enable)
writel(1, ctrl);
}
-static int vdec_get_v3(struct device *dev)
-{
- struct venus_core *core = dev_get_drvdata(dev);
-
- return vcodec_clks_get(core, dev, 0);
-}
-
static int vdec_power_v3(struct device *dev, int on)
{
struct venus_core *core = dev_get_drvdata(dev);
@@ -394,7 +387,6 @@ static int venc_power_v3(struct device *dev, int on)
}
static const struct venus_pm_ops pm_ops_v3 = {
- .vdec_get = vdec_get_v3,
.vdec_power = vdec_power_v3,
.venc_get = venc_get_v3,
.venc_power = venc_power_v3,
@@ -759,16 +751,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on)
return ret;
}
-static int vdec_get_v4(struct device *dev)
-{
- struct venus_core *core = dev_get_drvdata(dev);
-
- if (!legacy_binding)
- return 0;
-
- return vcodec_clks_get(core, dev, 0);
-}
-
static void vdec_put_v4(struct device *dev)
{
struct venus_core *core = dev_get_drvdata(dev);
@@ -1112,7 +1094,6 @@ static int load_scale_v4(struct venus_inst *inst)
}
static const struct venus_pm_ops pm_ops_v4 = {
- .vdec_get = vdec_get_v4,
.vdec_put = vdec_put_v4,
.vdec_power = vdec_power_v4,
.venc_get = venc_get_v4,
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h
index 7a55a55029f3..4afc57dac865 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.h
+++ b/drivers/media/platform/qcom/venus/pm_helpers.h
@@ -10,7 +10,6 @@ struct venus_core;
#define POWER_OFF 0
struct venus_pm_ops {
- int (*vdec_get)(struct device *dev);
void (*vdec_put)(struct device *dev);
int (*vdec_power)(struct device *dev, int on);
@@ -27,6 +26,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version);
int venus_core_power(struct venus_core *core, int on);
void vcodec_domains_put(struct venus_core *core);
int venus_get_resources(struct venus_core *core);
+int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id);
static inline int venus_pm_load_scale(struct venus_inst *inst)
{
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index dbf305cec120..610beba5ca6d 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -1788,8 +1788,13 @@ static int vdec_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, core);
- if (core->pm_ops->vdec_get) {
- ret = core->pm_ops->vdec_get(dev);
+ /*
+ * If the vcodec core clock is missing by now, it either doesn't exist
+ * (8916) or deprecated bindings with pre-assigned core functions and
+ * resources under the decoder node are in use.
+ */
+ if (!core->vcodec_core_clks[0]) {
+ ret = vcodec_clks_get(core, dev, 0);
if (ret)
return ret;
}
--
2.42.0
Powered by blists - more mailing lists