diff options
author | Heiko Stübner <heiko@sntech.de> | 2015-04-10 07:48:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-04-10 10:46:32 -0400 |
commit | 23296099e70854a272fc369bab8ddcc57f27f97a (patch) | |
tree | 95e08253259c31d5e75598a9a4eb815cd6b05b07 /drivers/regulator | |
parent | 7c225ec90c368a474daa9803922f4b7d6fe6d5c8 (diff) |
regulator: output current-limit for all regulators in summary
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5aae1bd61151..0ea0a019dc57 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3967,23 +3967,13 @@ static void regulator_summary_show_subtree(struct seq_file *s, | |||
3967 | if (!rdev) | 3967 | if (!rdev) |
3968 | return; | 3968 | return; |
3969 | 3969 | ||
3970 | mutex_lock(&rdev->mutex); | ||
3971 | |||
3972 | seq_printf(s, "%*s%-*s %3d %4d %6d ", | 3970 | seq_printf(s, "%*s%-*s %3d %4d %6d ", |
3973 | level * 3 + 1, "", | 3971 | level * 3 + 1, "", |
3974 | 30 - level * 3, rdev_get_name(rdev), | 3972 | 30 - level * 3, rdev_get_name(rdev), |
3975 | rdev->use_count, rdev->open_count, rdev->bypass_count); | 3973 | rdev->use_count, rdev->open_count, rdev->bypass_count); |
3976 | 3974 | ||
3977 | switch (rdev->desc->type) { | 3975 | seq_printf(s, "%5dmV ", _regulator_get_voltage(rdev) / 1000); |
3978 | case REGULATOR_VOLTAGE: | 3976 | seq_printf(s, "%5dmA ", _regulator_get_current_limit(rdev) / 1000); |
3979 | seq_printf(s, "%5dmV ", | ||
3980 | _regulator_get_voltage(rdev) / 1000); | ||
3981 | break; | ||
3982 | case REGULATOR_CURRENT: | ||
3983 | seq_printf(s, "%5dmA ", | ||
3984 | _regulator_get_current_limit(rdev) / 1000); | ||
3985 | break; | ||
3986 | } | ||
3987 | 3977 | ||
3988 | c = rdev->constraints; | 3978 | c = rdev->constraints; |
3989 | if (c) { | 3979 | if (c) { |
@@ -4011,21 +4001,17 @@ static void regulator_summary_show_subtree(struct seq_file *s, | |||
4011 | 4001 | ||
4012 | switch (rdev->desc->type) { | 4002 | switch (rdev->desc->type) { |
4013 | case REGULATOR_VOLTAGE: | 4003 | case REGULATOR_VOLTAGE: |
4014 | seq_printf(s, "%29dmV %5dmV", | 4004 | seq_printf(s, "%37dmV %5dmV", |
4015 | consumer->min_uV / 1000, | 4005 | consumer->min_uV / 1000, |
4016 | consumer->max_uV / 1000); | 4006 | consumer->max_uV / 1000); |
4017 | break; | 4007 | break; |
4018 | case REGULATOR_CURRENT: | 4008 | case REGULATOR_CURRENT: |
4019 | seq_printf(s, "%37dmA", | ||
4020 | regulator_get_current_limit(consumer) / 1000); | ||
4021 | break; | 4009 | break; |
4022 | } | 4010 | } |
4023 | 4011 | ||
4024 | seq_puts(s, "\n"); | 4012 | seq_puts(s, "\n"); |
4025 | } | 4013 | } |
4026 | 4014 | ||
4027 | mutex_unlock(&rdev->mutex); | ||
4028 | |||
4029 | list_for_each_entry(child, list, list) { | 4015 | list_for_each_entry(child, list, list) { |
4030 | /* handle only non-root regulators supplied by current rdev */ | 4016 | /* handle only non-root regulators supplied by current rdev */ |
4031 | if (!child->supply || child->supply->rdev != rdev) | 4017 | if (!child->supply || child->supply->rdev != rdev) |
@@ -4040,8 +4026,8 @@ static int regulator_summary_show(struct seq_file *s, void *data) | |||
4040 | struct list_head *list = s->private; | 4026 | struct list_head *list = s->private; |
4041 | struct regulator_dev *rdev; | 4027 | struct regulator_dev *rdev; |
4042 | 4028 | ||
4043 | seq_puts(s, " regulator use open bypass value min max\n"); | 4029 | seq_puts(s, " regulator use open bypass voltage current min max\n"); |
4044 | seq_puts(s, "-----------------------------------------------------------------------\n"); | 4030 | seq_puts(s, "-------------------------------------------------------------------------------\n"); |
4045 | 4031 | ||
4046 | mutex_lock(®ulator_list_mutex); | 4032 | mutex_lock(®ulator_list_mutex); |
4047 | 4033 | ||