Skip to content

Commit

Permalink
Merge tag 'regulator-v3.13' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/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
  ...
  • Loading branch information
Linus Torvalds committed Nov 12, 2013
2 parents 4fc9ed3 + d4d5cef commit c6d65bf
Show file tree
Hide file tree
Showing 83 changed files with 2,582 additions and 1,519 deletions.
91 changes: 91 additions & 0 deletions Documentation/devicetree/bindings/regulator/as3722-regulator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Regulator of AMS AS3722 PMIC.
Name of the regulator subnode must be "regulators".

Optional properties:
--------------------
The input supply of regulators are the optional properties on the
regulator node. The AS3722 is having 7 DCDC step-down regulators as
sd[0-6], 10 LDOs as ldo[0-7], ldo[9-11]. The input supply of these
regulators are provided through following properties:
vsup-sd2-supply: Input supply for SD2.
vsup-sd3-supply: Input supply for SD3.
vsup-sd4-supply: Input supply for SD4.
vsup-sd5-supply: Input supply for SD5.
vin-ldo0-supply: Input supply for LDO0.
vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
vin-ldo11-supply: Input supply for LDO11.

Optional nodes:
--------------
- regulators : Must contain a sub-node per regulator from the list below.
Each sub-node should contain the constraints and initialization
information for that regulator. See regulator.txt for a
description of standard properties for these sub-nodes.
Additional custom properties are listed below.
sd[0-6], ldo[0-7], ldo[9-11].

Optional sub-node properties:
----------------------------
ams,ext-control: External control of the rail. The option of
this properties will tell which external input is
controlling this rail. Valid values are 0, 1, 2 ad 3.
0: There is no external control of this rail.
1: Rail is controlled by ENABLE1 input pin.
2: Rail is controlled by ENABLE2 input pin.
3: Rail is controlled by ENABLE3 input pin.
ams,enable-tracking: Enable tracking with SD1, only supported
by LDO3.

