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

Commit b3520153 authored by David Collins's avatar David Collins
Browse files

regulator: refgen: add support for proxy consumers



Add support to enforce proxy consumer requests defined in device
tree for refgen 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: I57ce2ac4162c29e749e1cd915241593d4ad262dc
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent 3a4e5978
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2017, 2019-2020, The Linux Foundation. All rights reserved. */

#include <linux/bitops.h>
#include <linux/err.h>
@@ -14,6 +14,7 @@
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/proxy-consumer.h>

#define REFGEN_REG_BIAS_EN		0x08
#define REFGEN_BIAS_EN_MASK		GENMASK(2, 0)
@@ -204,6 +205,10 @@ static int refgen_probe(struct platform_device *pdev)
		return rc;
	}

	rc = devm_regulator_proxy_consumer_register(dev, dev->of_node);
	if (rc)
		dev_err(dev, "failed to register proxy consumer, rc=%d\n", rc);

	return 0;
}

@@ -212,6 +217,7 @@ static struct platform_driver refgen_driver = {
	.driver = {
		.name = "qcom,refgen-regulator",
		.of_match_table = refgen_match_table,
		.sync_state = regulator_proxy_consumer_sync_state,
	},
};