[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231101045652.GA2897@thinkpad>
Date: Wed, 1 Nov 2023 10:26:52 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Javier Martinez Canillas <javierm@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Manivannan Sadhasivam <mani@...nel.org>,
Jonathan Corbet <corbet@....net>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Randy Dunlap <rdunlap@...radead.org>,
"Steven Rostedt (Google)" <rostedt@...dmis.org>,
Tejun Heo <tj@...nel.org>, linux-doc@...r.kernel.org
Subject: Re: [PATCH] regulator: core: Add option to prevent disabling unused
regulators
On Sat, Oct 28, 2023 at 12:24:03PM +0200, Javier Martinez Canillas wrote:
> 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@...hat.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Thanks for looking into this. This patch is very handy to debug display related
issues on platforms without serial console.
On the other note, I'm wondering if we could use sync_state() for handling the
regulator_init_complete() work. This would ensure that the regulators are only
disabled when all the consumers are probed.
- Mani
> ---
>
> Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
> drivers/regulator/core.c | 17 +++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 0a1731a0f0ef..91b58d767c2c 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5461,6 +5461,13 @@
> print every Nth verbose statement, where N is the value
> specified.
>
> + regulator_ignore_unused
> + [REGULATOR]
> + Prevents the regulator framework to disable regulators
> + that are unused due not driver claiming them. This may
> + be 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/admin-guide/cgroup-v1/cpusets.rst.
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 3137e40fcd3e..220034ff0273 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -6234,6 +6234,14 @@ static int regulator_late_cleanup(struct device *dev, void *data)
> return 0;
> }
>
> +static bool regulator_ignore_unused;
> +static int __init regulator_ignore_unused_setup(char *__unused)
> +{
> + regulator_ignore_unused = true;
> + return 1;
> +}
> +__setup("regulator_ignore_unused", regulator_ignore_unused_setup);
> +
> static void regulator_init_complete_work_function(struct work_struct *work)
> {
> /*
> @@ -6246,6 +6254,15 @@ static void regulator_init_complete_work_function(struct work_struct *work)
> class_for_each_device(®ulator_class, NULL, NULL,
> regulator_register_resolve_supply);
>
> + /*
> + * For debugging purposes, it may be useful to prevent unused
> + * regulators to be disabled.
> + */
> + if (regulator_ignore_unused) {
> + pr_warn("regulator: Not disabling unused regulators\n");
> + return;
> + }
> +
> /* If we have a full configuration then disable any regulators
> * we have permission to change the status for and which are
> * not in use or always_on. This is effectively the default
> --
> 2.41.0
>
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists