[O][PATCH 13/21] UBUNTU: SAUCE: media: platform: venus: Add optional LLCC path
Juerg Haefliger
juerg.haefliger at canonical.com
Tue Sep 3 08:40:02 UTC 2024
From: Konrad Dybcio <konrad.dybcio at linaro.org>
Some newer SoCs (such as SM8350) have a third interconnect path. Add
it and make it optional.
Signed-off-by: Konrad Dybcio <konrad.dybcio at linaro.org>
Link: https://lore.kernel.org/r/20230731-topic-8280_venus-v1-4-8c8bbe1983a5@linaro.org
Signed-off-by: Johan Hovold <johan+linaro at kernel.org>
(cherry picked from commit 9d5b86b703b1b8c7ff1d1496fe4be450cc1696b9 github.com/jhovold/linux)
Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
drivers/media/platform/qcom/venus/core.c | 19 +++++++++++++++++++
drivers/media/platform/qcom/venus/core.h | 3 +++
.../media/platform/qcom/venus/pm_helpers.c | 3 +++
3 files changed, 25 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index edd35e652c92..ff2b5468f85a 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -309,6 +309,15 @@ static int venus_probe(struct platform_device *pdev)
if (IS_ERR(core->cpucfg_path))
return PTR_ERR(core->cpucfg_path);
+ core->llcc_path = devm_of_icc_get(dev, "video-llcc");
+ if (IS_ERR(core->llcc_path)) {
+ /* LLCC path is optional */
+ if (PTR_ERR(core->llcc_path) == -ENODATA)
+ core->llcc_path = NULL;
+ else
+ return PTR_ERR(core->llcc_path);
+ }
+
core->irq = platform_get_irq(pdev, 0);
if (core->irq < 0)
return core->irq;
@@ -486,12 +495,18 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev)
if (ret)
goto err_cpucfg_path;
+ ret = icc_set_bw(core->llcc_path, 0, 0);
+ if (ret)
+ goto err_llcc_path;
+
ret = icc_set_bw(core->video_path, 0, 0);
if (ret)
goto err_video_path;
return ret;
+err_llcc_path:
+ icc_set_bw(core->video_path, kbps_to_icc(20000), 0);
err_video_path:
icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0);
err_cpucfg_path:
@@ -511,6 +526,10 @@ static __maybe_unused int venus_runtime_resume(struct device *dev)
if (ret)
return ret;
+ ret = icc_set_bw(core->llcc_path, kbps_to_icc(20000), 0);
+ if (ret)
+ return ret;
+
ret = icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0);
if (ret)
return ret;
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index b4e60243e0ae..90a06c283cc8 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -64,6 +64,7 @@ struct venus_resources {
unsigned int bw_tbl_enc_size;
const struct bw_tbl *bw_tbl_dec;
unsigned int bw_tbl_dec_size;
+ bool has_llcc_path;
const struct reg_val *reg_tbl;
unsigned int reg_tbl_size;
const struct hfi_ubwc_config *ubwc_conf;
@@ -133,6 +134,7 @@ struct venus_format {
* @vcodec1_clks: an array of vcodec1 struct clk pointers
* @video_path: an interconnect handle to video to/from memory path
* @cpucfg_path: an interconnect handle to cpu configuration path
+ * @llcc_path: an interconnect handle to video to/from llcc path
* @has_opp_table: does OPP table exist
* @pmdomains: a pointer to a list of pmdomains
* @opp_dl_venus: an device-link for device OPP
@@ -187,6 +189,7 @@ struct venus_core {
struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX];
struct icc_path *video_path;
struct icc_path *cpucfg_path;
+ struct icc_path *llcc_path;
bool has_opp_table;
struct dev_pm_domain_list *pmdomains;
struct device_link *opp_dl_venus;
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 4ce76ce6dd4d..9c5852d3fb92 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -237,6 +237,9 @@ static int load_scale_bw(struct venus_core *core)
dev_dbg(core->dev, VDBGL "total: avg_bw: %u, peak_bw: %u\n",
total_avg, total_peak);
+ if (core->res->has_llcc_path)
+ icc_set_bw(core->llcc_path, total_avg, total_peak);
+
return icc_set_bw(core->video_path, total_avg, total_peak);
}
--
2.43.0
More information about the kernel-team
mailing list