Skip to content

Commit c6d65bf

Browse files
committed
Merge tag 'regulator-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "Lots of driver updates here plus some nice new core features, the main one being the first: - Enable support for providing a dummy regulator when we know that one must exist for the device to be functional. This makes it much easier to add regulator support to drivers since we don't require that the machine integration for all systems using the device be updated to provide regulators. - Substantial reduction in the amount of busy waiting done while waiting for enables to complete. - Allow MFDs to distribute regulator supplies to child devices so we don't have to expose the internal structure of MFDs outside of the driver. - Managed registeration for regulators" * tag 'regulator-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (113 commits) regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4 regulator: s5m8767: Modify parse_dt function to parse data related to ramp regulator: da9052: Revert se apply_[reg|bit] with regmap based voltage_sel operations mfd: arizona: Specify supply mappings for Arizona CODECs mfd: Allow mapping regulator supplies to MFD device from children regulator: core: Add ability to create a lookup alias for supply regulator: tps65910: Fix checkpatch issue regulator: tps65023: Fix checkpatch issue regulator: tps6105x: Fix checkpatch issue regulator: mc13783: Fix checkpatch issue regulator: max8997: Fix checkpatch issue regulator: lp3971: Fix checkpatch issue regulator: fixed: Fix checkpatch issue regulator: anatop: Fix checkpatch issue regulator: Add REGULATOR_LINEAR_RANGE macro regulator: Remove max_uV from struct regulator_linear_range regulator: ti-abb: Fix operator precedence typo regulator: tps65910: get regulators node from parent node only regulator: tps6586x: get regulators node from parent node only regulator: tps65090: get regulators node from parent node only ...
2 parents 4fc9ed3 + d4d5cef commit c6d65bf

83 files changed

