* [PATCH] regulator: output current-limit for all regulators in summary
@ 2015-04-10 11:48 Heiko Stübner
2015-04-10 14:46 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Heiko Stübner @ 2015-04-10 11:48 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: linux-kernel
Voltage regulators can have (unregulated) current limits too, so we should
probably output both voltage and current for all regulators.
Holding the rdev->mutex actually conflicts with _regulator_get_current_limit
but also is not really necessary, as the global regulator_list_mutex already
protects us from the regulator vanishing while we go through the list.
On the rk3288-firefly the summary now looks like:
regulator use open bypass voltage current min max
-------------------------------------------------------------------------------
vcc_sys 0 12 0 5000mV 0mA 5000mV 5000mV
vcc_lan 1 1 0 3300mV 0mA 3300mV 3300mV
ff290000.ethernet 0mV 0mV
vcca_33 0 0 0 3300mV 0mA 3300mV 3300mV
vcca_18 0 0 0 1800mV 0mA 1800mV 1800mV
vdd10_lcd 0 0 0 1000mV 0mA 1000mV 1000mV
[...]
Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
drivers/regulator/core.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index fb2c8d5..2cf51f4 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3949,23 +3949,13 @@ static void regulator_summary_show_subtree(struct seq_file *s,
if (!rdev)
return;
- mutex_lock(&rdev->mutex);
-
seq_printf(s, "%*s%-*s %3d %4d %6d ",
level * 3 + 1, "",
30 - level * 3, rdev_get_name(rdev),
rdev->use_count, rdev->open_count, rdev->bypass_count);
- switch (rdev->desc->type) {
- case REGULATOR_VOLTAGE:
- seq_printf(s, "%5dmV ",
- _regulator_get_voltage(rdev) / 1000);
- break;
- case REGULATOR_CURRENT:
- seq_printf(s, "%5dmA ",
- _regulator_get_current_limit(rdev) / 1000);
- break;
- }
+ seq_printf(s, "%5dmV ", _regulator_get_voltage(rdev) / 1000);
+ seq_printf(s, "%5dmA ", _regulator_get_current_limit(rdev) / 1000);
c = rdev->constraints;
if (c) {
@@ -3993,21 +3983,17 @@ static void regulator_summary_show_subtree(struct seq_file *s,
switch (rdev->desc->type) {
case REGULATOR_VOLTAGE:
- seq_printf(s, "%29dmV %5dmV",
+ seq_printf(s, "%37dmV %5dmV",
consumer->min_uV / 1000,
consumer->max_uV / 1000);
break;
case REGULATOR_CURRENT:
- seq_printf(s, "%37dmA",
- regulator_get_current_limit(consumer) / 1000);
break;
}
seq_puts(s, "\n");
}
- mutex_unlock(&rdev->mutex);
-
list_for_each_entry(child, list, list) {
/* handle only non-root regulators supplied by current rdev */
if (!child->supply || child->supply->rdev != rdev)
@@ -4022,8 +4008,8 @@ static int regulator_summary_show(struct seq_file *s, void *data)
struct list_head *list = s->private;
struct regulator_dev *rdev;
- seq_puts(s, " regulator use open bypass value min max\n");
- seq_puts(s, "-----------------------------------------------------------------------\n");
+ seq_puts(s, " regulator use open bypass voltage current min max\n");
+ seq_puts(s, "-------------------------------------------------------------------------------\n");
mutex_lock(®ulator_list_mutex);
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: output current-limit for all regulators in summary
2015-04-10 11:48 [PATCH] regulator: output current-limit for all regulators in summary Heiko Stübner
@ 2015-04-10 14:46 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-04-10 14:46 UTC (permalink / raw)
To: Heiko Stübner; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
On Fri, Apr 10, 2015 at 01:48:41PM +0200, Heiko Stübner wrote:
> Voltage regulators can have (unregulated) current limits too, so we should
> probably output both voltage and current for all regulators.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-10 14:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-10 11:48 [PATCH] regulator: output current-limit for all regulators in summary Heiko Stübner
2015-04-10 14:46 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox