[PATCH 03/16] firmware: arm_scmi: Extend perf protocol ops to inform of set level support

Ulf Hansson ulf.hansson at linaro.org
Wed Jun 7 05:46:15 PDT 2023


As a subsequent change show, it's useful for an scmi module driver to know
if a performance domain can support the set level operation, hence let's
make this available by adding a new perf protocol callback.

Signed-off-by: Ulf Hansson <ulf.hansson at linaro.org>
---
 drivers/firmware/arm_scmi/perf.c | 10 ++++++++++
 include/linux/scmi_protocol.h    |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 5a6ed42bfb55..216bcd68d549 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -440,6 +440,15 @@ static int scmi_perf_limits_get(const struct scmi_protocol_handle *ph,
 	return scmi_perf_mb_limits_get(ph, domain, max_perf, min_perf);
 }
 
+static bool
+scmi_perf_can_level_set(const struct scmi_protocol_handle *ph, u32 domain)
+{
+	struct scmi_perf_info *pi = ph->get_priv(ph);
+	struct perf_dom_info *dom = pi->dom_info + domain;
+
+	return dom->set_perf;
+}
+
 static int scmi_perf_mb_level_set(const struct scmi_protocol_handle *ph,
 				  u32 domain, u32 level, bool poll)
 {
@@ -707,6 +716,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = {
 	.name_get = scmi_perf_name_get,
 	.limits_set = scmi_perf_limits_set,
 	.limits_get = scmi_perf_limits_get,
+	.can_level_set = scmi_perf_can_level_set,
 	.level_set = scmi_perf_level_set,
 	.level_get = scmi_perf_level_get,
 	.device_domain_id = scmi_dev_domain_id,
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 07152a0baee3..99c3e985c40f 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -129,6 +129,7 @@ struct scmi_perf_proto_ops {
 			  u32 max_perf, u32 min_perf);
 	int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain,
 			  u32 *max_perf, u32 *min_perf);
+	bool (*can_level_set)(const struct scmi_protocol_handle *ph, u32 domain);
 	int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain,
 			 u32 level, bool poll);
 	int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain,
-- 
2.34.1




More information about the linux-arm-kernel mailing list