summaryrefslogtreecommitdiff
path: root/drivers/powercap
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2023-05-31 16:20:39 +0100
committerSudeep Holla <sudeep.holla@arm.com>2023-06-06 14:05:10 +0100
commitaaffb4cacd4c5546778a6e3b4bb2deef2dde4bd1 (patch)
tree1151e358d4aec6e091f53bda60ac6ee1780e2ade /drivers/powercap
parent758cd5fc13b20a5874d33b7d381e78408743f587 (diff)
powercap: arm_scmi: Add support for disabling powercaps on a zone
Add support to disable/enable powercapping on a zone. Acked-by: Rafael J. Wysocki <rafael@kernel.org> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20230531152039.2363181-4-cristian.marussi@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/powercap')
-rw-r--r--drivers/powercap/arm_scmi_powercap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c
index 05d0e516176a..5231f6d52ae3 100644
--- a/drivers/powercap/arm_scmi_powercap.c
+++ b/drivers/powercap/arm_scmi_powercap.c
@@ -70,10 +70,26 @@ static int scmi_powercap_get_power_uw(struct powercap_zone *pz,
return 0;
}
+static int scmi_powercap_zone_enable_set(struct powercap_zone *pz, bool mode)
+{
+ struct scmi_powercap_zone *spz = to_scmi_powercap_zone(pz);
+
+ return powercap_ops->cap_enable_set(spz->ph, spz->info->id, mode);
+}
+
+static int scmi_powercap_zone_enable_get(struct powercap_zone *pz, bool *mode)
+{
+ struct scmi_powercap_zone *spz = to_scmi_powercap_zone(pz);
+
+ return powercap_ops->cap_enable_get(spz->ph, spz->info->id, mode);
+}
+
static const struct powercap_zone_ops zone_ops = {
.get_max_power_range_uw = scmi_powercap_get_max_power_range_uw,
.get_power_uw = scmi_powercap_get_power_uw,
.release = scmi_powercap_zone_release,
+ .set_enable = scmi_powercap_zone_enable_set,
+ .get_enable = scmi_powercap_zone_enable_get,
};
static void scmi_powercap_normalize_cap(const struct scmi_powercap_zone *spz,