Skip to content

Commit f3c3f06

Browse files
committed
Merge branch 'for-linus' of git://opensource.wolfsonmicro.com/regulator
* 'for-linus' of git://opensource.wolfsonmicro.com/regulator: (22 commits) regulator: Constify constraints name regulator: Fix possible nullpointer dereference in regulator_enable() regulator: gpio-regulator add dependency on GENERIC_GPIO regulator: Add module.h include to gpio-regulator regulator: Add driver for gpio-controlled regulators regulator: remove duplicate REG_CTRL2 defines in tps65023 regulator: Clarify documentation for regulator-regulator supplies regulator: Fix some bitrot in the machine driver documentation regulator: tps65023: Added support for the similiar TPS65020 chip regulator: tps65023: Setting correct core regulator for tps65021 regulator: tps65023: Set missing bit for update core-voltage regulator: tps65023: Fixes i2c configuration issues regulator: Add debugfs file showing the supply map table regulator: tps6586x: add SMx slew rate setting regulator: tps65023: Fixes i2c configuration issues regulator: tps6507x: Remove num_voltages array regulator: max8952: removed unused mutex. regulator: fix regulator/consumer.h kernel-doc warning regulator: Ensure enough enable time for max8649 regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched ...
2 parents c18ae42 + 0151546 commit f3c3f06

16 files changed

Lines changed: 721 additions & 48 deletions

File tree

‎Documentation/power/regulator/machine.txt‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ initialisation code by creating a struct regulator_consumer_supply for
1616
each regulator.
1717

1818
struct regulator_consumer_supply {
19-
struct device *dev; /* consumer */
19+
const char *dev_name; /* consumer dev_name() */
2020
const char *supply; /* consumer supply - e.g. "vcc" */
2121
};
2222

2323
e.g. for the machine above
2424

2525
static struct regulator_consumer_supply regulator1_consumers[] = {
2626
{
27-
.dev = &platform_consumerB_device.dev,
28-
.supply = "Vcc",
27+
.dev_name = "dev_name(consumer B)",
28+
.supply = "Vcc",
2929
},};
3030

3131
static struct regulator_consumer_supply regulator2_consumers[] = {
3232
{
33-
.dev = &platform_consumerA_device.dev,
33+
.dev = "dev_name(consumer A"),
3434
.supply = "Vcc",
3535
},};
3636

@@ -43,6 +43,7 @@ to their supply regulator :-
4343

4444
static struct regulator_init_data regulator1_data = {
4545
.constraints = {
46+
.name = "Regulator-1",
4647
.min_uV = 3300000,
4748
.max_uV = 3300000,
4849
.valid_modes_mask = REGULATOR_MODE_NORMAL,
@@ -51,13 +52,19 @@ static struct regulator_init_data regulator1_data = {
5152
.consumer_supplies = regulator1_consumers,
5253
};
5354

55+
The name field should be set to something that is usefully descriptive
56+
for the board for configuration of supplies for other regulators and
57+
for use in logging and other diagnostic output. Normally the name
58+
used for the supply rail in the schematic is a good choice. If no
59+
name is provided then the subsystem will choose one.
60+
5461
Regulator-1 supplies power to Regulator-2. This relationship must be registered
5562
with the core so that Regulator-1 is also enabled when Consumer A enables its
5663
supply (Regulator-2). The supply regulator is set by the supply_regulator
57-
field below:-
64+
field below and co:-
5865

5966
static struct regulator_init_data regulator2_data = {
60-
.supply_regulator = "regulator_name",
67+
.supply_regulator = "Regulator-1",
6168
.constraints = {
6269
.min_uV = 1800000,
6370
.max_uV = 2000000,

‎drivers/regulator/88pm8607.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
412412
if (info->desc.id == res->start)
413413
break;
414414
}
415-
if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
415+
if (i == ARRAY_SIZE(pm8607_regulator_info)) {
416416
dev_err(&pdev->dev, "Failed to find regulator %llu\n",
417417
(unsigned long long)res->start);
418418
return -EINVAL;

‎drivers/regulator/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ config REGULATOR_USERSPACE_CONSUMER
6464

6565
If unsure, say no.
6666

67+
config REGULATOR_GPIO
68+
tristate "GPIO regulator support"
69+
depends on GENERIC_GPIO
70+
help
71+
This driver provides support for regulators that can be
72+
controlled via gpios.
73+
It is capable of supporting current and voltage regulators
74+
and the platform has to provide a mapping of GPIO-states
75+
to target volts/amps.
76+
6777
config REGULATOR_BQ24022
6878
tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
6979
help

‎drivers/regulator/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
88
obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
99
obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
1010

11+
obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
1112
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
1213
obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
1314
obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o

‎drivers/regulator/aat2870-regulator.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/kernel.h>
2323
#include <linux/init.h>
2424
#include <linux/err.h>
25+
#include <linux/module.h>
2526
#include <linux/slab.h>
2627
#include <linux/delay.h>
2728
#include <linux/platform_device.h>

‎drivers/regulator/core.c‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ int regulator_enable(struct regulator *regulator)
14251425
ret = _regulator_enable(rdev);
14261426
mutex_unlock(&rdev->mutex);
14271427

1428-
if (ret != 0)
1428+
if (ret != 0 && rdev->supply)
14291429
regulator_disable(rdev->supply);
14301430

14311431
return ret;
@@ -2971,6 +2971,43 @@ void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data)
29712971
}
29722972
EXPORT_SYMBOL_GPL(regulator_get_init_drvdata);
29732973

2974+
#ifdef CONFIG_DEBUG_FS
2975+
static ssize_t supply_map_read_file(struct file *file, char __user *user_buf,
2976+
size_t count, loff_t *ppos)
2977+
{
2978+
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
2979+
ssize_t len, ret = 0;
2980+
struct regulator_map *map;
2981+
2982+
if (!buf)
2983+
return -ENOMEM;
2984+
2985+
list_for_each_entry(map, &regulator_map_list, list) {
2986+
len = snprintf(buf + ret, PAGE_SIZE - ret,
2987+
"%s -> %s.%s\n",
2988+
rdev_get_name(map->regulator), map->dev_name,
2989+
map->supply);
2990+
if (len >= 0)
2991+
ret += len;
2992+
if (ret > PAGE_SIZE) {
2993+
ret = PAGE_SIZE;
2994+
break;
2995+
}
2996+
}
2997+
2998+
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
2999+
3000+
kfree(buf);
3001+
3002+
return ret;
3003+
}
3004+
3005+
static const struct file_operations supply_map_fops = {
3006+
.read = supply_map_read_file,
3007+
.llseek = default_llseek,
3008+
};
3009+
#endif
3010+
29743011
static int __init regulator_init(void)
29753012
{
29763013
int ret;
@@ -2983,6 +3020,10 @@ static int __init regulator_init(void)
29833020
pr_warn("regulator: Failed to create debugfs directory\n");
29843021
debugfs_root = NULL;
29853022
}
3023+
3024+
if (IS_ERR(debugfs_create_file("supply_map", 0444, debugfs_root,
3025+
NULL, &supply_map_fops)))
3026+
pr_warn("regulator: Failed to create supplies debugfs\n");
29863027
#endif
29873028

29883029
regulator_dummy_init();

0 commit comments

Comments
 (0)