On SM8250 most of the video clocks are powered by the MMCX domain, while
the PLL it powered on by the MX domain. Extend the driver to support
scaling both power domains, while keeping compatibitility with the
existing DTs, which define only the MX domain.
Fixes: 0aeabfa29a9c ("media: venus: core: add sm8250 DT compatible and resource data")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/media/platform/qcom/venus/core.c | 7 ++++++-
drivers/media/platform/qcom/venus/core.h | 1 +
drivers/media/platform/qcom/venus/pm_helpers.c | 8 +++++++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 646dae3407b4..cad2df84ce60 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -882,6 +882,7 @@ static const struct venus_resources sdm845_res_v2 = {
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" },
.vcodec_pmdomains_num = 3,
.opp_pmdomain = (const char *[]) { "cx" },
+ .opp_pmdomain_num = 1,
.vcodec_num = 2,
.max_load = 3110400, /* 4096x2160@90 */
.hfi_version = HFI_VERSION_4XX,
@@ -933,6 +934,7 @@ static const struct venus_resources sc7180_res = {
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
.vcodec_pmdomains_num = 2,
.opp_pmdomain = (const char *[]) { "cx" },
+ .opp_pmdomain_num = 1,
.vcodec_num = 1,
.hfi_version = HFI_VERSION_4XX,
.vpu_version = VPU_VERSION_AR50,
@@ -992,7 +994,8 @@ static const struct venus_resources sm8250_res = {
.vcodec_clks_num = 1,
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
.vcodec_pmdomains_num = 2,
- .opp_pmdomain = (const char *[]) { "mx" },
+ .opp_pmdomain = (const char *[]) { "mx", "mmcx" },
+ .opp_pmdomain_num = 2,
.vcodec_num = 1,
.max_load = 7833600,
.hfi_version = HFI_VERSION_6XX,
@@ -1054,6 +1057,7 @@ static const struct venus_resources sc7280_res = {
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
.vcodec_pmdomains_num = 2,
.opp_pmdomain = (const char *[]) { "cx" },
+ .opp_pmdomain_num = 1,
.vcodec_num = 1,
.hfi_version = HFI_VERSION_6XX,
.vpu_version = VPU_VERSION_IRIS2_1,
@@ -1102,6 +1106,7 @@ static const struct venus_resources qcm2290_res = {
.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
.vcodec_pmdomains_num = 2,
.opp_pmdomain = (const char *[]) { "cx" },
+ .opp_pmdomain_num = 1,
.vcodec_num = 1,
.hfi_version = HFI_VERSION_4XX,
.vpu_version = VPU_VERSION_AR50_LITE,
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index c7acacaa53b8..62ab747291b8 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -85,6 +85,7 @@ struct venus_resources {
const char **vcodec_pmdomains;
unsigned int vcodec_pmdomains_num;
const char **opp_pmdomain;
+ unsigned int opp_pmdomain_num;
unsigned int vcodec_num;
const char * const resets[VIDC_RESETS_NUM_MAX];
unsigned int resets_num;
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index f0269524ac70..14a4e8311a64 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -887,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core)
};
struct dev_pm_domain_attach_data opp_pd_data = {
.pd_names = res->opp_pmdomain,
- .num_pd_names = 1,
+ .num_pd_names = res->opp_pmdomain_num,
.pd_flags = PD_FLAG_DEV_LINK_ON | PD_FLAG_REQUIRED_OPP,
};
@@ -904,6 +904,12 @@ static int vcodec_domains_get(struct venus_core *core)
/* Attach the power domain for setting performance state */
ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
+ /* backwards compatibility for incomplete ABI SM8250 */
+ if (ret == -ENODEV &&
+ of_device_is_compatible(dev->of_node, "qcom,sm8250-venus")) {
+ opp_pd_data.num_pd_names--;
+ ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
+ }
if (ret < 0)
return ret;
--
2.47.3
On 01/02/2026 10:49, Dmitry Baryshkov wrote:
> On SM8250 most of the video clocks are powered by the MMCX domain, while
> the PLL it powered on by the MX domain. Extend the driver to support
> scaling both power domains, while keeping compatibitility with the
> existing DTs, which define only the MX domain.
>
> Fixes: 0aeabfa29a9c ("media: venus: core: add sm8250 DT compatible and resource data")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/media/platform/qcom/venus/core.c | 7 ++++++-
> drivers/media/platform/qcom/venus/core.h | 1 +
> drivers/media/platform/qcom/venus/pm_helpers.c | 8 +++++++-
> 3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 646dae3407b4..cad2df84ce60 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -882,6 +882,7 @@ static const struct venus_resources sdm845_res_v2 = {
> .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" },
> .vcodec_pmdomains_num = 3,
> .opp_pmdomain = (const char *[]) { "cx" },
> + .opp_pmdomain_num = 1,
> .vcodec_num = 2,
> .max_load = 3110400, /* 4096x2160@90 */
> .hfi_version = HFI_VERSION_4XX,
> @@ -933,6 +934,7 @@ static const struct venus_resources sc7180_res = {
> .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
> .vcodec_pmdomains_num = 2,
> .opp_pmdomain = (const char *[]) { "cx" },
> + .opp_pmdomain_num = 1,
> .vcodec_num = 1,
> .hfi_version = HFI_VERSION_4XX,
> .vpu_version = VPU_VERSION_AR50,
> @@ -992,7 +994,8 @@ static const struct venus_resources sm8250_res = {
> .vcodec_clks_num = 1,
> .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
> .vcodec_pmdomains_num = 2,
> - .opp_pmdomain = (const char *[]) { "mx" },
> + .opp_pmdomain = (const char *[]) { "mx", "mmcx" },
> + .opp_pmdomain_num = 2,
> .vcodec_num = 1,
> .max_load = 7833600,
> .hfi_version = HFI_VERSION_6XX,
> @@ -1054,6 +1057,7 @@ static const struct venus_resources sc7280_res = {
> .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
> .vcodec_pmdomains_num = 2,
> .opp_pmdomain = (const char *[]) { "cx" },
> + .opp_pmdomain_num = 1,
> .vcodec_num = 1,
> .hfi_version = HFI_VERSION_6XX,
> .vpu_version = VPU_VERSION_IRIS2_1,
> @@ -1102,6 +1106,7 @@ static const struct venus_resources qcm2290_res = {
> .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
> .vcodec_pmdomains_num = 2,
> .opp_pmdomain = (const char *[]) { "cx" },
> + .opp_pmdomain_num = 1,
> .vcodec_num = 1,
> .hfi_version = HFI_VERSION_4XX,
> .vpu_version = VPU_VERSION_AR50_LITE,
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index c7acacaa53b8..62ab747291b8 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -85,6 +85,7 @@ struct venus_resources {
> const char **vcodec_pmdomains;
> unsigned int vcodec_pmdomains_num;
> const char **opp_pmdomain;
> + unsigned int opp_pmdomain_num;
> unsigned int vcodec_num;
> const char * const resets[VIDC_RESETS_NUM_MAX];
> unsigned int resets_num;
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index f0269524ac70..14a4e8311a64 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -887,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core)
> };
> struct dev_pm_domain_attach_data opp_pd_data = {
> .pd_names = res->opp_pmdomain,
> - .num_pd_names = 1,
> + .num_pd_names = res->opp_pmdomain_num,
> .pd_flags = PD_FLAG_DEV_LINK_ON | PD_FLAG_REQUIRED_OPP,
> };
>
> @@ -904,6 +904,12 @@ static int vcodec_domains_get(struct venus_core *core)
>
> /* Attach the power domain for setting performance state */
> ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
> + /* backwards compatibility for incomplete ABI SM8250 */
> + if (ret == -ENODEV &&
> + of_device_is_compatible(dev->of_node, "qcom,sm8250-venus")) {
> + opp_pd_data.num_pd_names--;
Setting this to "1" would be a bit clearer IMO - there's no use-case for
num_pd_names = 3; num_pd_names--; for example.
Its stylistic rather than functional so entirely up to you to keep or
change.
> + ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
> + }
> if (ret < 0)
> return ret;
>
>
> --
> 2.47.3
>
>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
On 2/1/26 11:49 AM, Dmitry Baryshkov wrote:
> On SM8250 most of the video clocks are powered by the MMCX domain, while
> the PLL it powered on by the MX domain. Extend the driver to support
> scaling both power domains, while keeping compatibitility with the
> existing DTs, which define only the MX domain.
>
> Fixes: 0aeabfa29a9c ("media: venus: core: add sm8250 DT compatible and resource data")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
[...]
> @@ -904,6 +904,12 @@ static int vcodec_domains_get(struct venus_core *core)
>
> /* Attach the power domain for setting performance state */
> ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
> + /* backwards compatibility for incomplete ABI SM8250 */
"eeeh", I'd rather error out since it can't guarantee to have its
power fully on
Konrad
> + if (ret == -ENODEV &&
> + of_device_is_compatible(dev->of_node, "qcom,sm8250-venus")) {
> + opp_pd_data.num_pd_names--;
> + ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
> + }
> if (ret < 0)
> return ret;
>
>
On 02/02/2026 12:02, Konrad Dybcio wrote:
> On 2/1/26 11:49 AM, Dmitry Baryshkov wrote:
>> On SM8250 most of the video clocks are powered by the MMCX domain, while
>> the PLL it powered on by the MX domain. Extend the driver to support
>> scaling both power domains, while keeping compatibitility with the
>> existing DTs, which define only the MX domain.
>>
>> Fixes: 0aeabfa29a9c ("media: venus: core: add sm8250 DT compatible and resource data")
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> ---
>
> [...]
>
>> @@ -904,6 +904,12 @@ static int vcodec_domains_get(struct venus_core *core)
>>
>> /* Attach the power domain for setting performance state */
>> ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
>> + /* backwards compatibility for incomplete ABI SM8250 */
>
> "eeeh", I'd rather error out since it can't guarantee to have its
> power fully on
That would break backwards compatibility, so... it's not possible.
>
> Konrad
>
>> + if (ret == -ENODEV &&
>> + of_device_is_compatible(dev->of_node, "qcom,sm8250-venus")) {
>> + opp_pd_data.num_pd_names--;
>> + ret = devm_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain);
>> + }
>> if (ret < 0)
>> return ret;
>>
>>
--
With best wishes
Dmitry
© 2016 - 2026 Red Hat, Inc.