Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Javier Martinez Canillas and committed by
Mark Brown
c986968f b85ea95d

+24
+7
Documentation/admin-guide/kernel-parameters.txt
··· 5544 5544 print every Nth verbose statement, where N is the value 5545 5545 specified. 5546 5546 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 + 5547 5554 relax_domain_level= 5548 5555 [KNL, SMP] Set scheduler's default relax_domain_level. 5549 5556 See Documentation/admin-guide/cgroup-v1/cpusets.rst.
+17
drivers/regulator/core.c
··· 6234 6234 return 0; 6235 6235 } 6236 6236 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 + 6237 6245 static void regulator_init_complete_work_function(struct work_struct *work) 6238 6246 { 6239 6247 /* ··· 6253 6245 */ 6254 6246 class_for_each_device(&regulator_class, NULL, NULL, 6255 6247 regulator_register_resolve_supply); 6248 + 6249 + /* 6250 + * For debugging purposes, it may be useful to prevent unused 6251 + * regulators from being disabled. 6252 + */ 6253 + if (regulator_ignore_unused) { 6254 + pr_warn("regulator: Not disabling unused regulators\n"); 6255 + return; 6256 + } 6256 6257 6257 6258 /* If we have a full configuration then disable any regulators 6258 6259 * we have permission to change the status for and which are