aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-07-28 22:59:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-07-28 22:59:55 -0400
commit8785eb1e7ca0292c04007fc7768e1599e0c6cef3 (patch)
tree8016acc3d90f4af72940ce3b85beaeb25fe8326d /drivers
parenta6f80fb7b5986fda663d94079d3bba0937a6b6ff (diff)
parent8b24599e72c9aee1ea1187e29cb9c5de9f449cce (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: davinci: da850/omap-l138 evm: account for DEFDCDC{2,3} being tied high regulator: tps6507x: allow driver to use DEFDCDC{2,3}_HIGH register wm8350-regulator: fix wm8350_register_regulator error handling ab3100: fix off-by-one value range checking for voltage selector
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/ab3100.c4
-rw-r--r--drivers/regulator/tps6507x-regulator.c36
-rw-r--r--drivers/regulator/wm8350-regulator.c2
3 files changed, 32 insertions, 10 deletions
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 7b14a67bdca2..11790990277a 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -286,7 +286,7 @@ static int ab3100_list_voltage_regulator(struct regulator_dev *reg,
286{ 286{
287 struct ab3100_regulator *abreg = reg->reg_data; 287 struct ab3100_regulator *abreg = reg->reg_data;
288 288
289 if (selector > abreg->voltages_len) 289 if (selector >= abreg->voltages_len)
290 return -EINVAL; 290 return -EINVAL;
291 return abreg->typ_voltages[selector]; 291 return abreg->typ_voltages[selector];
292} 292}
@@ -318,7 +318,7 @@ static int ab3100_get_voltage_regulator(struct regulator_dev *reg)
318 regval &= 0xE0; 318 regval &= 0xE0;
319 regval >>= 5; 319 regval >>= 5;
320 320
321 if (regval > abreg->voltages_len) { 321 if (regval >= abreg->voltages_len) {
322 dev_err(&reg->dev, 322 dev_err(&reg->dev,
323 "regulator register %02x contains an illegal voltage setting\n", 323 "regulator register %02x contains an illegal voltage setting\n",
324 abreg->regreg); 324 abreg->regreg);
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 14b4576281c5..8152d65220f5 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/regulator/driver.h> 23#include <linux/regulator/driver.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/regulator/tps6507x.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/mfd/tps6507x.h> 28#include <linux/mfd/tps6507x.h>
@@ -101,9 +102,12 @@ struct tps_info {
101 unsigned max_uV; 102 unsigned max_uV;
102 u8 table_len; 103 u8 table_len;
103 const u16 *table; 104 const u16 *table;
105
106 /* Does DCDC high or the low register defines output voltage? */
107 bool defdcdc_default;
104}; 108};
105 109
106static const struct tps_info tps6507x_pmic_regs[] = { 110static struct tps_info tps6507x_pmic_regs[] = {
107 { 111 {
108 .name = "VDCDC1", 112 .name = "VDCDC1",
109 .min_uV = 725000, 113 .min_uV = 725000,
@@ -145,7 +149,7 @@ struct tps6507x_pmic {
145 struct regulator_desc desc[TPS6507X_NUM_REGULATOR]; 149 struct regulator_desc desc[TPS6507X_NUM_REGULATOR];
146 struct tps6507x_dev *mfd; 150 struct tps6507x_dev *mfd;
147 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR]; 151 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR];
148 const struct tps_info *info[TPS6507X_NUM_REGULATOR]; 152 struct tps_info *info[TPS6507X_NUM_REGULATOR];
149 struct mutex io_lock; 153 struct mutex io_lock;
150}; 154};
151static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg) 155static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg)
@@ -341,10 +345,16 @@ static int tps6507x_pmic_dcdc_get_voltage(struct regulator_dev *dev)
341 reg = TPS6507X_REG_DEFDCDC1; 345 reg = TPS6507X_REG_DEFDCDC1;
342 break; 346 break;
343 case TPS6507X_DCDC_2: 347 case TPS6507X_DCDC_2:
344 reg = TPS6507X_REG_DEFDCDC2_LOW; 348 if (tps->info[dcdc]->defdcdc_default)
349 reg = TPS6507X_REG_DEFDCDC2_HIGH;
350 else
351 reg = TPS6507X_REG_DEFDCDC2_LOW;
345 break; 352 break;
346 case TPS6507X_DCDC_3: 353 case TPS6507X_DCDC_3:
347 reg = TPS6507X_REG_DEFDCDC3_LOW; 354 if (tps->info[dcdc]->defdcdc_default)
355 reg = TPS6507X_REG_DEFDCDC3_HIGH;
356 else
357 reg = TPS6507X_REG_DEFDCDC3_LOW;
348 break; 358 break;
349 default: 359 default:
350 return -EINVAL; 360 return -EINVAL;
@@ -370,10 +380,16 @@ static int tps6507x_pmic_dcdc_set_voltage(struct regulator_dev *dev,
370 reg = TPS6507X_REG_DEFDCDC1; 380 reg = TPS6507X_REG_DEFDCDC1;
371 break; 381 break;
372 case TPS6507X_DCDC_2: 382 case TPS6507X_DCDC_2:
373 reg = TPS6507X_REG_DEFDCDC2_LOW; 383 if (tps->info[dcdc]->defdcdc_default)
384 reg = TPS6507X_REG_DEFDCDC2_HIGH;
385 else
386 reg = TPS6507X_REG_DEFDCDC2_LOW;
374 break; 387 break;
375 case TPS6507X_DCDC_3: 388 case TPS6507X_DCDC_3:
376 reg = TPS6507X_REG_DEFDCDC3_LOW; 389 if (tps->info[dcdc]->defdcdc_default)
390 reg = TPS6507X_REG_DEFDCDC3_HIGH;
391 else
392 reg = TPS6507X_REG_DEFDCDC3_LOW;
377 break; 393 break;
378 default: 394 default:
379 return -EINVAL; 395 return -EINVAL;
@@ -532,7 +548,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
532{ 548{
533 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); 549 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
534 static int desc_id; 550 static int desc_id;
535 const struct tps_info *info = &tps6507x_pmic_regs[0]; 551 struct tps_info *info = &tps6507x_pmic_regs[0];
536 struct regulator_init_data *init_data; 552 struct regulator_init_data *init_data;
537 struct regulator_dev *rdev; 553 struct regulator_dev *rdev;
538 struct tps6507x_pmic *tps; 554 struct tps6507x_pmic *tps;
@@ -569,6 +585,12 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
569 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) { 585 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) {
570 /* Register the regulators */ 586 /* Register the regulators */
571 tps->info[i] = info; 587 tps->info[i] = info;
588 if (init_data->driver_data) {
589 struct tps6507x_reg_platform_data *data =
590 init_data->driver_data;
591 tps->info[i]->defdcdc_default = data->defdcdc_default;
592 }
593
572 tps->desc[i].name = info->name; 594 tps->desc[i].name = info->name;
573 tps->desc[i].id = desc_id++; 595 tps->desc[i].id = desc_id++;
574 tps->desc[i].n_voltages = num_voltages[i]; 596 tps->desc[i].n_voltages = num_voltages[i];
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 723cd1fb4867..0e6ed7db9364 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1495,7 +1495,7 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
1495 if (ret != 0) { 1495 if (ret != 0) {
1496 dev_err(wm8350->dev, "Failed to register regulator %d: %d\n", 1496 dev_err(wm8350->dev, "Failed to register regulator %d: %d\n",
1497 reg, ret); 1497 reg, ret);
1498 platform_device_del(pdev); 1498 platform_device_put(pdev);
1499 wm8350->pmic.pdev[reg] = NULL; 1499 wm8350->pmic.pdev[reg] = NULL;
1500 } 1500 }
1501 1501