Lines changed: 2582 additions & 1519 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Regulator of AMS AS3722 PMIC.
2+
Name of the regulator subnode must be "regulators".
3+
4+
Optional properties:
5+
--------------------
6+
The input supply of regulators are the optional properties on the
7+
regulator node. The AS3722 is having 7 DCDC step-down regulators as
8+
sd[0-6], 10 LDOs as ldo[0-7], ldo[9-11]. The input supply of these
9+
regulators are provided through following properties:
10+
vsup-sd2-supply: Input supply for SD2.
11+
vsup-sd3-supply: Input supply for SD3.
12+
vsup-sd4-supply: Input supply for SD4.
13+
vsup-sd5-supply: Input supply for SD5.
14+
vin-ldo0-supply: Input supply for LDO0.
15+
vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
16+
vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
17+
vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
18+
vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
19+
vin-ldo11-supply: Input supply for LDO11.
20+
21+
Optional nodes:
22+
--------------
23+
- regulators : Must contain a sub-node per regulator from the list below.
24+
Each sub-node should contain the constraints and initialization
25+
information for that regulator. See regulator.txt for a
26+
description of standard properties for these sub-nodes.
27+
Additional custom properties are listed below.
28+
sd[0-6], ldo[0-7], ldo[9-11].
29+
30+
Optional sub-node properties:
31+
----------------------------
32+
ams,ext-control: External control of the rail. The option of
33+
this properties will tell which external input is
34+
controlling this rail. Valid values are 0, 1, 2 ad 3.
35+
0: There is no external control of this rail.
36+
1: Rail is controlled by ENABLE1 input pin.
37+
2: Rail is controlled by ENABLE2 input pin.
38+
3: Rail is controlled by ENABLE3 input pin.
39+
ams,enable-tracking: Enable tracking with SD1, only supported
40+
by LDO3.
41+
42+
Example:
43+
-------
44+
ams3722: ams3722 {
45+
compatible = "ams,as3722";
46+
reg = <0x40>;
47+
...
48+
49+
regulators {
50+
vsup-sd2-supply = <...>;
51+
...
52+
53+
sd0 {
54+
regulator-name = "vdd_cpu";
55+
regulator-min-microvolt = <700000>;
56+
regulator-max-microvolt = <1400000>;
57+
regulator-always-on;
58+
ams,ext-control = <2>;
59+
};
60+
61+
sd1 {
62+
regulator-name = "vdd_core";
63+
regulator-min-microvolt = <700000>;
64+
regulator-max-microvolt = <1400000>;
65+
regulator-always-on;
66+
ams,ext-control = <1>;
67+
};
68+
69+
sd2 {
70+
regulator-name = "vddio_ddr";
71+
regulator-min-microvolt = <1350000>;
72+
regulator-max-microvolt = <1350000>;
73+
regulator-always-on;
74+
};
75+
76+
sd4 {
77+
regulator-name = "avdd-hdmi-pex";
78+
regulator-min-microvolt = <1050000>;
79+
regulator-max-microvolt = <1050000>;
80+
regulator-always-on;
81+
};
82+
83+
sd5 {
84+
regulator-name = "vdd-1v8";
85+
regulator-min-microvolt = <1800000>;
86+
regulator-max-microvolt = <1800000>;
87+
regulator-always-on;
88+
};
89+
....
90+
};
91+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
* Dialog Semiconductor DA9210 Voltage Regulator
2+
3+
Required properties:
4+
5+
- compatible: must be "diasemi,da9210"
6+
- reg: the i2c slave address of the regulator. It should be 0x68.
7+
8+
Any standard regulator properties can be used to configure the single da9210
9+
DCDC.
10+
11+
Example:
12+
13+
da9210@68 {
14+
compatible = "diasemi,da9210";
15+
reg = <0x68>;
16+
17+
regulator-min-microvolt = <900000>;
18+
regulator-max-microvolt = <1000000>;
19+
regulator-boot-on;
20+
regulator-always-on;
21+
};

Documentation/devicetree/bindings/regulator/palmas-pmic.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ Optional nodes:
2626

2727
For ti,palmas-pmic - smps12, smps123, smps3 depending on OTP,
2828
smps45, smps457, smps7 depending on variant, smps6, smps[8-9],
29-
smps10_out2, smps10_out1, do[1-9], ldoln, ldousb.
29+
smps10_out2, smps10_out1, ldo[1-9], ldoln, ldousb.
3030

3131
Optional sub-node properties:
3232
ti,warm-reset - maintain voltage during warm reset(boolean)
33-
ti,roof-floor - control voltage selection by pin(boolean)
33+
ti,roof-floor - This takes as optional argument on platform supporting
34+
the rail from desired external control. If there is no argument then
35+
it will be assume that it is controlled by NSLEEP pin.
36+
The valid value for external pins are:
37+
ENABLE1 then 1,
38+
ENABLE2 then 2 or
39+
NSLEEP then 3.
3440
ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto,
3541
2 - eco, 3 - forced pwm
3642
ti,smps-range - OTP has the wrong range set for the hardware so override
@@ -61,7 +67,7 @@ pmic {
6167
regulator-always-on;
6268
regulator-boot-on;
6369
ti,warm-reset;
64-
ti,roof-floor;
70+
ti,roof-floor = <1>; /* ENABLE1 control */
6571
ti,mode-sleep = <0>;
6672
ti,smps-range = <1>;
6773
};

Documentation/devicetree/bindings/regulator/regulator.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Optional properties:
1414
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
1515
For hardwares which support disabling ramp rate, it should be explicitly
1616
intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
17+
- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
18+
rail to reach the target voltage, plus/minus whatever tolerance the board
19+
design requires. This property describes the total system ramp time
20+
required due to the combination of internal ramping of the regulator itself,
21+
and board design issues such as trace capacitance and load on the supply.
1722

1823
Deprecated properties:
1924
- regulator-compatible: If a regulator chip contains multiple

Documentation/driver-model/devres.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ REGULATOR
283283
devm_regulator_get()
284284
devm_regulator_put()
285285
devm_regulator_bulk_get()
286+
devm_regulator_register()
286287

287288
CLOCK
288289
devm_clk_get()

arch/arm/mach-s3c64xx/mach-crag6410.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,6 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {
310310

311311
REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
312312
REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
313-
REGULATOR_SUPPLY("SPKVDDL", "wm5102-codec"),
314-
REGULATOR_SUPPLY("SPKVDDR", "wm5102-codec"),
315-
REGULATOR_SUPPLY("SPKVDDL", "wm5110-codec"),
316-
REGULATOR_SUPPLY("SPKVDDR", "wm5110-codec"),
317313

318314
REGULATOR_SUPPLY("DC1VDD", "0-0034"),
319315
REGULATOR_SUPPLY("DC2VDD", "0-0034"),
@@ -653,14 +649,6 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
653649
REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
654650
REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
655651
REGULATOR_SUPPLY("CPVDD", "spi0.1"),
656-
657-
REGULATOR_SUPPLY("DBVDD2", "wm5102-codec"),
658-
REGULATOR_SUPPLY("DBVDD3", "wm5102-codec"),
659-
REGULATOR_SUPPLY("CPVDD", "wm5102-codec"),
660-
661-
REGULATOR_SUPPLY("DBVDD2", "wm5110-codec"),
662-
REGULATOR_SUPPLY("DBVDD3", "wm5110-codec"),
663-
REGULATOR_SUPPLY("CPVDD", "wm5110-codec"),
664652
};
665653

666654
static struct regulator_init_data pvdd_1v8 = {

drivers/mfd/arizona-core.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,25 @@ static struct mfd_cell early_devs[] = {
569569
{ .name = "arizona-ldo1" },
570570
};
571571

572+
static const char *wm5102_supplies[] = {
573+
"DBVDD2",
574+
"DBVDD3",
575+
"CPVDD",
576+
"SPKVDDL",
577+
"SPKVDDR",
578+
};
579+
572580
static struct mfd_cell wm5102_devs[] = {
573581
{ .name = "arizona-micsupp" },
574582
{ .name = "arizona-extcon" },
575583
{ .name = "arizona-gpio" },
576584
{ .name = "arizona-haptics" },
577585
{ .name = "arizona-pwm" },
578-
{ .name = "wm5102-codec" },
586+
{
587+
.name = "wm5102-codec",
588+
.parent_supplies = wm5102_supplies,
589+
.num_parent_supplies = ARRAY_SIZE(wm5102_supplies),
590+
},
579591
};
580592

581593
static struct mfd_cell wm5110_devs[] = {
@@ -584,7 +596,17 @@ static struct mfd_cell wm5110_devs[] = {
584596
{ .name = "arizona-gpio" },
585597
{ .name = "arizona-haptics" },
586598
{ .name = "arizona-pwm" },
587-
{ .name = "wm5110-codec" },
599+
{
600+
.name = "wm5110-codec",
601+
.parent_supplies = wm5102_supplies,
602+
.num_parent_supplies = ARRAY_SIZE(wm5102_supplies),
603+
},
604+
};
605+
606+
static const char *wm8997_supplies[] = {
607+
"DBVDD2",
608+
"CPVDD",
609+
"SPKVDD",
588610
};
589611

590612
static struct mfd_cell wm8997_devs[] = {
@@ -593,7 +615,11 @@ static struct mfd_cell wm8997_devs[] = {
593615
{ .name = "arizona-gpio" },
594616
{ .name = "arizona-haptics" },
595617
{ .name = "arizona-pwm" },
596-
{ .name = "wm8997-codec" },
618+
{
619+
.name = "wm8997-codec",
620+
.parent_supplies = wm8997_supplies,
621+
.num_parent_supplies = ARRAY_SIZE(wm8997_supplies),
622+
},
597623
};
598624

599625
int arizona_dev_init(struct arizona *arizona)

drivers/mfd/mfd-core.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/module.h>
2121
#include <linux/irqdomain.h>
2222
#include <linux/of.h>
23+
#include <linux/regulator/consumer.h>
2324

2425
static struct device_type mfd_dev_type = {
2526
.name = "mfd_device",
@@ -99,6 +100,13 @@ static int mfd_add_device(struct device *parent, int id,
99100
pdev->dev.dma_mask = parent->dma_mask;
100101
pdev->dev.dma_parms = parent->dma_parms;
101102

103+
ret = devm_regulator_bulk_register_supply_alias(
104+
&pdev->dev, cell->parent_supplies,
105+
parent, cell->parent_supplies,
106+
cell->num_parent_supplies);
107+
if (ret < 0)
108+
goto fail_res;
109+
102110
if (parent->of_node && cell->of_compatible) {
103111
for_each_child_of_node(parent->of_node, np) {
104112
if (of_device_is_compatible(np, cell->of_compatible)) {
@@ -112,12 +120,12 @@ static int mfd_add_device(struct device *parent, int id,
112120
ret = platform_device_add_data(pdev,
113121
cell->platform_data, cell->pdata_size);
114122
if (ret)
115-
goto fail_res;
123+
goto fail_alias;
116124
}
117125

118126
ret = mfd_platform_add_cell(pdev, cell);
119127
if (ret)
120-
goto fail_res;
128+
goto fail_alias;
121129

122130
for (r = 0; r < cell->num_resources; r++) {
123131
res[r].name = cell->resources[r].name;
@@ -152,17 +160,17 @@ static int mfd_add_device(struct device *parent, int id,
152160
if (!cell->ignore_resource_conflicts) {
153161
ret = acpi_check_resource_conflict(&res[r]);
154162
if (ret)
155-
goto fail_res;
163+
goto fail_alias;
156164
}
157165
}
158166

159167
ret = platform_device_add_resources(pdev, res, cell->num_resources);
160168
if (ret)
161-
goto fail_res;
169+
goto fail_alias;
162170

163171
ret = platform_device_add(pdev);
164172
if (ret)
165-
goto fail_res;
173+
goto fail_alias;
166174

167175
if (cell->pm_runtime_no_callbacks)
168176
pm_runtime_no_callbacks(&pdev->dev);
@@ -171,6 +179,10 @@ static int mfd_add_device(struct device *parent, int id,
171179

172180
return 0;
173181

182+
fail_alias:
183+
devm_regulator_bulk_unregister_supply_alias(&pdev->dev,
184+
cell->parent_supplies,
185+
cell->num_parent_supplies);
174186
fail_res:
175187
kfree(res);
176188
fail_device:

drivers/regulator/88pm800.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,14 @@ struct pm800_regulators {
141141

142142
/* Ranges are sorted in ascending order. */
143143
static const struct regulator_linear_range buck1_volt_range[] = {
144-
{ .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f,
145-
.uV_step = 12500 },
146-
{ .min_uV = 1600000, .max_uV = 1800000, .min_sel = 0x50,
147-
.max_sel = 0x54, .uV_step = 50000 },
144+
REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
145+
REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000),
148146
};
149147

150148
/* BUCK 2~5 have same ranges. */
151149
static const struct regulator_linear_range buck2_5_volt_range[] = {
152-
{ .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f,
153-
.uV_step = 12500 },
154-
{ .min_uV = 1600000, .max_uV = 3300000, .min_sel = 0x50,
155-
.max_sel = 0x72, .uV_step = 50000 },
150+
REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
151+
REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000),
156152
};
157153

158154
static const unsigned int ldo1_volt_table[] = {

drivers/regulator/88pm8607.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ static int pm8607_regulator_probe(struct platform_device *pdev)
391391
else
392392
config.regmap = chip->regmap_companion;
393393

394-
info->regulator = regulator_register(&info->desc, &config);
394+
info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
395+
&config);
395396
if (IS_ERR(info->regulator)) {
396397
dev_err(&pdev->dev, "failed to register regulator %s\n",
397398
info->desc.name);
@@ -402,14 +403,6 @@ static int pm8607_regulator_probe(struct platform_device *pdev)
402403
return 0;
403404
}
404405

405-
static int pm8607_regulator_remove(struct platform_device *pdev)
406-
{
407-
struct pm8607_regulator_info *info = platform_get_drvdata(pdev);
408-
409-
regulator_unregister(info->regulator);
410-
return 0;
411-
}
412-
413406
static struct platform_device_id pm8607_regulator_driver_ids[] = {
414407
{
415408
.name = "88pm860x-regulator",
@@ -428,7 +421,6 @@ static struct platform_driver pm8607_regulator_driver = {
428421
.owner = THIS_MODULE,
429422
},
430423
.probe = pm8607_regulator_probe,
431-
.remove = pm8607_regulator_remove,
432424
.id_table = pm8607_regulator_driver_ids,
433425
};
434426

0 commit comments

Comments
 (0)