Skip to content

Commit

Permalink
Merge remote-tracking branches 'regulator/fix/pfuze100', 'regulator/f…
Browse files Browse the repository at this point in the history
…ix/s5m8767', 'regulator/topic/ab8500', 'regulator/topic/act8865', 'regulator/topic/anatop', 'regulator/topic/arizona' and 'regulator/topic/as3722' into regulator-linus
  • Loading branch information
Mark Brown committed Jan 23, 2014
8 parents 7cd9484 + f269438 + 2243cb4 + baafdc1 + a8659ba + 06e57b6 + 71979aa + fb04f1b commit 849e151
Show file tree
Hide file tree
Showing 13 changed files with 537 additions and 191 deletions.
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
8 changes: 8 additions & 0 deletions 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
1 change: 1 addition & 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 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 849e151

Please sign in to comment.