mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Andrej Picej <andrej.picej@norik.com>
Cc: barebox@lists.infradead.org, Y.Bas@phytec.de, s.riedmueller@phytec.de
Subject: Re: [PATCH 3/5] regulator: allow use of dummy regulator
Date: Wed, 17 Nov 2021 08:21:18 +0100	[thread overview]
Message-ID: <20211117072118.GH6556@pengutronix.de> (raw)
In-Reply-To: <20211115130208.619443-4-andrej.picej@norik.com>

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@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);

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.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


  reply	other threads:[~2021-11-17  7:23 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 ` [PATCH 3/5] regulator: allow use of dummy regulator Andrej Picej
2021-11-17  7:21   ` Sascha Hauer [this message]
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=20211117072118.GH6556@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=Y.Bas@phytec.de \
    --cc=andrej.picej@norik.com \
    --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