aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-01-15 06:46:35 -0500
committerMark Brown <broonie@linaro.org>2014-01-15 06:46:35 -0500
commit598911b42c940158caa1169092a804903bde845e (patch)
tree15487a73d3854488ef679ee920c48fe1a90c28b3 /drivers/regulator
parent1eb72f0b98fe7ea1c4bb2e9e294a865b044b2a82 (diff)
parent319e2e3f63c348a9b66db4667efa73178e18b17d (diff)
Merge tag 'v3.13-rc4' into regulator-pfuze100
Linux 3.13-rc4
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/arizona-micsupp.c54
-rw-r--r--drivers/regulator/as3722-regulator.c2
-rw-r--r--drivers/regulator/core.c14
-rw-r--r--drivers/regulator/gpio-regulator.c7
-rw-r--r--drivers/regulator/pfuze100-regulator.c14
-rw-r--r--drivers/regulator/s5m8767.c2
6 files changed, 81 insertions, 12 deletions
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 724706a97dc4..fd3154d86901 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -174,6 +174,33 @@ static const struct regulator_desc arizona_micsupp = {
174 .owner = THIS_MODULE, 174 .owner = THIS_MODULE,
175}; 175};
176 176
177static const struct regulator_linear_range arizona_micsupp_ext_ranges[] = {
178 REGULATOR_LINEAR_RANGE(900000, 0, 0x14, 25000),
179 REGULATOR_LINEAR_RANGE(1500000, 0x15, 0x27, 100000),
180};
181
182static const struct regulator_desc arizona_micsupp_ext = {
183 .name = "MICVDD",
184 .supply_name = "CPVDD",
185 .type = REGULATOR_VOLTAGE,
186 .n_voltages = 40,
187 .ops = &arizona_micsupp_ops,
188
189 .vsel_reg = ARIZONA_LDO2_CONTROL_1,
190 .vsel_mask = ARIZONA_LDO2_VSEL_MASK,
191 .enable_reg = ARIZONA_MIC_CHARGE_PUMP_1,
192 .enable_mask = ARIZONA_CPMIC_ENA,
193 .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1,
194 .bypass_mask = ARIZONA_CPMIC_BYPASS,
195
196 .linear_ranges = arizona_micsupp_ext_ranges,
197 .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges),
198
199 .enable_time = 3000,
200
201 .owner = THIS_MODULE,
202};
203
177static const struct regulator_init_data arizona_micsupp_default = { 204static const struct regulator_init_data arizona_micsupp_default = {
178 .constraints = { 205 .constraints = {
179 .valid_ops_mask = REGULATOR_CHANGE_STATUS | 206 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
@@ -186,9 +213,22 @@ static const struct regulator_init_data arizona_micsupp_default = {
186 .num_consumer_supplies = 1, 213 .num_consumer_supplies = 1,
187}; 214};
188 215
216static const struct regulator_init_data arizona_micsupp_ext_default = {
217 .constraints = {
218 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
219 REGULATOR_CHANGE_VOLTAGE |
220 REGULATOR_CHANGE_BYPASS,
221 .min_uV = 900000,
222 .max_uV = 3300000,
223 },
224
225 .num_consumer_supplies = 1,
226};
227
189static int arizona_micsupp_probe(struct platform_device *pdev) 228static int arizona_micsupp_probe(struct platform_device *pdev)
190{ 229{
191 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 230 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
231 const struct regulator_desc *desc;
192 struct regulator_config config = { }; 232 struct regulator_config config = { };
193 struct arizona_micsupp *micsupp; 233 struct arizona_micsupp *micsupp;
194 int ret; 234 int ret;
@@ -207,7 +247,17 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
207 * default init_data for it. This will be overridden with 247 * default init_data for it. This will be overridden with
208 * platform data if provided. 248 * platform data if provided.
209 */ 249 */
210 micsupp->init_data = arizona_micsupp_default; 250 switch (arizona->type) {
251 case WM5110:
252 desc = &arizona_micsupp_ext;
253 micsupp->init_data = arizona_micsupp_ext_default;
254 break;
255 default:
256 desc = &arizona_micsupp;
257 micsupp->init_data = arizona_micsupp_default;
258 break;
259 }
260
211 micsupp->init_data.consumer_supplies = &micsupp->supply; 261 micsupp->init_data.consumer_supplies = &micsupp->supply;
212 micsupp->supply.supply = "MICVDD"; 262 micsupp->supply.supply = "MICVDD";
213 micsupp->supply.dev_name = dev_name(arizona->dev); 263 micsupp->supply.dev_name = dev_name(arizona->dev);
@@ -226,7 +276,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
226 ARIZONA_CPMIC_BYPASS, 0); 276 ARIZONA_CPMIC_BYPASS, 0);
227 277
228 micsupp->regulator = devm_regulator_register(&pdev->dev, 278 micsupp->regulator = devm_regulator_register(&pdev->dev,
229 &arizona_micsupp, 279 desc,
230 &config); 280 &config);
231 if (IS_ERR(micsupp->regulator)) { 281 if (IS_ERR(micsupp->regulator)) {
232 ret = PTR_ERR(micsupp->regulator); 282 ret = PTR_ERR(micsupp->regulator);
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 5917fe3dc983..b9f1d24c6812 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -590,8 +590,8 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev,
590 default: 590 default:
591 return -EINVAL; 591 return -EINVAL;
592 } 592 }
593 ret <<= ffs(mask) - 1;
593 val = ret & mask; 594 val = ret & mask;
594 val <<= ffs(mask) - 1;
595 return as3722_update_bits(as3722, reg, mask, val); 595 return as3722_update_bits(as3722, reg, mask, val);
596} 596}
597 597
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6382f0af353b..d85f31385b24 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -119,6 +119,11 @@ static const char *rdev_get_name(struct regulator_dev *rdev)
119 return ""; 119 return "";
120} 120}
121 121
122static bool have_full_constraints(void)
123{
124 return has_full_constraints || of_have_populated_dt();
125}
126
122/** 127/**
123 * of_get_regulator - get a regulator device node based on supply name 128 * of_get_regulator - get a regulator device node based on supply name
124 * @dev: Device pointer for the consumer (of regulator) device 129 * @dev: Device pointer for the consumer (of regulator) device
@@ -1340,7 +1345,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1340 * Assume that a regulator is physically present and enabled 1345 * Assume that a regulator is physically present and enabled
1341 * even if it isn't hooked up and just provide a dummy. 1346 * even if it isn't hooked up and just provide a dummy.
1342 */ 1347 */
1343 if (has_full_constraints && allow_dummy) { 1348 if (have_full_constraints() && allow_dummy) {
1344 pr_warn("%s supply %s not found, using dummy regulator\n", 1349 pr_warn("%s supply %s not found, using dummy regulator\n",
1345 devname, id); 1350 devname, id);
1346 1351
@@ -2184,6 +2189,9 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector)
2184 struct regulator_ops *ops = rdev->desc->ops; 2189 struct regulator_ops *ops = rdev->desc->ops;
2185 int ret; 2190 int ret;
2186 2191
2192 if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector)
2193 return rdev->desc->fixed_uV;
2194
2187 if (!ops->list_voltage || selector >= rdev->desc->n_voltages) 2195 if (!ops->list_voltage || selector >= rdev->desc->n_voltages)
2188 return -EINVAL; 2196 return -EINVAL;
2189 2197
@@ -3624,7 +3632,7 @@ int regulator_suspend_finish(void)
3624 if (error) 3632 if (error)
3625 ret = error; 3633 ret = error;
3626 } else { 3634 } else {
3627 if (!has_full_constraints) 3635 if (!have_full_constraints())
3628 goto unlock; 3636 goto unlock;
3629 if (!ops->disable) 3637 if (!ops->disable)
3630 goto unlock; 3638 goto unlock;
@@ -3822,7 +3830,7 @@ static int __init regulator_init_complete(void)
3822 if (!enabled) 3830 if (!enabled)
3823 goto unlock; 3831 goto unlock;
3824 3832
3825 if (has_full_constraints) { 3833 if (have_full_constraints()) {
3826 /* We log since this may kill the system if it 3834 /* We log since this may kill the system if it
3827 * goes wrong. */ 3835 * goes wrong. */
3828 rdev_info(rdev, "disabling\n"); 3836 rdev_info(rdev, "disabling\n");
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 04406a918c04..234960dc9607 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -139,6 +139,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
139 struct property *prop; 139 struct property *prop;
140 const char *regtype; 140 const char *regtype;
141 int proplen, gpio, i; 141 int proplen, gpio, i;
142 int ret;
142 143
143 config = devm_kzalloc(dev, 144 config = devm_kzalloc(dev,
144 sizeof(struct gpio_regulator_config), 145 sizeof(struct gpio_regulator_config),
@@ -202,7 +203,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
202 } 203 }
203 config->nr_states = i; 204 config->nr_states = i;
204 205
205 of_property_read_string(np, "regulator-type", &regtype); 206 ret = of_property_read_string(np, "regulator-type", &regtype);
207 if (ret < 0) {
208 dev_err(dev, "Missing 'regulator-type' property\n");
209 return ERR_PTR(-EINVAL);
210 }
206 211
207 if (!strncmp("voltage", regtype, 7)) 212 if (!strncmp("voltage", regtype, 7))
208 config->type = REGULATOR_VOLTAGE; 213 config->type = REGULATOR_VOLTAGE;
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
index 1d5ef37918f9..0c511ae52c42 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -38,7 +38,7 @@
38 38
39#define PFUZE100_DEVICEID 0x0 39#define PFUZE100_DEVICEID 0x0
40#define PFUZE100_REVID 0x3 40#define PFUZE100_REVID 0x3
41#define PFUZE100_FABID 0x3 41#define PFUZE100_FABID 0x4
42 42
43#define PFUZE100_SW1ABVOL 0x20 43#define PFUZE100_SW1ABVOL 0x20
44#define PFUZE100_SW1CVOL 0x2e 44#define PFUZE100_SW1CVOL 0x2e
@@ -308,9 +308,15 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip)
308 if (ret) 308 if (ret)
309 return ret; 309 return ret;
310 310
311 if (value & 0x0f) { 311 switch (value & 0x0f) {
312 dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); 312 /* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */
313 return -ENODEV; 313 case 0x8:
314 dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8");
315 case 0x0:
316 break;
317 default:
318 dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value);
319 return -ENODEV;
314 } 320 }
315 321
316 ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value); 322 ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index cbf91e25cf7f..aeb40aad0ae7 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
925 config.dev = s5m8767->dev; 925 config.dev = s5m8767->dev;
926 config.init_data = pdata->regulators[i].initdata; 926 config.init_data = pdata->regulators[i].initdata;
927 config.driver_data = s5m8767; 927 config.driver_data = s5m8767;
928 config.regmap = iodev->regmap; 928 config.regmap = iodev->regmap_pmic;
929 config.of_node = pdata->regulators[i].reg_node; 929 config.of_node = pdata->regulators[i].reg_node;
930 930
931 rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id], 931 rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],