regulator: fixed: add support for proxy consumers

Add support to enforce proxy consumer requests defined in device
tree for fixed regulator devices.  These can be used to ensure
that regulators are not accidentally disabled before all consumers
have had a chance to make their own requests.

Change-Id: Ib971aae138897ded6cb4efd9a7eddc17d9a07f7f
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2019-11-22 16:10:42 -08:00
commit 807599650d

View file

@ -25,6 +25,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/proxy-consumer.h>
#include <linux/regulator/machine.h>
#include <linux/clk.h>
@ -249,6 +250,11 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
return ret;
}
ret = devm_regulator_proxy_consumer_register(dev, dev->of_node);
if (ret)
dev_err(dev, "failed to register proxy consumer, ret=%d\n",
ret);
platform_set_drvdata(pdev, drvdata);
dev_dbg(&pdev->dev, "%s supplying %duV\n", drvdata->desc.name,
@ -278,6 +284,7 @@ static struct platform_driver regulator_fixed_voltage_driver = {
.driver = {
.name = "reg-fixed-voltage",
.of_match_table = of_match_ptr(fixed_of_match),
.sync_state = regulator_proxy_consumer_sync_state,
},
};