提交 2d0cf04c 编写于 作者: S Steve Twiss 提交者: Mark Brown

regulator: da9210: addition of device tree support

Addition of device tree support for DA9210.
Two files are modified, the driver source file and the binding document.

Updates for the regulator source file include an .of_match_table entry and
node match checking in the probe() function for a compatible da9210 string.

Minor binding documentation changes have been made to the title and the
example.
Tested-by: NSteve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: NSteve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 1a695a90
* Dialog Semiconductor DA9210 Voltage Regulator * Dialog Semiconductor DA9210 Multi-phase 12A DCDC BUCK Converter
Required properties: Required properties:
...@@ -18,8 +18,12 @@ Example: ...@@ -18,8 +18,12 @@ Example:
compatible = "dlg,da9210"; compatible = "dlg,da9210";
reg = <0x68>; reg = <0x68>;
regulator-min-microvolt = <900000>; interrupt-parent = <...>;
regulator-max-microvolt = <1000000>; interrupts = <...>;
regulator-min-microvolt = <300000>;
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <1600000>;
regulator-max-microamp = <4600000>;
regulator-boot-on; regulator-boot-on;
regulator-always-on;
}; };
...@@ -21,12 +21,11 @@ ...@@ -21,12 +21,11 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.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/of_device.h>
#include <linux/regulator/of_regulator.h> #include <linux/regulator/of_regulator.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -179,6 +178,13 @@ static irqreturn_t da9210_irq_handler(int irq, void *data) ...@@ -179,6 +178,13 @@ static irqreturn_t da9210_irq_handler(int irq, void *data)
/* /*
* I2C driver interface functions * I2C driver interface functions
*/ */
static const struct of_device_id da9210_dt_ids[] = {
{ .compatible = "dlg,da9210", },
{ }
};
MODULE_DEVICE_TABLE(of, da9210_dt_ids);
static int da9210_i2c_probe(struct i2c_client *i2c, static int da9210_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -188,6 +194,16 @@ static int da9210_i2c_probe(struct i2c_client *i2c, ...@@ -188,6 +194,16 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
struct regulator_dev *rdev = NULL; struct regulator_dev *rdev = NULL;
struct regulator_config config = { }; struct regulator_config config = { };
int error; int error;
const struct of_device_id *match;
if (i2c->dev.of_node && !pdata) {
match = of_match_device(of_match_ptr(da9210_dt_ids),
&i2c->dev);
if (!match) {
dev_err(&i2c->dev, "Error: No device match found\n");
return -ENODEV;
}
}
chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL);
if (!chip) if (!chip)
...@@ -264,6 +280,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id); ...@@ -264,6 +280,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id);
static struct i2c_driver da9210_regulator_driver = { static struct i2c_driver da9210_regulator_driver = {
.driver = { .driver = {
.name = "da9210", .name = "da9210",
.of_match_table = of_match_ptr(da9210_dt_ids),
}, },
.probe = da9210_i2c_probe, .probe = da9210_i2c_probe,
.id_table = da9210_i2c_id, .id_table = da9210_i2c_id,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册