regulator: rpmh-regulator: add support for proxy consumers

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

Change-Id: Ic5f4ef7369584433b0a187f966d2d5f379b98cb6
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2019-11-15 17:20:05 -08:00 committed by David Collins
parent 99e2c4f4ee
commit 01da202c31

View File

@ -15,6 +15,7 @@
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/proxy-consumer.h>
#include <soc/qcom/cmd-db.h>
#include <soc/qcom/rpmh.h>
@ -1805,12 +1806,17 @@ static int rpmh_regulator_init_vreg(struct rpmh_vreg *vreg)
return rc;
}
rc = devm_regulator_proxy_consumer_register(dev, vreg->of_node);
if (rc)
vreg_err(vreg, "failed to register proxy consumer, rc=%d\n",
rc);
vreg_debug(vreg, "successfully registered; set=%s\n",
vreg->set_active && vreg->set_sleep
? "active + sleep"
: vreg->set_active ? "active" : "sleep");
return rc;
return 0;
}
static const struct of_device_id rpmh_regulator_match_table[] = {
@ -1972,6 +1978,7 @@ static struct platform_driver rpmh_regulator_driver = {
.driver = {
.name = "qcom,rpmh-regulator",
.of_match_table = rpmh_regulator_match_table,
.sync_state = regulator_proxy_consumer_sync_state,
},
.probe = rpmh_regulator_probe,
};