diff mbox series

[1/2] firmware: arm_scmi: Add power_scale_mw_get() interface

Message ID 20201124104346.27167-2-lukasz.luba@arm.com
State Accepted
Commit 76ea4d8eeefbfdd37e47c6fd579d0d5852457618
Headers show
Series [1/2] firmware: arm_scmi: Add power_scale_mw_get() interface | expand

Commit Message

Lukasz Luba Nov. 24, 2020, 10:43 a.m. UTC
Add a new interface to the existing perf_ops and export the information
about the power values scale.

This would be used by the cpufreq driver and Energy Model framework to
set the performance domains scale: milli-Watts or abstract scale.

Suggested-by: Morten Rasmussen <morten.rasmussen@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/firmware/arm_scmi/perf.c | 8 ++++++++
 include/linux/scmi_protocol.h    | 1 +
 2 files changed, 9 insertions(+)

Comments

Lukasz Luba Nov. 25, 2020, 9:18 a.m. UTC | #1
On 11/24/20 4:56 PM, Sudeep Holla wrote:
> On Tue, Nov 24, 2020 at 10:43:45AM +0000, Lukasz Luba wrote:

>> Add a new interface to the existing perf_ops and export the information

>> about the power values scale.

>>

>> This would be used by the cpufreq driver and Energy Model framework to

>> set the performance domains scale: milli-Watts or abstract scale.

>>

> 

> Looks good to me. I saw this after I sent pull request this afternoon.

> In case you want to take it via PM tree:

> 

> Acked-by: Sudeep Holla <sudeep.holla@arm.com>

> 


Thank you Sudeep!

Regards,
Lukasz
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 82fb3babff72..e374b1125fca 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -750,6 +750,13 @@  static bool scmi_fast_switch_possible(const struct scmi_handle *handle,
 	return dom->fc_info && dom->fc_info->level_set_addr;
 }
 
+static bool scmi_power_scale_mw_get(const struct scmi_handle *handle)
+{
+	struct scmi_perf_info *pi = handle->perf_priv;
+
+	return pi->power_scale_mw;
+}
+
 static const struct scmi_perf_ops perf_ops = {
 	.limits_set = scmi_perf_limits_set,
 	.limits_get = scmi_perf_limits_get,
@@ -762,6 +769,7 @@  static const struct scmi_perf_ops perf_ops = {
 	.freq_get = scmi_dvfs_freq_get,
 	.est_power_get = scmi_dvfs_est_power_get,
 	.fast_switch_possible = scmi_fast_switch_possible,
+	.power_scale_mw_get = scmi_power_scale_mw_get,
 };
 
 static int scmi_perf_set_notify_enabled(const struct scmi_handle *handle,
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index dd9e94849fc1..ecb3aad1a964 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -122,6 +122,7 @@  struct scmi_perf_ops {
 			     unsigned long *rate, unsigned long *power);
 	bool (*fast_switch_possible)(const struct scmi_handle *handle,
 				     struct device *dev);
+	bool (*power_scale_mw_get)(const struct scmi_handle *handle);
 };
 
 /**