diff options
-rw-r--r-- | Documentation/devicetree/bindings/regulator/da9210.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/regulator/da9211.txt | 32 | ||||
-rw-r--r-- | drivers/regulator/Kconfig | 6 | ||||
-rw-r--r-- | drivers/regulator/core.c | 116 | ||||
-rw-r--r-- | drivers/regulator/da9210-regulator.c | 75 | ||||
-rw-r--r-- | drivers/regulator/da9211-regulator.c | 40 | ||||
-rw-r--r-- | drivers/regulator/da9211-regulator.h | 18 | ||||
-rw-r--r-- | drivers/regulator/fan53555.c | 1 | ||||
-rw-r--r-- | drivers/regulator/isl9305.c | 1 | ||||
-rw-r--r-- | include/linux/regulator/da9211.h | 19 |
10 files changed, 223 insertions, 89 deletions
diff --git a/Documentation/devicetree/bindings/regulator/da9210.txt b/Documentation/devicetree/bindings/regulator/da9210.txt index 3297c53cb915..7aa9b1fa6b21 100644 --- a/Documentation/devicetree/bindings/regulator/da9210.txt +++ b/Documentation/devicetree/bindings/regulator/da9210.txt | |||
@@ -5,6 +5,10 @@ Required properties: | |||
5 | - compatible: must be "dlg,da9210" | 5 | - compatible: must be "dlg,da9210" |
6 | - reg: the i2c slave address of the regulator. It should be 0x68. | 6 | - reg: the i2c slave address of the regulator. It should be 0x68. |
7 | 7 | ||
8 | Optional properties: | ||
9 | |||
10 | - interrupts: a reference to the DA9210 interrupt, if available. | ||
11 | |||
8 | Any standard regulator properties can be used to configure the single da9210 | 12 | Any standard regulator properties can be used to configure the single da9210 |
9 | DCDC. | 13 | DCDC. |
10 | 14 | ||
diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt index eb618907c7de..c620493e8dbe 100644 --- a/Documentation/devicetree/bindings/regulator/da9211.txt +++ b/Documentation/devicetree/bindings/regulator/da9211.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | * Dialog Semiconductor DA9211/DA9213 Voltage Regulator | 1 | * Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: "dlg,da9211" or "dlg,da9213". | 4 | - compatible: "dlg,da9211" or "dlg,da9213" or "dlg,da9215" |
5 | - reg: I2C slave address, usually 0x68. | 5 | - reg: I2C slave address, usually 0x68. |
6 | - interrupts: the interrupt outputs of the controller | 6 | - interrupts: the interrupt outputs of the controller |
7 | - regulators: A node that houses a sub-node for each regulator within the | 7 | - regulators: A node that houses a sub-node for each regulator within the |
@@ -66,3 +66,31 @@ Example 2) DA9213 | |||
66 | }; | 66 | }; |
67 | }; | 67 | }; |
68 | }; | 68 | }; |
69 | |||
70 | |||
71 | Example 3) DA9215 | ||
72 | pmic: da9215@68 { | ||
73 | compatible = "dlg,da9215"; | ||
74 | reg = <0x68>; | ||
75 | interrupts = <3 27>; | ||
76 | |||
77 | regulators { | ||
78 | BUCKA { | ||
79 | regulator-name = "VBUCKA"; | ||
80 | regulator-min-microvolt = < 300000>; | ||
81 | regulator-max-microvolt = <1570000>; | ||
82 | regulator-min-microamp = <4000000>; | ||
83 | regulator-max-microamp = <7000000>; | ||
84 | enable-gpios = <&gpio 27 0>; | ||
85 | }; | ||
86 | BUCKB { | ||
87 | regulator-name = "VBUCKB"; | ||
88 | regulator-min-microvolt = < 300000>; | ||
89 | regulator-max-microvolt = <1570000>; | ||
90 | regulator-min-microamp = <4000000>; | ||
91 | regulator-max-microamp = <7000000>; | ||
92 | enable-gpios = <&gpio 17 0>; | ||
93 | }; | ||
94 | }; | ||
95 | }; | ||
96 | |||
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index bef3bde6971b..23496da101de 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -209,13 +209,13 @@ config REGULATOR_DA9210 | |||
209 | interface. | 209 | interface. |
210 | 210 | ||
211 | config REGULATOR_DA9211 | 211 | config REGULATOR_DA9211 |
212 | tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214 regulator" | 212 | tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator" |
213 | depends on I2C | 213 | depends on I2C |
214 | select REGMAP_I2C | 214 | select REGMAP_I2C |
215 | help | 215 | help |
216 | Say y here to support for the Dialog Semiconductor DA9211/DA9212 | 216 | Say y here to support for the Dialog Semiconductor DA9211/DA9212 |
217 | /DA9213/DA9214. | 217 | /DA9213/DA9214/DA9215. |
218 | The DA9211/DA9212/DA9213/DA9214 is a multi-phase synchronous | 218 | The DA9211/DA9212/DA9213/DA9214/DA9215 is a multi-phase synchronous |
219 | step down converter 12A or 16A DC-DC Buck controlled through an I2C | 219 | step down converter 12A or 16A DC-DC Buck controlled through an I2C |
220 | interface. | 220 | interface. |
221 | 221 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 584cbbd38d47..4315476540c4 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -111,6 +111,11 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, | |||
111 | const char *supply_name); | 111 | const char *supply_name); |
112 | static void _regulator_put(struct regulator *regulator); | 112 | static void _regulator_put(struct regulator *regulator); |
113 | 113 | ||
114 | static struct regulator_dev *dev_to_rdev(struct device *dev) | ||
115 | { | ||
116 | return container_of(dev, struct regulator_dev, dev); | ||
117 | } | ||
118 | |||
114 | static const char *rdev_get_name(struct regulator_dev *rdev) | 119 | static const char *rdev_get_name(struct regulator_dev *rdev) |
115 | { | 120 | { |
116 | if (rdev->constraints && rdev->constraints->name) | 121 | if (rdev->constraints && rdev->constraints->name) |
@@ -1612,14 +1617,15 @@ static void _regulator_put(struct regulator *regulator) | |||
1612 | if (regulator->dev) | 1617 | if (regulator->dev) |
1613 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); | 1618 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); |
1614 | mutex_lock(&rdev->mutex); | 1619 | mutex_lock(&rdev->mutex); |
1615 | kfree(regulator->supply_name); | ||
1616 | list_del(®ulator->list); | 1620 | list_del(®ulator->list); |
1617 | kfree(regulator); | ||
1618 | 1621 | ||
1619 | rdev->open_count--; | 1622 | rdev->open_count--; |
1620 | rdev->exclusive = 0; | 1623 | rdev->exclusive = 0; |
1621 | mutex_unlock(&rdev->mutex); | 1624 | mutex_unlock(&rdev->mutex); |
1622 | 1625 | ||
1626 | kfree(regulator->supply_name); | ||
1627 | kfree(regulator); | ||
1628 | |||
1623 | module_put(rdev->owner); | 1629 | module_put(rdev->owner); |
1624 | } | 1630 | } |
1625 | 1631 | ||
@@ -3608,6 +3614,9 @@ static const struct attribute_group *regulator_dev_groups[] = { | |||
3608 | static void regulator_dev_release(struct device *dev) | 3614 | static void regulator_dev_release(struct device *dev) |
3609 | { | 3615 | { |
3610 | struct regulator_dev *rdev = dev_get_drvdata(dev); | 3616 | struct regulator_dev *rdev = dev_get_drvdata(dev); |
3617 | |||
3618 | kfree(rdev->constraints); | ||
3619 | of_node_put(rdev->dev.of_node); | ||
3611 | kfree(rdev); | 3620 | kfree(rdev); |
3612 | } | 3621 | } |
3613 | 3622 | ||
@@ -3839,9 +3848,7 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
3839 | unset_regulator_supplies(rdev); | 3848 | unset_regulator_supplies(rdev); |
3840 | list_del(&rdev->list); | 3849 | list_del(&rdev->list); |
3841 | mutex_unlock(®ulator_list_mutex); | 3850 | mutex_unlock(®ulator_list_mutex); |
3842 | kfree(rdev->constraints); | ||
3843 | regulator_ena_gpio_free(rdev); | 3851 | regulator_ena_gpio_free(rdev); |
3844 | of_node_put(rdev->dev.of_node); | ||
3845 | device_unregister(&rdev->dev); | 3852 | device_unregister(&rdev->dev); |
3846 | } | 3853 | } |
3847 | EXPORT_SYMBOL_GPL(regulator_unregister); | 3854 | EXPORT_SYMBOL_GPL(regulator_unregister); |
@@ -4161,13 +4168,57 @@ static int __init regulator_init(void) | |||
4161 | /* init early to allow our consumers to complete system booting */ | 4168 | /* init early to allow our consumers to complete system booting */ |
4162 | core_initcall(regulator_init); | 4169 | core_initcall(regulator_init); |
4163 | 4170 | ||
4164 | static int __init regulator_init_complete(void) | 4171 | static int __init regulator_late_cleanup(struct device *dev, void *data) |
4165 | { | 4172 | { |
4166 | struct regulator_dev *rdev; | 4173 | struct regulator_dev *rdev = dev_to_rdev(dev); |
4167 | const struct regulator_ops *ops; | 4174 | const struct regulator_ops *ops = rdev->desc->ops; |
4168 | struct regulation_constraints *c; | 4175 | struct regulation_constraints *c = rdev->constraints; |
4169 | int enabled, ret; | 4176 | int enabled, ret; |
4170 | 4177 | ||
4178 | if (c && c->always_on) | ||
4179 | return 0; | ||
4180 | |||
4181 | if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS)) | ||
4182 | return 0; | ||
4183 | |||
4184 | mutex_lock(&rdev->mutex); | ||
4185 | |||
4186 | if (rdev->use_count) | ||
4187 | goto unlock; | ||
4188 | |||
4189 | /* If we can't read the status assume it's on. */ | ||
4190 | if (ops->is_enabled) | ||
4191 | enabled = ops->is_enabled(rdev); | ||
4192 | else | ||
4193 | enabled = 1; | ||
4194 | |||
4195 | if (!enabled) | ||
4196 | goto unlock; | ||
4197 | |||
4198 | if (have_full_constraints()) { | ||
4199 | /* We log since this may kill the system if it goes | ||
4200 | * wrong. */ | ||
4201 | rdev_info(rdev, "disabling\n"); | ||
4202 | ret = _regulator_do_disable(rdev); | ||
4203 | if (ret != 0) | ||
4204 | rdev_err(rdev, "couldn't disable: %d\n", ret); | ||
4205 | } else { | ||
4206 | /* The intention is that in future we will | ||
4207 | * assume that full constraints are provided | ||
4208 | * so warn even if we aren't going to do | ||
4209 | * anything here. | ||
4210 | */ | ||
4211 | rdev_warn(rdev, "incomplete constraints, leaving on\n"); | ||
4212 | } | ||
4213 | |||
4214 | unlock: | ||
4215 | mutex_unlock(&rdev->mutex); | ||
4216 | |||
4217 | return 0; | ||
4218 | } | ||
4219 | |||
4220 | static int __init regulator_init_complete(void) | ||
4221 | { | ||
4171 | /* | 4222 | /* |
4172 | * Since DT doesn't provide an idiomatic mechanism for | 4223 | * Since DT doesn't provide an idiomatic mechanism for |
4173 | * enabling full constraints and since it's much more natural | 4224 | * enabling full constraints and since it's much more natural |
@@ -4177,58 +4228,13 @@ static int __init regulator_init_complete(void) | |||
4177 | if (of_have_populated_dt()) | 4228 | if (of_have_populated_dt()) |
4178 | has_full_constraints = true; | 4229 | has_full_constraints = true; |
4179 | 4230 | ||
4180 | mutex_lock(®ulator_list_mutex); | ||
4181 | |||
4182 | /* If we have a full configuration then disable any regulators | 4231 | /* If we have a full configuration then disable any regulators |
4183 | * we have permission to change the status for and which are | 4232 | * we have permission to change the status for and which are |
4184 | * not in use or always_on. This is effectively the default | 4233 | * not in use or always_on. This is effectively the default |
4185 | * for DT and ACPI as they have full constraints. | 4234 | * for DT and ACPI as they have full constraints. |
4186 | */ | 4235 | */ |
4187 | list_for_each_entry(rdev, ®ulator_list, list) { | 4236 | class_for_each_device(®ulator_class, NULL, NULL, |
4188 | ops = rdev->desc->ops; | 4237 | regulator_late_cleanup); |
4189 | c = rdev->constraints; | ||
4190 | |||
4191 | if (c && c->always_on) | ||
4192 | continue; | ||
4193 | |||
4194 | if (c && !(c->valid_ops_mask & REGULATOR_CHANGE_STATUS)) | ||
4195 | continue; | ||
4196 | |||
4197 | mutex_lock(&rdev->mutex); | ||
4198 | |||
4199 | if (rdev->use_count) | ||
4200 | goto unlock; | ||
4201 | |||
4202 | /* If we can't read the status assume it's on. */ | ||
4203 | if (ops->is_enabled) | ||
4204 | enabled = ops->is_enabled(rdev); | ||
4205 | else | ||
4206 | enabled = 1; | ||
4207 | |||
4208 | if (!enabled) | ||
4209 | goto unlock; | ||
4210 | |||
4211 | if (have_full_constraints()) { | ||
4212 | /* We log since this may kill the system if it | ||
4213 | * goes wrong. */ | ||
4214 | rdev_info(rdev, "disabling\n"); | ||
4215 | ret = _regulator_do_disable(rdev); | ||
4216 | if (ret != 0) | ||
4217 | rdev_err(rdev, "couldn't disable: %d\n", ret); | ||
4218 | } else { | ||
4219 | /* The intention is that in future we will | ||
4220 | * assume that full constraints are provided | ||
4221 | * so warn even if we aren't going to do | ||
4222 | * anything here. | ||
4223 | */ | ||
4224 | rdev_warn(rdev, "incomplete constraints, leaving on\n"); | ||
4225 | } | ||
4226 | |||
4227 | unlock: | ||
4228 | mutex_unlock(&rdev->mutex); | ||
4229 | } | ||
4230 | |||
4231 | mutex_unlock(®ulator_list_mutex); | ||
4232 | 4238 | ||
4233 | return 0; | 4239 | return 0; |
4234 | } | 4240 | } |
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index f0489cb9018b..8e39f7457bc3 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
@@ -22,6 +22,8 @@ | |||
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> | 24 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/irq.h> | ||
25 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
26 | #include <linux/regulator/driver.h> | 28 | #include <linux/regulator/driver.h> |
27 | #include <linux/regulator/machine.h> | 29 | #include <linux/regulator/machine.h> |
@@ -120,6 +122,55 @@ static int da9210_get_current_limit(struct regulator_dev *rdev) | |||
120 | return da9210_buck_limits[sel]; | 122 | return da9210_buck_limits[sel]; |
121 | } | 123 | } |
122 | 124 | ||
125 | static irqreturn_t da9210_irq_handler(int irq, void *data) | ||
126 | { | ||
127 | struct da9210 *chip = data; | ||
128 | unsigned int val, handled = 0; | ||
129 | int error, ret = IRQ_NONE; | ||
130 | |||
131 | error = regmap_read(chip->regmap, DA9210_REG_EVENT_B, &val); | ||
132 | if (error < 0) | ||
133 | goto error_i2c; | ||
134 | |||
135 | if (val & DA9210_E_OVCURR) { | ||
136 | regulator_notifier_call_chain(chip->rdev, | ||
137 | REGULATOR_EVENT_OVER_CURRENT, | ||
138 | NULL); | ||
139 | handled |= DA9210_E_OVCURR; | ||
140 | } | ||
141 | if (val & DA9210_E_NPWRGOOD) { | ||
142 | regulator_notifier_call_chain(chip->rdev, | ||
143 | REGULATOR_EVENT_UNDER_VOLTAGE, | ||
144 | NULL); | ||
145 | handled |= DA9210_E_NPWRGOOD; | ||
146 | } | ||
147 | if (val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT)) { | ||
148 | regulator_notifier_call_chain(chip->rdev, | ||
149 | REGULATOR_EVENT_OVER_TEMP, NULL); | ||
150 | handled |= val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT); | ||
151 | } | ||
152 | if (val & DA9210_E_VMAX) { | ||
153 | regulator_notifier_call_chain(chip->rdev, | ||
154 | REGULATOR_EVENT_REGULATION_OUT, | ||
155 | NULL); | ||
156 | handled |= DA9210_E_VMAX; | ||
157 | } | ||
158 | if (handled) { | ||
159 | /* Clear handled events */ | ||
160 | error = regmap_write(chip->regmap, DA9210_REG_EVENT_B, handled); | ||
161 | if (error < 0) | ||
162 | goto error_i2c; | ||
163 | |||
164 | ret = IRQ_HANDLED; | ||
165 | } | ||
166 | |||
167 | return ret; | ||
168 | |||
169 | error_i2c: | ||
170 | dev_err(regmap_get_device(chip->regmap), "I2C error : %d\n", error); | ||
171 | return ret; | ||
172 | } | ||
173 | |||
123 | /* | 174 | /* |
124 | * I2C driver interface functions | 175 | * I2C driver interface functions |
125 | */ | 176 | */ |
@@ -168,6 +219,30 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
168 | } | 219 | } |
169 | 220 | ||
170 | chip->rdev = rdev; | 221 | chip->rdev = rdev; |
222 | if (i2c->irq) { | ||
223 | error = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, | ||
224 | da9210_irq_handler, | ||
225 | IRQF_TRIGGER_LOW | | ||
226 | IRQF_ONESHOT | IRQF_SHARED, | ||
227 | "da9210", chip); | ||
228 | if (error) { | ||
229 | dev_err(&i2c->dev, "Failed to request IRQ%u: %d\n", | ||
230 | i2c->irq, error); | ||
231 | return error; | ||
232 | } | ||
233 | |||
234 | error = regmap_update_bits(chip->regmap, DA9210_REG_MASK_B, | ||
235 | DA9210_M_OVCURR | DA9210_M_NPWRGOOD | | ||
236 | DA9210_M_TEMP_WARN | | ||
237 | DA9210_M_TEMP_CRIT | DA9210_M_VMAX, 0); | ||
238 | if (error < 0) { | ||
239 | dev_err(&i2c->dev, "Failed to update mask reg: %d\n", | ||
240 | error); | ||
241 | return error; | ||
242 | } | ||
243 | } else { | ||
244 | dev_warn(&i2c->dev, "No IRQ configured\n"); | ||
245 | } | ||
171 | 246 | ||
172 | i2c_set_clientdata(i2c, chip); | 247 | i2c_set_clientdata(i2c, chip); |
173 | 248 | ||
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index df79e4b1946e..0858100d2d03 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * da9211-regulator.c - Regulator device driver for DA9211/DA9213 | 2 | * da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215 |
3 | * Copyright (C) 2014 Dialog Semiconductor Ltd. | 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
4 | * | 4 | * |
5 | * This library is free software; you can redistribute it and/or | 5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public | 6 | * modify it under the terms of the GNU Library General Public |
@@ -32,6 +32,7 @@ | |||
32 | /* DEVICE IDs */ | 32 | /* DEVICE IDs */ |
33 | #define DA9211_DEVICE_ID 0x22 | 33 | #define DA9211_DEVICE_ID 0x22 |
34 | #define DA9213_DEVICE_ID 0x23 | 34 | #define DA9213_DEVICE_ID 0x23 |
35 | #define DA9215_DEVICE_ID 0x24 | ||
35 | 36 | ||
36 | #define DA9211_BUCK_MODE_SLEEP 1 | 37 | #define DA9211_BUCK_MODE_SLEEP 1 |
37 | #define DA9211_BUCK_MODE_SYNC 2 | 38 | #define DA9211_BUCK_MODE_SYNC 2 |
@@ -90,6 +91,13 @@ static const int da9213_current_limits[] = { | |||
90 | 3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000, | 91 | 3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000, |
91 | 4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000 | 92 | 4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000 |
92 | }; | 93 | }; |
94 | /* Current limits for DA9215 buck (uA) indices | ||
95 | * corresponds with register values | ||
96 | */ | ||
97 | static const int da9215_current_limits[] = { | ||
98 | 4000000, 4200000, 4400000, 4600000, 4800000, 5000000, 5200000, 5400000, | ||
99 | 5600000, 5800000, 6000000, 6200000, 6400000, 6600000, 6800000, 7000000 | ||
100 | }; | ||
93 | 101 | ||
94 | static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev) | 102 | static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev) |
95 | { | 103 | { |
@@ -157,6 +165,10 @@ static int da9211_set_current_limit(struct regulator_dev *rdev, int min, | |||
157 | current_limits = da9213_current_limits; | 165 | current_limits = da9213_current_limits; |
158 | max_size = ARRAY_SIZE(da9213_current_limits)-1; | 166 | max_size = ARRAY_SIZE(da9213_current_limits)-1; |
159 | break; | 167 | break; |
168 | case DA9215: | ||
169 | current_limits = da9215_current_limits; | ||
170 | max_size = ARRAY_SIZE(da9215_current_limits)-1; | ||
171 | break; | ||
160 | default: | 172 | default: |
161 | return -EINVAL; | 173 | return -EINVAL; |
162 | } | 174 | } |
@@ -189,6 +201,9 @@ static int da9211_get_current_limit(struct regulator_dev *rdev) | |||
189 | case DA9213: | 201 | case DA9213: |
190 | current_limits = da9213_current_limits; | 202 | current_limits = da9213_current_limits; |
191 | break; | 203 | break; |
204 | case DA9215: | ||
205 | current_limits = da9215_current_limits; | ||
206 | break; | ||
192 | default: | 207 | default: |
193 | return -EINVAL; | 208 | return -EINVAL; |
194 | } | 209 | } |
@@ -350,13 +365,11 @@ static int da9211_regulator_init(struct da9211 *chip) | |||
350 | /* If configuration for 1/2 bucks is different between platform data | 365 | /* If configuration for 1/2 bucks is different between platform data |
351 | * and the register, driver should exit. | 366 | * and the register, driver should exit. |
352 | */ | 367 | */ |
353 | if ((chip->pdata->num_buck == 2 && data == 0x40) | 368 | if (chip->pdata->num_buck == 1 && data == 0x00) |
354 | || (chip->pdata->num_buck == 1 && data == 0x00)) { | 369 | chip->num_regulator = 1; |
355 | if (data == 0) | 370 | else if (chip->pdata->num_buck == 2 && data != 0x00) |
356 | chip->num_regulator = 1; | 371 | chip->num_regulator = 2; |
357 | else | 372 | else { |
358 | chip->num_regulator = 2; | ||
359 | } else { | ||
360 | dev_err(chip->dev, "Configuration is mismatched\n"); | 373 | dev_err(chip->dev, "Configuration is mismatched\n"); |
361 | return -EINVAL; | 374 | return -EINVAL; |
362 | } | 375 | } |
@@ -438,6 +451,9 @@ static int da9211_i2c_probe(struct i2c_client *i2c, | |||
438 | case DA9213_DEVICE_ID: | 451 | case DA9213_DEVICE_ID: |
439 | chip->chip_id = DA9213; | 452 | chip->chip_id = DA9213; |
440 | break; | 453 | break; |
454 | case DA9215_DEVICE_ID: | ||
455 | chip->chip_id = DA9215; | ||
456 | break; | ||
441 | default: | 457 | default: |
442 | dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data); | 458 | dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data); |
443 | return -ENODEV; | 459 | return -ENODEV; |
@@ -478,6 +494,7 @@ static int da9211_i2c_probe(struct i2c_client *i2c, | |||
478 | static const struct i2c_device_id da9211_i2c_id[] = { | 494 | static const struct i2c_device_id da9211_i2c_id[] = { |
479 | {"da9211", DA9211}, | 495 | {"da9211", DA9211}, |
480 | {"da9213", DA9213}, | 496 | {"da9213", DA9213}, |
497 | {"da9215", DA9215}, | ||
481 | {}, | 498 | {}, |
482 | }; | 499 | }; |
483 | MODULE_DEVICE_TABLE(i2c, da9211_i2c_id); | 500 | MODULE_DEVICE_TABLE(i2c, da9211_i2c_id); |
@@ -486,6 +503,7 @@ MODULE_DEVICE_TABLE(i2c, da9211_i2c_id); | |||
486 | static const struct of_device_id da9211_dt_ids[] = { | 503 | static const struct of_device_id da9211_dt_ids[] = { |
487 | { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] }, | 504 | { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] }, |
488 | { .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] }, | 505 | { .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] }, |
506 | { .compatible = "dlg,da9215", .data = &da9211_i2c_id[2] }, | ||
489 | {}, | 507 | {}, |
490 | }; | 508 | }; |
491 | MODULE_DEVICE_TABLE(of, da9211_dt_ids); | 509 | MODULE_DEVICE_TABLE(of, da9211_dt_ids); |
@@ -504,5 +522,5 @@ static struct i2c_driver da9211_regulator_driver = { | |||
504 | module_i2c_driver(da9211_regulator_driver); | 522 | module_i2c_driver(da9211_regulator_driver); |
505 | 523 | ||
506 | MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); | 524 | MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); |
507 | MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213"); | 525 | MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213/DA9215"); |
508 | MODULE_LICENSE("GPL v2"); | 526 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/regulator/da9211-regulator.h b/drivers/regulator/da9211-regulator.h index 93fa9df2721c..d6ad96fc64d3 100644 --- a/drivers/regulator/da9211-regulator.h +++ b/drivers/regulator/da9211-regulator.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * da9211-regulator.h - Regulator definitions for DA9211/DA9213 | 2 | * da9211-regulator.h - Regulator definitions for DA9211/DA9213/DA9215 |
3 | * Copyright (C) 2014 Dialog Semiconductor Ltd. | 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
4 | * | 4 | * |
5 | * This library is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public | 6 | * modify it under the terms of the GNU General Public License |
7 | * License as published by the Free Software Foundation; either | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * version 2 of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This library is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * Library General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __DA9211_REGISTERS_H__ | 16 | #ifndef __DA9211_REGISTERS_H__ |
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 42865681c00b..4940e8287df6 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c | |||
@@ -439,6 +439,7 @@ static const struct i2c_device_id fan53555_id[] = { | |||
439 | }, | 439 | }, |
440 | { }, | 440 | { }, |
441 | }; | 441 | }; |
442 | MODULE_DEVICE_TABLE(i2c, fan53555_id); | ||
442 | 443 | ||
443 | static struct i2c_driver fan53555_regulator_driver = { | 444 | static struct i2c_driver fan53555_regulator_driver = { |
444 | .driver = { | 445 | .driver = { |
diff --git a/drivers/regulator/isl9305.c b/drivers/regulator/isl9305.c index 6e3a15fe00f1..e02e9a9dddbd 100644 --- a/drivers/regulator/isl9305.c +++ b/drivers/regulator/isl9305.c | |||
@@ -183,6 +183,7 @@ static const struct of_device_id isl9305_dt_ids[] = { | |||
183 | { .compatible = "isil,isl9305h" }, | 183 | { .compatible = "isil,isl9305h" }, |
184 | {}, | 184 | {}, |
185 | }; | 185 | }; |
186 | MODULE_DEVICE_TABLE(of, isl9305_dt_ids); | ||
186 | #endif | 187 | #endif |
187 | 188 | ||
188 | static const struct i2c_device_id isl9305_i2c_id[] = { | 189 | static const struct i2c_device_id isl9305_i2c_id[] = { |
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h index 5dd65acc2a69..a43a5ca1167b 100644 --- a/include/linux/regulator/da9211.h +++ b/include/linux/regulator/da9211.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * da9211.h - Regulator device driver for DA9211/DA9213 | 2 | * da9211.h - Regulator device driver for DA9211/DA9213/DA9215 |
3 | * Copyright (C) 2014 Dialog Semiconductor Ltd. | 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
4 | * | 4 | * |
5 | * This library is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public | 6 | * modify it under the terms of the GNU General Public License |
7 | * License as published by the Free Software Foundation; either | 7 | * as published by the Free Software Foundation; either version 2 |
8 | * version 2 of the License, or (at your option) any later version. | 8 | * of the License, or (at your option) any later version. |
9 | * | 9 | * |
10 | * This library is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * Library General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __LINUX_REGULATOR_DA9211_H | 16 | #ifndef __LINUX_REGULATOR_DA9211_H |
@@ -23,6 +23,7 @@ | |||
23 | enum da9211_chip_id { | 23 | enum da9211_chip_id { |
24 | DA9211, | 24 | DA9211, |
25 | DA9213, | 25 | DA9213, |
26 | DA9215, | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | struct da9211_pdata { | 29 | struct da9211_pdata { |