Skip to content

Commit feb10ab

Browse files
lumaggregkh
authored andcommitted
media: venus: scale MMCX power domain on SM8250
[ Upstream commit f45fd3d ] On SM8250 most of the video clocks are powered by the MMCX domain, while the PLL is powered on by the MX domain. Extend the driver to support scaling both power domains, while keeping compatibility with the existing DTs, which define only the MX domain. Fixes: 0aeabfa ("media: venus: core: add sm8250 DT compatible and resource data") Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9e64272 commit feb10ab

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

drivers/media/platform/qcom/venus/core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ static const struct venus_resources sdm845_res_v2 = {
882882
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" },
883883
.vcodec_pmdomains_num = 3,
884884
.opp_pmdomain = (const char *[]) { "cx" },
885+
.opp_pmdomain_num = 1,
885886
.vcodec_num = 2,
886887
.max_load = 3110400, /* 4096x2160@90 */
887888
.hfi_version = HFI_VERSION_4XX,
@@ -933,6 +934,7 @@ static const struct venus_resources sc7180_res = {
933934
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
934935
.vcodec_pmdomains_num = 2,
935936
.opp_pmdomain = (const char *[]) { "cx" },
937+
.opp_pmdomain_num = 1,
936938
.vcodec_num = 1,
937939
.hfi_version = HFI_VERSION_4XX,
938940
.vpu_version = VPU_VERSION_AR50,
@@ -991,7 +993,8 @@ static const struct venus_resources sm8250_res = {
991993
.vcodec_clks_num = 1,
992994
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
993995
.vcodec_pmdomains_num = 2,
994-
.opp_pmdomain = (const char *[]) { "mx" },
996+
.opp_pmdomain = (const char *[]) { "mx", "mmcx" },
997+
.opp_pmdomain_num = 2,
995998
.vcodec_num = 1,
996999
.max_load = 7833600,
9971000
.hfi_version = HFI_VERSION_6XX,
@@ -1053,6 +1056,7 @@ static const struct venus_resources sc7280_res = {
10531056
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
10541057
.vcodec_pmdomains_num = 2,
10551058
.opp_pmdomain = (const char *[]) { "cx" },
1059+
.opp_pmdomain_num = 1,
10561060
.vcodec_num = 1,
10571061
.hfi_version = HFI_VERSION_6XX,
10581062
.vpu_version = VPU_VERSION_IRIS2_1,
@@ -1100,6 +1104,7 @@ static const struct venus_resources qcm2290_res = {
11001104
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
11011105
.vcodec_pmdomains_num = 2,
11021106
.opp_pmdomain = (const char *[]) { "cx" },
1107+
.opp_pmdomain_num = 1,
11031108
.vcodec_num = 1,
11041109
.hfi_version = HFI_VERSION_4XX,
11051110
.vpu_version = VPU_VERSION_AR50_LITE,

drivers/media/platform/qcom/venus/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct venus_resources {
8383
const char **vcodec_pmdomains;
8484
unsigned int vcodec_pmdomains_num;
8585
const char **opp_pmdomain;
86+
unsigned int opp_pmdomain_num;
8687
unsigned int vcodec_num;
8788
const char * const resets[VIDC_RESETS_NUM_MAX];
8889
unsigned int resets_num;

drivers/media/platform/qcom/venus/pm_helpers.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core)
887887
};
888888
struct dev_pm_domain_attach_data opp_pd_data = {
889889
.pd_names = res->opp_pmdomain,
890-
.num_pd_names = 1,
890+
.num_pd_names = res->opp_pmdomain_num,
891891
.pd_flags = PD_FLAG_DEV_LINK_ON | PD_FLAG_REQUIRED_OPP,
892892
};
893893

@@ -904,6 +904,12 @@ static int vcodec_domains_get(struct venus_core *core)
904904

905905
/* Attach the power domain for setting performance state */
906906
ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
907+
/* backwards compatibility for incomplete ABI SM8250 */
908+
if (ret == -ENODEV &&
909+
of_device_is_compatible(dev->of_node, "qcom,sm8250-venus")) {
910+
opp_pd_data.num_pd_names--;
911+
ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
912+
}
907913
if (ret < 0)
908914
return ret;
909915

0 commit comments

Comments
 (0)