Commit 1909872f authored by Nicola Mazzucato's avatar Nicola Mazzucato Committed by Sudeep Holla

firmware: arm_scmi: Add fast_switch_possible() interface

Add a new fast_switch_possible interface to the existing perf_ops to
export the information of whether or not fast_switch is possible for a
given device.

This can be used by the cpufreq driver and framework to choose proper
mechanism for frequency change.

Link: https://lore.kernel.org/r/20200617094332.8391-1-nicola.mazzucato@arm.comSuggested-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Signed-off-by: default avatarNicola Mazzucato <nicola.mazzucato@arm.com>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent bad0d73b
...@@ -697,6 +697,17 @@ static int scmi_dvfs_est_power_get(const struct scmi_handle *handle, u32 domain, ...@@ -697,6 +697,17 @@ static int scmi_dvfs_est_power_get(const struct scmi_handle *handle, u32 domain,
return ret; return ret;
} }
static bool scmi_fast_switch_possible(const struct scmi_handle *handle,
struct device *dev)
{
struct perf_dom_info *dom;
struct scmi_perf_info *pi = handle->perf_priv;
dom = pi->dom_info + scmi_dev_domain_id(dev);
return dom->fc_info && dom->fc_info->level_set_addr;
}
static struct scmi_perf_ops perf_ops = { static struct scmi_perf_ops perf_ops = {
.limits_set = scmi_perf_limits_set, .limits_set = scmi_perf_limits_set,
.limits_get = scmi_perf_limits_get, .limits_get = scmi_perf_limits_get,
...@@ -708,6 +719,7 @@ static struct scmi_perf_ops perf_ops = { ...@@ -708,6 +719,7 @@ static struct scmi_perf_ops perf_ops = {
.freq_set = scmi_dvfs_freq_set, .freq_set = scmi_dvfs_freq_set,
.freq_get = scmi_dvfs_freq_get, .freq_get = scmi_dvfs_freq_get,
.est_power_get = scmi_dvfs_est_power_get, .est_power_get = scmi_dvfs_est_power_get,
.fast_switch_possible = scmi_fast_switch_possible,
}; };
static int scmi_perf_protocol_init(struct scmi_handle *handle) static int scmi_perf_protocol_init(struct scmi_handle *handle)
......
...@@ -118,6 +118,8 @@ struct scmi_perf_ops { ...@@ -118,6 +118,8 @@ struct scmi_perf_ops {
unsigned long *rate, bool poll); unsigned long *rate, bool poll);
int (*est_power_get)(const struct scmi_handle *handle, u32 domain, int (*est_power_get)(const struct scmi_handle *handle, u32 domain,
unsigned long *rate, unsigned long *power); unsigned long *rate, unsigned long *power);
bool (*fast_switch_possible)(const struct scmi_handle *handle,
struct device *dev);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment