]> www.infradead.org Git - users/jedix/linux-maple.git/commit
regulator: Add devres version of of_regulator_get_optional()
authorChen-Yu Tsai <wenst@chromium.org>
Wed, 25 Sep 2024 09:38:05 +0000 (17:38 +0800)
committerMark Brown <broonie@kernel.org>
Sun, 29 Sep 2024 23:11:41 +0000 (01:11 +0200)
commit36ec3f437227470568e5f460997f367f5446a34d
treec3a1b8860072b8a4db54eaff16bfc94089fe475e
parent5441b6975adc26aeaca316b9075e04a98238b1b3
regulator: Add devres version of of_regulator_get_optional()

There are existing uses for a devres version of of_regulator_get_optional()
in power domain drivers. On MediaTek platforms, power domains may have
regulator supplies tied to them. The driver currently tries to use
devm_regulator_get() to not have to manage the lifecycle, but ends up
doing it in a very hacky way by replacing the device node of the power
domain controller device to the device node of the power domain that is
currently being registered, getting the supply, and reverting the device
node.

Provide a better API so that the hack can be replaced.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://patch.msgid.link/20240925093807.1026949-3-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/devres.c
drivers/regulator/internal.h
drivers/regulator/of_regulator.c
include/linux/regulator/consumer.h