On 17. 11. 21 08:21, Sascha Hauer wrote:
On Mon, Nov 15, 2021 at 02:02:06PM +0100, Andrej Picej wrote:
It is quite common for users to delete power supply nodes of regulators
which aren't yet supported.
The idea of a function call or devicetree property which allows use of
dummy regulator is not new. This implementation uses barebox specific
devicetree property "barebox,allow-dummy-supply" to allow switching to
dummy power regulator.
Basically just catch the regulators ensure_probed error, if this
property is set.
Signed-off-by: Andrej Picej <andrej.picej@xxxxxxxxx>
---
drivers/regulator/core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 097f7d779..1c58932e1 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -231,8 +231,15 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
}
ret = of_device_ensure_probed(node);
- if (ret)
+ if (ret) {
+ if (of_get_property(dev->device_node, "barebox,allow-dummy-supply", NULL)) {
+ dev_dbg(dev, "Allow use of dummy regulator for " \
+ "%s-supply\n", supply);
+ ri = NULL;
+ goto out;
+ }
return ERR_PTR(ret);
I wonder if we should rather add a property on the producer side than on
the consumer side, i.e. Add a barebox,status = "disabled" property to
the regulator node. We had the same discussion with phys recently, maybe
we can use the same approach for both issues.
I was wandering that too. But decided to go with consumer side so users
which might want to use this have to enable this for every consumers
which can use dummy regulators. IMO this would mean more thought would
go into this and would be consequently more error prone.
So for producer side did you have in mind that this setting will be set
for every regulator, like this?
regulators {
vddcore_reg: bcore1 {
+ barebox,allow-dummy-supply;
regulator-min-microvolt = <730000>;
regulator-max-microvolt = <1380000>;
regulator-always-on;
};
Or should this setting be set for all regulators provided by the same
IC, like this?
regulators {
+ barebox,allow-dummy-supply;
vddcore_reg: bcore1 {
regulator-min-microvolt = <730000>;
regulator-max-microvolt = <1380000>;
regulator-always-on;
};
I guess we could make both cases work, first check if
"barebox,allow-dummy-supply" is present in the regulator node and then
also check parent node (regulators)? What do you think?
BR,
Andrej
_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox