diff options
author | Jonas Karlman | 2023-08-21 22:30:24 +0000 |
---|---|---|
committer | Kever Yang | 2023-10-07 16:49:41 +0800 |
commit | d99fb64a98af3bebf6b0c134291c4fb89e177aa2 (patch) | |
tree | ca0af2bac0df1e72fb3d2ead9152aa7d5ee47223 /include/power | |
parent | a9e9445ea2bb010444621e563a79bc33fe064f9c (diff) |
power: regulator: Only run autoset once for each regulator
With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter"), keeping regulator enablement in balance become more important.
Calling regulator_autoset multiple times on a fixed regulator increase
the enable count for each call, resulting in an unbalanced enable count.
Introduce a AUTOSET_DONE flag and use it to mark that autoset has run
for the regulator. Return -EALREADY on any subsequent call to autoset.
This fixes so that the enable count is only ever increased by one per
regulator for autoset.
Fixes: 4fcba5d556b4 ("regulator: implement basic reference counter")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'include/power')
-rw-r--r-- | include/power/regulator.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/power/regulator.h b/include/power/regulator.h index ff1bfc2435a..200652cb3d7 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -134,6 +134,7 @@ struct dm_regulator_mode { enum regulator_flag { REGULATOR_FLAG_AUTOSET_UV = 1 << 0, REGULATOR_FLAG_AUTOSET_UA = 1 << 1, + REGULATOR_FLAG_AUTOSET_DONE = 1 << 2, }; /** |