regulator: da9210: add Device Tree support

This patch adds basic Device Tree support to the da9210 regulator driver -
with no special properties, since also driver's platform data only contains
standard regulator initialisation parameters.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Guennadi Liakhovetski 2013-09-12 14:28:35 +02:00 committed by Mark Brown
parent 4a10c2ac2f
commit 937433c250
2 changed files with 27 additions and 3 deletions

View File

@ -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;
};

View File

@ -25,6 +25,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include "da9210-regulator.h" #include "da9210-regulator.h"
@ -126,7 +127,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct da9210 *chip; struct da9210 *chip;
struct da9210_pdata *pdata = i2c->dev.platform_data; struct device *dev = &i2c->dev;
struct da9210_pdata *pdata = dev_get_platdata(dev);
struct regulator_dev *rdev = NULL; struct regulator_dev *rdev = NULL;
struct regulator_config config = { }; struct regulator_config config = { };
int error; int error;
@ -147,10 +149,11 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
} }
config.dev = &i2c->dev; config.dev = &i2c->dev;
if (pdata) config.init_data = pdata ? &pdata->da9210_constraints :
config.init_data = &pdata->da9210_constraints; of_get_regulator_init_data(dev, dev->of_node);
config.driver_data = chip; config.driver_data = chip;
config.regmap = chip->regmap; config.regmap = chip->regmap;
config.of_node = dev->of_node;
rdev = regulator_register(&da9210_reg, &config); rdev = regulator_register(&da9210_reg, &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {