Skip to content

Commit

Permalink
Merge remote-tracking branches 'regulator/topic/db8500', 'regulator/t…
Browse files Browse the repository at this point in the history
…opic/gpio', 'regulator/topic/lp3971', 'regulator/topic/lp3972', 'regulator/topic/max14577', 'regulator/topic/max77693', 'regulator/topic/mc13892', 'regulator/topic/pcf50633' and 'regulator/topic/pfuze100' into regulator-linus
  • Loading branch information
Mark Brown committed Jan 23, 2014
10 parents 849e151 + 92dfbdb + 9eb9d31 + 56dde80 + 93227c8 + 9f45a3d + 52f48bf + c6a21f2 + 561427f + 62b3891 commit a2a2be6
Show file tree
Hide file tree
Showing 12 changed files with 333 additions and 139 deletions.
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
9 changes: 8 additions & 1 deletion drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -257,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 @@ -392,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
1 change: 1 addition & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,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
20 changes: 1 addition & 19 deletions drivers/regulator/db8500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,17 +431,11 @@ static int db8500_regulator_register(struct platform_device *pdev,
config.of_node = np;

/* register with the regulator framework */
info->rdev = regulator_register(&info->desc, &config);
info->rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
if (IS_ERR(info->rdev)) {
err = PTR_ERR(info->rdev);
dev_err(&pdev->dev, "failed to register %s: err %i\n",
info->desc.name, err);

/* if failing, unregister all earlier regulators */
while (--id >= 0) {
info = &dbx500_regulator_info[id];
regulator_unregister(info->rdev);
}
return err;
}

Expand Down Expand Up @@ -530,20 +524,8 @@ static int db8500_regulator_probe(struct platform_device *pdev)

static int db8500_regulator_remove(struct platform_device *pdev)
{
int i;

ux500_regulator_debug_exit();

for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
struct dbx500_regulator_info *info;
info = &dbx500_regulator_info[i];

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

regulator_unregister(info->rdev);
}

return 0;
}

Expand Down
17 changes: 9 additions & 8 deletions drivers/regulator/gpio-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,18 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
}
config->nr_states = i;

config->type = REGULATOR_VOLTAGE;
ret = of_property_read_string(np, "regulator-type", &regtype);
if (ret < 0) {
dev_err(dev, "Missing 'regulator-type' property\n");
return ERR_PTR(-EINVAL);
if (ret >= 0) {
if (!strncmp("voltage", regtype, 7))
config->type = REGULATOR_VOLTAGE;
else if (!strncmp("current", regtype, 7))
config->type = REGULATOR_CURRENT;
else
dev_warn(dev, "Unknown regulator-type '%s'\n",
regtype);
}

if (!strncmp("voltage", regtype, 7))
config->type = REGULATOR_VOLTAGE;
else if (!strncmp("current", regtype, 7))
config->type = REGULATOR_CURRENT;

return config;
}

Expand Down
43 changes: 6 additions & 37 deletions drivers/regulator/lp3971.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ struct lp3971 {
struct device *dev;
struct mutex io_lock;
struct i2c_client *i2c;
int num_regulators;
struct regulator_dev **rdev;
};

