]> git.dujemihanovic.xyz Git - u-boot.git/commit
regulator: implement basic reference counter
authorEugen Hristev <eugen.hristev@collabora.com>
Wed, 19 Apr 2023 13:45:24 +0000 (16:45 +0300)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 4 Jul 2023 02:20:56 +0000 (11:20 +0900)
commit4fcba5d556b4224ad65a249801e4c9594d1054e8
tree125ce902241179e38ac7a0a7a26b758df4c35a19
parent67d8b46e6efa306403e45f4c76f24b86a5e63b75
regulator: implement basic reference counter

Some devices share a regulator supply, when the first one will request
regulator disable, the second device will have it's supply cut off before
graciously shutting down. Hence there will be timeouts and other failed
operations.
Implement a reference counter mechanism similar with what is done in
Linux, to keep track of enable and disable requests, and only disable the
regulator when the last of the consumers has requested shutdown.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
drivers/power/regulator/regulator_common.c
drivers/power/regulator/regulator_common.h