diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-09-12 08:28:35 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-26 06:17:57 -0400 |
commit | 937433c2502f663e5a0e8804462bc38c41b9021f (patch) | |
tree | eabeb3e2461d5d22dae50bddad274265c2350415 | |
parent | 4a10c2ac2f368583138b774ca41fac4207911983 (diff) |
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>
-rw-r--r-- | Documentation/devicetree/bindings/regulator/da9210.txt | 21 | ||||
-rw-r--r-- | drivers/regulator/da9210-regulator.c | 9 |
2 files changed, 27 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/regulator/da9210.txt b/Documentation/devicetree/bindings/regulator/da9210.txt new file mode 100644 index 000000000000..f120f229d67d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/da9210.txt | |||
@@ -0,0 +1,21 @@ | |||
1 | * Dialog Semiconductor DA9210 Voltage Regulator | ||
2 | |||
3 | Required properties: | ||
4 | |||
5 | - compatible: must be "diasemi,da9210" | ||
6 | - reg: the i2c slave address of the regulator. It should be 0x68. | ||
7 | |||
8 | Any standard regulator properties can be used to configure the single da9210 | ||
9 | DCDC. | ||
10 | |||
11 | Example: | ||
12 | |||
13 | da9210@68 { | ||
14 | compatible = "diasemi,da9210"; | ||
15 | reg = <0x68>; | ||
16 | |||
17 | regulator-min-microvolt = <900000>; | ||
18 | regulator-max-microvolt = <1000000>; | ||
19 | regulator-boot-on; | ||
20 | regulator-always-on; | ||
21 | }; | ||
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index f0fe54b38977..f7ccff14f763 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/regulator/driver.h> | 26 | #include <linux/regulator/driver.h> |
27 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
28 | #include <linux/regulator/of_regulator.h> | ||
28 | #include <linux/regmap.h> | 29 | #include <linux/regmap.h> |
29 | 30 | ||
30 | #include "da9210-regulator.h" | 31 | #include "da9210-regulator.h" |
@@ -126,7 +127,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
126 | const struct i2c_device_id *id) | 127 | const struct i2c_device_id *id) |
127 | { | 128 | { |
128 | struct da9210 *chip; | 129 | struct da9210 *chip; |
129 | struct da9210_pdata *pdata = i2c->dev.platform_data; | 130 | struct device *dev = &i2c->dev; |
131 | struct da9210_pdata *pdata = dev_get_platdata(dev); | ||
130 | struct regulator_dev *rdev = NULL; | 132 | struct regulator_dev *rdev = NULL; |
131 | struct regulator_config config = { }; | 133 | struct regulator_config config = { }; |
132 | int error; | 134 | int error; |
@@ -147,10 +149,11 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
147 | } | 149 | } |
148 | 150 | ||
149 | config.dev = &i2c->dev; | 151 | config.dev = &i2c->dev; |
150 | if (pdata) | 152 | config.init_data = pdata ? &pdata->da9210_constraints : |
151 | config.init_data = &pdata->da9210_constraints; | 153 | of_get_regulator_init_data(dev, dev->of_node); |
152 | config.driver_data = chip; | 154 | config.driver_data = chip; |
153 | config.regmap = chip->regmap; | 155 | config.regmap = chip->regmap; |
156 | config.of_node = dev->of_node; | ||
154 | 157 | ||
155 | rdev = regulator_register(&da9210_reg, &config); | 158 | rdev = regulator_register(&da9210_reg, &config); |
156 | if (IS_ERR(rdev)) { | 159 | if (IS_ERR(rdev)) { |