Example:
-------
ams3722: ams3722 {
compatible = "ams,as3722";
reg = <0x40>;
...

regulators {
vsup-sd2-supply = <...>;
...

sd0 {
regulator-name = "vdd_cpu";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1400000>;
regulator-always-on;
ams,ext-control = <2>;
};

sd1 {
regulator-name = "vdd_core";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1400000>;
regulator-always-on;
ams,ext-control = <1>;
};

sd2 {
regulator-name = "vddio_ddr";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
};

sd4 {
regulator-name = "avdd-hdmi-pex";
regulator-min-microvolt = <1050000>;
regulator-max-microvolt = <1050000>;
regulator-always-on;
};

sd5 {
regulator-name = "vdd-1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
....
};
};
21 changes: 21 additions & 0 deletions Documentation/devicetree/bindings/regulator/da9210.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
* Dialog Semiconductor DA9210 Voltage Regulator

Required properties:

- compatible: must be "diasemi,da9210"
- reg: the i2c slave address of the regulator. It should be 0x68.

Any standard regulator properties can be used to configure the single da9210
DCDC.

Example:

da9210@68 {
compatible = "diasemi,da9210";
reg = <0x68>;

regulator-min-microvolt = <900000>;
regulator-max-microvolt = <1000000>;
regulator-boot-on;
regulator-always-on;
};
12 changes: 9 additions & 3 deletions Documentation/devicetree/bindings/regulator/palmas-pmic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ Optional nodes:

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

Optional sub-node properties:
ti,warm-reset - maintain voltage during warm reset(boolean)
ti,roof-floor - control voltage selection by pin(boolean)
ti,roof-floor - This takes as optional argument on platform supporting
the rail from desired external control. If there is no argument then
it will be assume that it is controlled by NSLEEP pin.
The valid value for external pins are:
ENABLE1 then 1,
ENABLE2 then 2 or
NSLEEP then 3.
ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto,
2 - eco, 3 - forced pwm
ti,smps-range - OTP has the wrong range set for the hardware so override
Expand Down Expand Up @@ -61,7 +67,7 @@ pmic {
regulator-always-on;
regulator-boot-on;
ti,warm-reset;
ti,roof-floor;
ti,roof-floor = <1>; /* ENABLE1 control */
ti,mode-sleep = <0>;
ti,smps-range = <1>;
};
Expand Down
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/regulator/regulator.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Optional properties:
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
For hardwares which support disabling ramp rate, it should be explicitly
intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
rail to reach the target voltage, plus/minus whatever tolerance the board
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.

Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
Expand Down
1 change: 1 addition & 0 deletions Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ REGULATOR
devm_regulator_get()
devm_regulator_put()
devm_regulator_bulk_get()
devm_regulator_register()

CLOCK
devm_clk_get()
Expand Down
12 changes: 0 additions & 12 deletions arch/arm/mach-s3c64xx/mach-crag6410.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {

REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
REGULATOR_SUPPLY("SPKVDDL", "wm5102-codec"),
REGULATOR_SUPPLY("SPKVDDR", "wm5102-codec"),
REGULATOR_SUPPLY("SPKVDDL", "wm5110-codec"),
REGULATOR_SUPPLY("SPKVDDR", "wm5110-codec"),

REGULATOR_SUPPLY("DC1VDD", "0-0034"),
REGULATOR_SUPPLY("DC2VDD", "0-0034"),
Expand Down Expand Up @@ -653,14 +649,6 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
REGULATOR_SUPPLY("CPVDD", "spi0.1"),

REGULATOR_SUPPLY("DBVDD2", "wm5102-codec"),
REGULATOR_SUPPLY("DBVDD3", "wm5102-codec"),
REGULATOR_SUPPLY("CPVDD", "wm5102-codec"),

REGULATOR_SUPPLY("DBVDD2", "wm5110-codec"),
REGULATOR_SUPPLY("DBVDD3", "wm5110-codec"),
REGULATOR_SUPPLY("CPVDD", "wm5110-codec"),
};

static struct regulator_init_data pvdd_1v8 = {
Expand Down
32 changes: 29 additions & 3 deletions drivers/mfd/arizona-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,25 @@ static struct mfd_cell early_devs[] = {
{ .name = "arizona-ldo1" },
};

static const char *wm5102_supplies[] = {
"DBVDD2",
"DBVDD3",
"CPVDD",
"SPKVDDL",
"SPKVDDR",
};

static struct mfd_cell wm5102_devs[] = {
{ .name = "arizona-micsupp" },
{ .name = "arizona-extcon" },
{ .name = "arizona-gpio" },
{ .name = "arizona-haptics" },
{ .name = "arizona-pwm" },
{ .name = "wm5102-codec" },
{
.name = "wm5102-codec",
.parent_supplies = wm5102_supplies,
.num_parent_supplies = ARRAY_SIZE(wm5102_supplies),
},
};

static struct mfd_cell wm5110_devs[] = {
Expand All @@ -584,7 +596,17 @@ static struct mfd_cell wm5110_devs[] = {
{ .name = "arizona-gpio" },
{ .name = "arizona-haptics" },
{ .name = "arizona-pwm" },
{ .name = "wm5110-codec" },
{
.name = "wm5110-codec",
.parent_supplies = wm5102_supplies,
.num_parent_supplies = ARRAY_SIZE(wm5102_supplies),
},
};

static const char *wm8997_supplies[] = {
"DBVDD2",
"CPVDD",
"SPKVDD",
};

static struct mfd_cell wm8997_devs[] = {
Expand All @@ -593,7 +615,11 @@ static struct mfd_cell wm8997_devs[] = {
{ .name = "arizona-gpio" },
{ .name = "arizona-haptics" },
{ .name = "arizona-pwm" },
{ .name = "wm8997-codec" },
{
.name = "wm8997-codec",
.parent_supplies = wm8997_supplies,
.num_parent_supplies = ARRAY_SIZE(wm8997_supplies),
},
};

int arizona_dev_init(struct arizona *arizona)
Expand Down
22 changes: 17 additions & 5 deletions drivers/mfd/mfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/regulator/consumer.h>

static struct device_type mfd_dev_type = {
.name = "mfd_device",
Expand Down Expand Up @@ -99,6 +100,13 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.dma_mask = parent->dma_mask;
pdev->dev.dma_parms = parent->dma_parms;

ret = devm_regulator_bulk_register_supply_alias(
&pdev->dev, cell->parent_supplies,
parent, cell->parent_supplies,
cell->num_parent_supplies);
if (ret < 0)
goto fail_res;

if (parent->of_node && cell->of_compatible) {
for_each_child_of_node(parent->of_node, np) {
if (of_device_is_compatible(np, cell->of_compatible)) {
Expand All @@ -112,12 +120,12 @@ static int mfd_add_device(struct device *parent, int id,
ret = platform_device_add_data(pdev,
cell->platform_data, cell->pdata_size);
if (ret)
goto fail_res;
goto fail_alias;
}

ret = mfd_platform_add_cell(pdev, cell);
if (ret)
goto fail_res;
goto fail_alias;

for (r = 0; r < cell->num_resources; r++) {
res[r].name = cell->resources[r].name;
Expand Down Expand Up @@ -152,17 +160,17 @@ static int mfd_add_device(struct device *parent, int id,
if (!cell->ignore_resource_conflicts) {
ret = acpi_check_resource_conflict(&res[r]);
if (ret)
goto fail_res;
goto fail_alias;
}
}

ret = platform_device_add_resources(pdev, res, cell->num_resources);
if (ret)
goto fail_res;
goto fail_alias;

ret = platform_device_add(pdev);
if (ret)
goto fail_res;
goto fail_alias;

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

return 0;

fail_alias:
devm_regulator_bulk_unregister_supply_alias(&pdev->dev,
cell->parent_supplies,
cell->num_parent_supplies);
fail_res:
kfree(res);
fail_device:
Expand Down
12 changes: 4 additions & 8 deletions drivers/regulator/88pm800.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,14 @@ struct pm800_regulators {

/* Ranges are sorted in ascending order. */
static const struct regulator_linear_range buck1_volt_range[] = {
{ .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f,
.uV_step = 12500 },
{ .min_uV = 1600000, .max_uV = 1800000, .min_sel = 0x50,
.max_sel = 0x54, .uV_step = 50000 },
REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000),
};

/* BUCK 2~5 have same ranges. */
static const struct regulator_linear_range buck2_5_volt_range[] = {
{ .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f,
.uV_step = 12500 },
{ .min_uV = 1600000, .max_uV = 3300000, .min_sel = 0x50,
.max_sel = 0x72, .uV_step = 50000 },
REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000),
};

static const unsigned int ldo1_volt_table[] = {
Expand Down
12 changes: 2 additions & 10 deletions drivers/regulator/88pm8607.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ static int pm8607_regulator_probe(struct platform_device *pdev)
else
config.regmap = chip->regmap_companion;

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

static int pm8607_regulator_remove(struct platform_device *pdev)
{
struct pm8607_regulator_info *info = platform_get_drvdata(pdev);

regulator_unregister(info->regulator);
return 0;
}

static struct platform_device_id pm8607_regulator_driver_ids[] = {
{
.name = "88pm860x-regulator",
Expand All @@ -428,7 +421,6 @@ static struct platform_driver pm8607_regulator_driver = {
.owner = THIS_MODULE,
},
.probe = pm8607_regulator_probe,
.remove = pm8607_regulator_remove,
.id_table = pm8607_regulator_driver_ids,
};

Expand Down
Loading

0 comments on commit c6d65bf

Please sign in to comment.