diff options
-rw-r--r-- | Documentation/devicetree/bindings/regulator/da9210.txt | 12 | ||||
-rw-r--r-- | drivers/regulator/da9210-regulator.c | 21 |
2 files changed, 27 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/regulator/da9210.txt b/Documentation/devicetree/bindings/regulator/da9210.txt index 7aa9b1fa6b21..58065ca9e3b4 100644 --- a/Documentation/devicetree/bindings/regulator/da9210.txt +++ b/Documentation/devicetree/bindings/regulator/da9210.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | * Dialog Semiconductor DA9210 Voltage Regulator | 1 | * Dialog Semiconductor DA9210 Multi-phase 12A DCDC BUCK Converter |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | 4 | ||
@@ -18,8 +18,12 @@ Example: | |||
18 | compatible = "dlg,da9210"; | 18 | compatible = "dlg,da9210"; |
19 | reg = <0x68>; | 19 | reg = <0x68>; |
20 | 20 | ||
21 | regulator-min-microvolt = <900000>; | 21 | interrupt-parent = <...>; |
22 | regulator-max-microvolt = <1000000>; | 22 | interrupts = <...>; |
23 | |||
24 | regulator-min-microvolt = <300000>; | ||
25 | regulator-max-microvolt = <1570000>; | ||
26 | regulator-min-microamp = <1600000>; | ||
27 | regulator-max-microamp = <4600000>; | ||
23 | regulator-boot-on; | 28 | regulator-boot-on; |
24 | regulator-always-on; | ||
25 | }; | 29 | }; |
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index 01c0e3709b66..d0496d6b0934 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
@@ -21,12 +21,11 @@ | |||
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/i2c.h> | 22 | #include <linux/i2c.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/init.h> | ||
25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
26 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/regulator/driver.h> | 26 | #include <linux/regulator/driver.h> |
29 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
28 | #include <linux/of_device.h> | ||
30 | #include <linux/regulator/of_regulator.h> | 29 | #include <linux/regulator/of_regulator.h> |
31 | #include <linux/regmap.h> | 30 | #include <linux/regmap.h> |
32 | 31 | ||
@@ -179,6 +178,13 @@ error_i2c: | |||
179 | /* | 178 | /* |
180 | * I2C driver interface functions | 179 | * I2C driver interface functions |
181 | */ | 180 | */ |
181 | |||
182 | static const struct of_device_id da9210_dt_ids[] = { | ||
183 | { .compatible = "dlg,da9210", }, | ||
184 | { } | ||
185 | }; | ||
186 | MODULE_DEVICE_TABLE(of, da9210_dt_ids); | ||
187 | |||
182 | static int da9210_i2c_probe(struct i2c_client *i2c, | 188 | static int da9210_i2c_probe(struct i2c_client *i2c, |
183 | const struct i2c_device_id *id) | 189 | const struct i2c_device_id *id) |
184 | { | 190 | { |
@@ -188,6 +194,16 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
188 | struct regulator_dev *rdev = NULL; | 194 | struct regulator_dev *rdev = NULL; |
189 | struct regulator_config config = { }; | 195 | struct regulator_config config = { }; |
190 | int error; | 196 | int error; |
197 | const struct of_device_id *match; | ||
198 | |||
199 | if (i2c->dev.of_node && !pdata) { | ||
200 | match = of_match_device(of_match_ptr(da9210_dt_ids), | ||
201 | &i2c->dev); | ||
202 | if (!match) { | ||
203 | dev_err(&i2c->dev, "Error: No device match found\n"); | ||
204 | return -ENODEV; | ||
205 | } | ||
206 | } | ||
191 | 207 | ||
192 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); | 208 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); |
193 | if (!chip) | 209 | if (!chip) |
@@ -264,6 +280,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id); | |||
264 | static struct i2c_driver da9210_regulator_driver = { | 280 | static struct i2c_driver da9210_regulator_driver = { |
265 | .driver = { | 281 | .driver = { |
266 | .name = "da9210", | 282 | .name = "da9210", |
283 | .of_match_table = of_match_ptr(da9210_dt_ids), | ||
267 | }, | 284 | }, |
268 | .probe = da9210_i2c_probe, | 285 | .probe = da9210_i2c_probe, |
269 | .id_table = da9210_i2c_id, | 286 | .id_table = da9210_i2c_id, |