summaryrefslogtreecommitdiffstats
path: root/drivers/powercap
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2021-03-18 21:52:38 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2021-10-21 16:03:31 +0200
commit5d8cb8db9f791252ef5b7951b6d8cc6281de60a6 (patch)
treeb277d5b7fa9ae1c28fde6708666ea7113ed9a930 /drivers/powercap
parenteb82bace893169b319c563b7f813c58a0a5a9f76 (diff)
downloadlinux-5d8cb8db9f791252ef5b7951b6d8cc6281de60a6.tar.gz
linux-5d8cb8db9f791252ef5b7951b6d8cc6281de60a6.tar.bz2
linux-5d8cb8db9f791252ef5b7951b6d8cc6281de60a6.zip
powercap/drivers/dtpm: Fix power limit initialization
When a DTPM node is registered its power limit must be initialized to the power max. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20210318205238.21937-1-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/powercap')
-rw-r--r--drivers/powercap/dtpm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index c7c5529b61eb..b9fac786246a 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -448,8 +448,10 @@ int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent)
root = dtpm;
}
- if (dtpm->ops && !dtpm->ops->update_power_uw(dtpm))
+ if (dtpm->ops && !dtpm->ops->update_power_uw(dtpm)) {
__dtpm_add_power(dtpm);
+ dtpm->power_limit = dtpm->power_max;
+ }
pr_info("Registered dtpm node '%s' / %llu-%llu uW, \n",
dtpm->zone.name, dtpm->power_min, dtpm->power_max);