Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15a7e9b3 authored by David Collins's avatar David Collins
Browse files

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: default avatarDavid Collins <collinsd@codeaurora.org>
parent 9484c331
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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,
};