Skip to content

Commit

Permalink
Merge tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "A respin of the merges in the previous pull request with one extra
  fix.

  A quiet release for the regulator API, quite a large number of small
  improvements all over but other than the addition of new drivers for
  the AS3722 and MAX14577 there is nothing of substantial non-local
  impact"

* tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (47 commits)
  regulator: pfuze100-regulator: Improve dev_info() message
  regulator: pfuze100-regulator: Fix some checkpatch complaints
  regulator: twl: Fix checkpatch issue
  regulator: core: Fix checkpatch issue
  regulator: anatop-regulator: Remove unneeded memset()
  regulator: s5m8767: Update LDO index in s5m8767-regulator.txt
  regulator: as3722: set enable time for SD0/1/6
  regulator: as3722: detect SD0 low-voltage mode
  regulator: tps62360: Fix up a pointer-integer size mismatch warning
  regulator: anatop-regulator: Remove unneeded kstrdup()
  regulator: act8865: Fix build error when !OF
  regulator: act8865: register all regulators regardless of how many are used
  regulator: wm831x-dcdc: Remove unneeded 'err' label
  regulator: anatop-regulator: Add MODULE_ALIAS()
  regulator: act8865: fix incorrect devm_kzalloc for act8865
  regulator: act8865: Remove set_suspend_[en|dis]able implementation
  regulator: act8865: Remove unneeded regulator_unregister() calls
  regulator: s2mps11: Clean up redundant code
  regulator: tps65910: Simplify setting enable_mask for regulators
  regulator: act8865: add device tree binding doc
  ...
  • Loading branch information
Linus Torvalds committed Jan 25, 2014
2 parents bb1b649 + 07b1980 commit 1533353
Show file tree
Hide file tree
Showing 36 changed files with 1,017 additions and 460 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/mfd/tps65910.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Required properties:

The valid regulator-compatible values are:
tps65910: vrtc, vio, vdd1, vdd2, vdd3, vdig1, vdig2, vpll, vdac, vaux1,
vaux2, vaux33, vmmc
vaux2, vaux33, vmmc, vbb
tps65911: vrtc, vio, vdd1, vdd3, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
ldo6, ldo7, ldo8

Expand All @@ -38,7 +38,7 @@ Required properties:
vcc4-supply: VAUX1 and VAUX2 input.
vcc5-supply: VPLL and VDAC input.
vcc6-supply: VDIG1 and VDIG2 input.
vcc7-supply: VRTC input.
vcc7-supply: VRTC and VBB input.
vccio-supply: VIO input.
tps65911:
vcc1-supply: VDD1 input.
Expand Down
60 changes: 60 additions & 0 deletions Documentation/devicetree/bindings/regulator/act8865-regulator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ACT8865 regulator
-------------------

Required properties:
- compatible: "active-semi,act8865"
- reg: I2C slave address

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

The valid names for regulators are:
DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4.

Example:
--------

