diff mbox

[2/2] regulator: da9210: add Device Tree support

Message ID 1378741920-11085-3-git-send-email-g.liakhovetski@gmx.de (mailing list archive)
State Changes Requested
Headers show

Commit Message

Guennadi Liakhovetski Sept. 9, 2013, 3:52 p.m. UTC
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>
---
 drivers/regulator/da9210-regulator.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Comments

Mark Brown Sept. 9, 2013, 4:04 p.m. UTC | #1
On Mon, Sep 09, 2013 at 05:52:00PM +0200, Guennadi Liakhovetski wrote:
> 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>
> ---
>  drivers/regulator/da9210-regulator.c |    9 ++++++---

I'd expect to see a binding document, even if it is just a very brief
one documenting the prefix and pointing to the standard regulator
properties.
diff mbox

Patch

diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c
index f0fe54b..f7ccff14 100644
--- a/drivers/regulator/da9210-regulator.c
+++ b/drivers/regulator/da9210-regulator.c
@@ -25,6 +25,7 @@ 
 #include <linux/slab.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/of_regulator.h>
 #include <linux/regmap.h>
 
 #include "da9210-regulator.h"
@@ -126,7 +127,8 @@  static int da9210_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
 	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_config config = { };
 	int error;
@@ -147,10 +149,11 @@  static int da9210_i2c_probe(struct i2c_client *i2c,
 	}
 
 	config.dev = &i2c->dev;
-	if (pdata)
-		config.init_data = &pdata->da9210_constraints;
+	config.init_data = pdata ? &pdata->da9210_constraints :
+		of_get_regulator_init_data(dev, dev->of_node);
 	config.driver_data = chip;
 	config.regmap = chip->regmap;
+	config.of_node = dev->of_node;
 
 	rdev = regulator_register(&da9210_reg, &config);
 	if (IS_ERR(rdev)) {