diff mbox

[2/2] regulator: core: Add reg_ignore_unused to keep boot time regulators enabled

Message ID 1395984022-8284-3-git-send-email-tushar.behera@linaro.org
State New
Headers show

Commit Message

Tushar Behera March 28, 2014, 5:20 a.m. UTC
Keep all regulators already enabled by bootloader on, even if no
driver has claimed them. This is useful for debug and development, but
should not be needed on a platform with proper driver support.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
CC: Mark Brown <broonie@kernel.org>
---
 Documentation/kernel-parameters.txt |    8 ++++++++
 drivers/regulator/core.c            |   13 +++++++++++++
 2 files changed, 21 insertions(+)

Comments

Mark Brown March 28, 2014, 10:22 a.m. UTC | #1
On Fri, Mar 28, 2014 at 10:50:22AM +0530, Tushar Behera wrote:
> Keep all regulators already enabled by bootloader on, even if no
> driver has claimed them. This is useful for debug and development, but
> should not be needed on a platform with proper driver support.

That's already the default on non-DT systems so I'd expect that if we
were doing this the code would be joined up with the code for that.  I'm
not sure this is a terribly good idea though - we already display a
message just before we power off the regulator and having an option like
this feels like it's going to encourage people to write bad DTs and tell
people to add this to their command line.
Tushar Behera April 1, 2014, 1:29 p.m. UTC | #2
On 28 March 2014 15:52, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Mar 28, 2014 at 10:50:22AM +0530, Tushar Behera wrote:
>> Keep all regulators already enabled by bootloader on, even if no
>> driver has claimed them. This is useful for debug and development, but
>> should not be needed on a platform with proper driver support.
>
> That's already the default on non-DT systems so I'd expect that if we
> were doing this the code would be joined up with the code for that.  I'm
> not sure this is a terribly good idea though - we already display a
> message just before we power off the regulator and having an option like
> this feels like it's going to encourage people to write bad DTs and tell
> people to add this to their command line.

I agree with your point that it may lead developers to write bad DTs,
but it becomes quite helpful while debugging issues.
Mark Brown April 1, 2014, 3:58 p.m. UTC | #3
On Tue, Apr 01, 2014 at 06:59:04PM +0530, Tushar Behera wrote:

> I agree with your point that it may lead developers to write bad DTs,
> but it becomes quite helpful while debugging issues.

So make what you're trying to do look more like a debug option then...
though to be honest given how easy things are to resolve and the prints
that are there already I'm not sure it's that helpful.
diff mbox

Patch

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 96bb532..20448e0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -92,6 +92,7 @@  parameter is applicable:
 	PPT	Parallel port support is enabled.
 	PS2	Appropriate PS/2 support is enabled.
 	RAM	RAM disk support is enabled.
+	REG	Regulator support is enabled.
 	S390	S390 architecture is enabled.
 	SCSI	Appropriate SCSI support is enabled.
 			A lot of drivers have their options described inside
@@ -2886,6 +2887,13 @@  bytes respectively. Such letter suffixes can also be entirely omitted.
 			      reboot_cpu is s[mp]#### with #### being the processor
 					to be used for rebooting.
 
+	reg_ignore_unused
+			[REG]
+			Keep all regulators already enabled by bootloader on,
+			even if no driver has claimed them. This is useful
+			for debug and development, but should not be
+			needed on a platform with proper driver support.
+
 	relax_domain_level=
 			[KNL, SMP] Set scheduler's default relax_domain_level.
 			See Documentation/cgroups/cpusets.txt.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9a09f3c..6e8305a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3800,6 +3800,14 @@  static int __init regulator_init(void)
 /* init early to allow our consumers to complete system booting */
 core_initcall(regulator_init);
 
+static bool reg_ignore_unused;
+static int __init reg_ignore_unused_setup(char *__unused)
+{
+	reg_ignore_unused = true;
+	return 1;
+}
+__setup("reg_ignore_unused", reg_ignore_unused_setup);
+
 static int __init regulator_init_complete(void)
 {
 	struct regulator_dev *rdev;
@@ -3807,6 +3815,11 @@  static int __init regulator_init_complete(void)
 	struct regulation_constraints *c;
 	int enabled, ret;
 
+	if (reg_ignore_unused) {
+		pr_warn("reg: Not disabling unused regulators\n");
+		return 0;
+	}
+
 	/*
 	 * Since DT doesn't provide an idiomatic mechanism for
 	 * enabling full constraints and since it's much more natural