UPSTREAM: firmware: arm_scmi: Specify the performance level when adding an OPP

To enable the performance level to be used for OPPs, let's convert into
using the dev_pm_opp_add_dynamic() API when creating them. This will be
particularly useful for the SCMI performance domain, as shown through
subsequent changes.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20230925131715.138411-9-ulf.hansson@linaro.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Bug: 323966425
Change-Id: I0d831c1e923d64e3e88e42acf4f4f16587c21696
(cherry picked from commit 5a6a104193520dc3b66ad2c7d823e00b50734ab6)
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
Signed-off-by: Anant Goel <quic_anantg@quicinc.com>
This commit is contained in:
Ulf Hansson
2023-09-25 15:17:14 +02:00
committed by Anant Goel
parent 47933171f3
commit c33dbb3b87

View File

@@ -603,6 +603,7 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
{
int idx, ret;
unsigned long freq;
struct dev_pm_opp_data data = {};
struct perf_dom_info *dom;
dom = scmi_perf_domain_lookup(ph, domain);
@@ -612,7 +613,10 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
for (idx = 0; idx < dom->opp_count; idx++) {
freq = dom->opp[idx].perf * dom->mult_factor;
ret = dev_pm_opp_add(dev, freq, 0);
data.level = dom->opp[idx].perf;
data.freq = freq;
ret = dev_pm_opp_add_dynamic(dev, &data);
if (ret) {
dev_warn(dev, "failed to add opp %luHz\n", freq);
dev_pm_opp_remove_all_dynamic(dev);