static u8 lp3971_reg_read(struct lp3971 *lp3971, u8 reg);
Expand Down Expand Up @@ -383,42 +381,27 @@ static int setup_regulators(struct lp3971 *lp3971,
{
int i, err;

lp3971->num_regulators = pdata->num_regulators;
lp3971->rdev = kcalloc(pdata->num_regulators,
sizeof(struct regulator_dev *), GFP_KERNEL);
if (!lp3971->rdev) {
err = -ENOMEM;
goto err_nomem;
}

/* Instantiate the regulators */
for (i = 0; i < pdata->num_regulators; i++) {
struct regulator_config config = { };
struct lp3971_regulator_subdev *reg = &pdata->regulators[i];
struct regulator_dev *rdev;

config.dev = lp3971->dev;
config.init_data = reg->initdata;
config.driver_data = lp3971;

lp3971->rdev[i] = regulator_register(&regulators[reg->id],
&config);
if (IS_ERR(lp3971->rdev[i])) {
err = PTR_ERR(lp3971->rdev[i]);
rdev = devm_regulator_register(lp3971->dev,
&regulators[reg->id], &config);
if (IS_ERR(rdev)) {
err = PTR_ERR(rdev);
dev_err(lp3971->dev, "regulator init failed: %d\n",
err);
goto error;
return err;
}
}

return 0;

error:
while (--i >= 0)
regulator_unregister(lp3971->rdev[i]);
kfree(lp3971->rdev);
lp3971->rdev = NULL;
err_nomem:
return err;
}

static int lp3971_i2c_probe(struct i2c_client *i2c,
Expand Down Expand Up @@ -460,19 +443,6 @@ static int lp3971_i2c_probe(struct i2c_client *i2c,
return 0;
}

static int lp3971_i2c_remove(struct i2c_client *i2c)
{
struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
int i;

for (i = 0; i < lp3971->num_regulators; i++)
regulator_unregister(lp3971->rdev[i]);

kfree(lp3971->rdev);

return 0;
}

static const struct i2c_device_id lp3971_i2c_id[] = {
{ "lp3971", 0 },
{ }
Expand All @@ -485,7 +455,6 @@ static struct i2c_driver lp3971_i2c_driver = {
.owner = THIS_MODULE,
},
.probe = lp3971_i2c_probe,
.remove = lp3971_i2c_remove,
.id_table = lp3971_i2c_id,
};

Expand Down
41 changes: 6 additions & 35 deletions drivers/regulator/lp3972.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ struct lp3972 {
struct device *dev;
struct mutex io_lock;
struct i2c_client *i2c;
int num_regulators;
struct regulator_dev **rdev;
};

/* LP3972 Control Registers */
Expand Down Expand Up @@ -478,41 +476,27 @@ static int setup_regulators(struct lp3972 *lp3972,
{
int i, err;

lp3972->num_regulators = pdata->num_regulators;
lp3972->rdev = kcalloc(pdata->num_regulators,
sizeof(struct regulator_dev *), GFP_KERNEL);
if (!lp3972->rdev) {
err = -ENOMEM;
goto err_nomem;
}

/* Instantiate the regulators */
for (i = 0; i < pdata->num_regulators; i++) {
struct lp3972_regulator_subdev *reg = &pdata->regulators[i];
struct regulator_config config = { };
struct regulator_dev *rdev;

config.dev = lp3972->dev;
config.init_data = reg->initdata;
config.driver_data = lp3972;

lp3972->rdev[i] = regulator_register(&regulators[reg->id],
&config);
if (IS_ERR(lp3972->rdev[i])) {
err = PTR_ERR(lp3972->rdev[i]);
rdev = devm_regulator_register(lp3972->dev,
&regulators[reg->id], &config);
if (IS_ERR(rdev)) {
err = PTR_ERR(rdev);
dev_err(lp3972->dev, "regulator init failed: %d\n",
err);
goto error;
return err;
}
}

return 0;
error:
while (--i >= 0)
regulator_unregister(lp3972->rdev[i]);
kfree(lp3972->rdev);
lp3972->rdev = NULL;
err_nomem:
return err;
}

static int lp3972_i2c_probe(struct i2c_client *i2c,
Expand Down Expand Up @@ -557,18 +541,6 @@ static int lp3972_i2c_probe(struct i2c_client *i2c,
return 0;
}

static int lp3972_i2c_remove(struct i2c_client *i2c)
{
struct lp3972 *lp3972 = i2c_get_clientdata(i2c);
int i;

for (i = 0; i < lp3972->num_regulators; i++)
regulator_unregister(lp3972->rdev[i]);
kfree(lp3972->rdev);

return 0;
}

static const struct i2c_device_id lp3972_i2c_id[] = {
{ "lp3972", 0 },
{ }
Expand All @@ -581,7 +553,6 @@ static struct i2c_driver lp3972_i2c_driver = {
.owner = THIS_MODULE,
},
.probe = lp3972_i2c_probe,
.remove = lp3972_i2c_remove,
.id_table = lp3972_i2c_id,
};

Expand Down
Loading

0 comments on commit a2a2be6

Please sign in to comment.