mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrej Picej <andrej.picej@norik.com>
To: barebox@lists.infradead.org
Cc: Y.Bas@phytec.de, s.riedmueller@phytec.de
Subject: [PATCH 3/5] regulator: allow use of dummy regulator
Date: Mon, 15 Nov 2021 14:02:06 +0100	[thread overview]
Message-ID: <20211115130208.619443-4-andrej.picej@norik.com> (raw)
In-Reply-To: <20211115130208.619443-1-andrej.picej@norik.com>

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@norik.com>
---
 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);
+	}
 
 	list_for_each_entry(ri, &regulator_list, list) {
 		if (ri->node == node) {
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-11-15 13:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
2021-11-15 13:02 ` [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot Andrej Picej
2021-11-15 13:02 ` [PATCH 2/5] ARM: configs: phytec-som-imx6.config Andrej Picej
2021-11-17  7:03   ` Sascha Hauer
2021-11-17  9:59     ` Stefan Riedmüller
2021-11-17 10:08       ` Andrej Picej
2021-11-15 13:02 ` Andrej Picej [this message]
2021-11-17  7:21   ` [PATCH 3/5] regulator: allow use of dummy regulator Sascha Hauer
2021-11-17  8:11     ` Andrej Picej
2021-11-17  9:29       ` Andrej Picej
2021-11-15 13:02 ` [PATCH 4/5] ARM: dts: imx6qdl: pfla02: allow use of dummy regulators Andrej Picej
2021-11-15 13:02 ` [PATCH 5/5] documentation: regulator: add dummy-supply Andrej Picej

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211115130208.619443-4-andrej.picej@norik.com \
    --to=andrej.picej@norik.com \
    --cc=Y.Bas@phytec.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.riedmueller@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox