|
@@ -427,6 +427,33 @@ static int scmi_dvfs_freq_get(const struct scmi_handle *handle, u32 domain,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static int scmi_dvfs_est_power_get(const struct scmi_handle *handle, u32 domain,
|
|
|
+ unsigned long *freq, unsigned long *power)
|
|
|
+{
|
|
|
+ struct scmi_perf_info *pi = handle->perf_priv;
|
|
|
+ struct perf_dom_info *dom;
|
|
|
+ unsigned long opp_freq;
|
|
|
+ int idx, ret = -EINVAL;
|
|
|
+ struct scmi_opp *opp;
|
|
|
+
|
|
|
+ dom = pi->dom_info + domain;
|
|
|
+ if (!dom)
|
|
|
+ return -EIO;
|
|
|
+
|
|
|
+ for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) {
|
|
|
+ opp_freq = opp->perf * dom->mult_factor;
|
|
|
+ if (opp_freq < *freq)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ *freq = opp_freq;
|
|
|
+ *power = opp->power;
|
|
|
+ ret = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
static struct scmi_perf_ops perf_ops = {
|
|
|
.limits_set = scmi_perf_limits_set,
|
|
|
.limits_get = scmi_perf_limits_get,
|
|
@@ -437,6 +464,7 @@ static struct scmi_perf_ops perf_ops = {
|
|
|
.device_opps_add = scmi_dvfs_device_opps_add,
|
|
|
.freq_set = scmi_dvfs_freq_set,
|
|
|
.freq_get = scmi_dvfs_freq_get,
|
|
|
+ .est_power_get = scmi_dvfs_est_power_get,
|
|
|
};
|
|
|
|
|
|
static int scmi_perf_protocol_init(struct scmi_handle *handle)
|