i2c1: i2c@f0018000 {
pmic: act8865@5b {
compatible = "active-semi,act8865";
reg = <0x5b>;
status = "disabled";

regulators {
vcc_1v8_reg: DCDC_REG1 {
regulator-name = "VCC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};

vcc_1v2_reg: DCDC_REG2 {
regulator-name = "VCC_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-suspend-mem-microvolt = <1150000>;
regulator-suspend-standby-microvolt = <1150000>;
regulator-always-on;
};

vcc_3v3_reg: DCDC_REG3 {
regulator-name = "VCC_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};

vddana_reg: LDO_REG1 {
regulator-name = "VDDANA";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};

vddfuse_reg: LDO_REG2 {
regulator-name = "FUSE_2V5";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
};
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ as per the datasheet of s5m8767.

- LDOn
- valid values for n are 1 to 28
- Example: LDO0, LD01, LDO28
- Example: LDO1, LD02, LDO28
- BUCKn
- valid values for n are 1 to 9.
- Example: BUCK1, BUCK2, BUCK9
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order.
This isn't an exhaustive list, but you should add new prefixes to it before
using them to avoid name-space collisions.

active-semi Active-Semi International Inc
ad Avionic Design GmbH
adi Analog Devices, Inc.
aeroflexgaisler Aeroflex Gaisler AB
Expand Down
2 changes: 1 addition & 1 deletion drivers/mfd/pcf50633-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static int pcf50633_probe(struct i2c_client *client,
for (i = 0; i < PCF50633_NUM_REGULATORS; i++) {
struct platform_device *pdev;

pdev = platform_device_alloc("pcf50633-regltr", i);
pdev = platform_device_alloc("pcf50633-regulator", i);
if (!pdev) {
dev_err(pcf->dev, "Cannot create regulator %d\n", i);
continue;
Expand Down
30 changes: 0 additions & 30 deletions drivers/mfd/sec-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,6 @@ static struct of_device_id sec_dt_match[] = {
};
#endif

int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
{
return regmap_read(sec_pmic->regmap_pmic, reg, dest);
}
EXPORT_SYMBOL_GPL(sec_reg_read);

int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{
return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count);
}
EXPORT_SYMBOL_GPL(sec_bulk_read);

int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
{
return regmap_write(sec_pmic->regmap_pmic, reg, value);
}
EXPORT_SYMBOL_GPL(sec_reg_write);

int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{
return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count);
}
EXPORT_SYMBOL_GPL(sec_bulk_write);

int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
{
return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val);
}
EXPORT_SYMBOL_GPL(sec_reg_update);

static bool s2mps11_volatile(struct device *dev, unsigned int reg)
{
switch (reg) {
Expand Down
17 changes: 16 additions & 1 deletion drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ config REGULATOR_88PM8607
help
This driver supports 88PM8607 voltage regulator chips.

config REGULATOR_ACT8865
tristate "Active-semi act8865 voltage regulator"
depends on I2C
select REGMAP_I2C
help
This driver controls a active-semi act8865 voltage output
regulator via I2C bus.

config REGULATOR_AD5398
tristate "Analog Devices AD5398/AD5821 regulators"
depends on I2C
Expand Down Expand Up @@ -249,6 +257,13 @@ config REGULATOR_LP8788
help
This driver supports LP8788 voltage regulator chip.

config REGULATOR_MAX14577
tristate "Maxim 14577 regulator"
depends on MFD_MAX14577
help
This driver controls a Maxim 14577 regulator via I2C bus.
The regulators include safeout LDO and current regulator 'CHARGER'.

config REGULATOR_MAX1586
tristate "Maxim 1586/1587 voltage regulator"
depends on I2C
Expand Down Expand Up @@ -384,7 +399,7 @@ config REGULATOR_PCF50633
on PCF50633

config REGULATOR_PFUZE100
tristate "Support regulators on Freescale PFUZE100 PMIC"
tristate "Freescale PFUZE100 regulator driver"
depends on I2C
select REGMAP_I2C
help
Expand Down
2 changes: 2 additions & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o
obj-$(CONFIG_REGULATOR_ACT8865) += act8865-regulator.o
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
Expand All @@ -35,6 +36,7 @@ obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
obj-$(CONFIG_REGULATOR_MAX14577) += max14577.o
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o
obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
Expand Down
126 changes: 12 additions & 114 deletions drivers/regulator/ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -2998,45 +2998,13 @@ static void abx500_get_regulator_info(struct ab8500 *ab8500)
}
}

static int ab8500_regulator_init_registers(struct platform_device *pdev,
int id, int mask, int value)
{
struct ab8500_reg_init *reg_init = abx500_regulator.init;
int err;

BUG_ON(value & ~mask);
BUG_ON(mask & ~reg_init[id].mask);

/* initialize register */
err = abx500_mask_and_set_register_interruptible(
&pdev->dev,
reg_init[id].bank,
reg_init[id].addr,
mask, value);
if (err < 0) {
dev_err(&pdev->dev,
"Failed to initialize 0x%02x, 0x%02x.\n",
reg_init[id].bank,
reg_init[id].addr);
return err;
}
dev_vdbg(&pdev->dev,
" init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
reg_init[id].bank,
reg_init[id].addr,
mask, value);

return 0;
}

static int ab8500_regulator_register(struct platform_device *pdev,
struct regulator_init_data *init_data,
int id, struct device_node *np)
{
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
struct ab8500_regulator_info *info = NULL;
struct regulator_config config = { };
int err;

/* assign per-regulator data */
info = &abx500_regulator.info[id];
Expand All @@ -3058,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev,
}

/* register regulator with framework */
info->regulator = regulator_register(&info->desc, &config);
info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
&config);
if (IS_ERR(info->regulator)) {
err = PTR_ERR(info->regulator);
dev_err(&pdev->dev, "failed to register regulator %s\n",
info->desc.name);
/* when we fail, un-register all earlier regulators */
while (--id >= 0) {
info = &abx500_regulator.info[id];
regulator_unregister(info->regulator);
}
return err;
return PTR_ERR(info->regulator);
}

return 0;
Expand All @@ -3095,9 +3058,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
{
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
struct device_node *np = pdev->dev.of_node;
struct ab8500_platform_data *ppdata;
struct ab8500_regulator_platform_data *pdata;
int i, err;
int err;

if (!ab8500) {
dev_err(&pdev->dev, "null mfd parent\n");
Expand All @@ -3106,83 +3067,20 @@ static int ab8500_regulator_probe(struct platform_device *pdev)

abx500_get_regulator_info(ab8500);

if (np) {
err = of_regulator_match(&pdev->dev, np,
abx500_regulator.match,
abx500_regulator.match_size);
if (err < 0) {
dev_err(&pdev->dev,
"Error parsing regulator init data: %d\n", err);
return err;
}

err = ab8500_regulator_of_probe(pdev, np);
return err;
}

ppdata = dev_get_platdata(ab8500->dev);
if (!ppdata) {
dev_err(&pdev->dev, "null parent pdata\n");
return -EINVAL;
}

pdata = ppdata->regulator;
if (!pdata) {
dev_err(&pdev->dev, "null pdata\n");
return -EINVAL;
}

/* make sure the platform data has the correct size */
if (pdata->num_regulator != abx500_regulator.info_size) {
dev_err(&pdev->dev, "Configuration error: size mismatch.\n");
return -EINVAL;
}

/* initialize debug (initial state is recorded with this call) */
err = ab8500_regulator_debug_init(pdev);
if (err)
err = of_regulator_match(&pdev->dev, np,
abx500_regulator.match,
abx500_regulator.match_size);
if (err < 0) {
dev_err(&pdev->dev,
"Error parsing regulator init data: %d\n", err);
return err;

/* initialize registers */
for (i = 0; i < pdata->num_reg_init; i++) {
int id, mask, value;

id = pdata->reg_init[i].id;
mask = pdata->reg_init[i].mask;
value = pdata->reg_init[i].value;

/* check for configuration errors */
BUG_ON(id >= abx500_regulator.init_size);

err = ab8500_regulator_init_registers(pdev, id, mask, value);
if (err < 0)
return err;
}

/* register all regulators */
for (i = 0; i < abx500_regulator.info_size; i++) {
err = ab8500_regulator_register(pdev, &pdata->regulator[i],
i, NULL);
if (err < 0)
return err;
}

return 0;
return ab8500_regulator_of_probe(pdev, np);
}

static int ab8500_regulator_remove(struct platform_device *pdev)
{
int i, err;

for (i = 0; i < abx500_regulator.info_size; i++) {
struct ab8500_regulator_info *info = NULL;
info = &abx500_regulator.info[i];

dev_vdbg(rdev_get_dev(info->regulator),
"%s-remove\n", info->desc.name);

regulator_unregister(info->regulator);
}
int err;

/* remove regulator debug */
err = ab8500_regulator_debug_exit(pdev);
Expand Down
Loading

0 comments on commit 1533353

Please sign in to comment.