Skip to content

Commit c986968

Browse files
martinezjavierbroonie
authored andcommitted
regulator: core: Add option to prevent disabling unused regulators
This may be useful for debugging and develompent purposes, when there are drivers that depend on regulators to be enabled but do not request them. It is inspired from the clk_ignore_unused and pd_ignore_unused parameters, that are used to keep firmware-enabled clocks and power domains on even if these are not used by drivers. The parameter is not expected to be used in normal cases and should not be needed on a platform with proper driver support. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20231107190926.1185326-1-javierm@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b85ea95 commit c986968

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5544,6 +5544,13 @@
55445544
print every Nth verbose statement, where N is the value
55455545
specified.
55465546

5547+
regulator_ignore_unused
5548+
[REGULATOR]
5549+
Prevents regulator framework from disabling regulators
5550+
that are unused, due no driver claiming them. This may
5551+
be useful for debug and development, but should not be
5552+
needed on a platform with proper driver support.
5553+
55475554
relax_domain_level=
55485555
[KNL, SMP] Set scheduler's default relax_domain_level.
55495556
See Documentation/admin-guide/cgroup-v1/cpusets.rst.

drivers/regulator/core.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6234,6 +6234,14 @@ static int regulator_late_cleanup(struct device *dev, void *data)
62346234
return 0;
62356235
}
62366236

6237+
static bool regulator_ignore_unused;
6238+
static int __init regulator_ignore_unused_setup(char *__unused)
6239+
{
6240+
regulator_ignore_unused = true;
6241+
return 1;
6242+
}
6243+
__setup("regulator_ignore_unused", regulator_ignore_unused_setup);
6244+
62376245
static void regulator_init_complete_work_function(struct work_struct *work)
62386246
{
62396247
/*
@@ -6246,6 +6254,15 @@ static void regulator_init_complete_work_function(struct work_struct *work)
62466254
class_for_each_device(&regulator_class, NULL, NULL,
62476255
regulator_register_resolve_supply);
62486256

6257+
/*
6258+
* For debugging purposes, it may be useful to prevent unused
6259+
* regulators from being disabled.
6260+
*/
6261+
if (regulator_ignore_unused) {
6262+
pr_warn("regulator: Not disabling unused regulators\n");
6263+
return;
6264+
}
6265+
62496266
/* If we have a full configuration then disable any regulators
62506267
* we have permission to change the status for and which are
62516268
* not in use or always_on. This is effectively the default

0 commit comments

Comments
 (0)