aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 22:43:32 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 22:43:32 -0500
commit8ee005112dc2fbf4e0bd4e335d26ff0393a38da1 (patch)
treeff5230ecfe44bfb4be16e0fd2294b4c3e28b3ad1 /drivers/regulator
parentf1e0d5f1384f95b03f7b12092792db761af20ee7 (diff)
parent7fa8a5975784cce646b3763e5d9957f8d688c9ce (diff)
Merge remote-tracking branch 'regulator/topic/tps80031' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps80031-regulator.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index 127d1754fcd3..b15d711bc8c6 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * tps80031-regulator.c -- TI TPS80031 regulator driver. 2 * tps80031-regulator.c -- TI TPS80031 regulator driver.
3 * 3 *
4 * Regulator driver for TITPS80031/TPS80032 Fully Integrated Power 4 * Regulator driver for TI TPS80031/TPS80032 Fully Integrated Power
5 * Management with Power Path and Battery Charger. 5 * Management with Power Path and Battery Charger.
6 * 6 *
7 * Copyright (c) 2012, NVIDIA Corporation. 7 * Copyright (c) 2012, NVIDIA Corporation.
@@ -284,14 +284,6 @@ static int tps80031_ldo_get_voltage_sel(struct regulator_dev *rdev)
284 return vsel & rdev->desc->vsel_mask; 284 return vsel & rdev->desc->vsel_mask;
285} 285}
286 286
287static int tps80031_ldo_list_voltage(struct regulator_dev *rdev, unsigned sel)
288{
289 if (sel == 0)
290 return 0;
291 else
292 return regulator_list_voltage_linear(rdev, sel - 1);
293}
294
295static int tps80031_vbus_is_enabled(struct regulator_dev *rdev) 287static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)
296{ 288{
297 struct tps80031_regulator *ri = rdev_get_drvdata(rdev); 289 struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
@@ -311,7 +303,7 @@ static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)
311 TPS80031_CHARGERUSB_CTRL3, &ctrl3); 303 TPS80031_CHARGERUSB_CTRL3, &ctrl3);
312 if (ret < 0) { 304 if (ret < 0) {
313 dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", 305 dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
314 TPS80031_CHARGERUSB_CTRL1, ret); 306 TPS80031_CHARGERUSB_CTRL3, ret);
315 return ret; 307 return ret;
316 } 308 }
317 if ((ctrl1 & OPA_MODE_EN) && (ctrl3 & BOOST_HW_PWR_EN)) 309 if ((ctrl1 & OPA_MODE_EN) && (ctrl3 & BOOST_HW_PWR_EN))
@@ -398,7 +390,7 @@ static struct regulator_ops tps80031_dcdc_ops = {
398}; 390};
399 391
400static struct regulator_ops tps80031_ldo_ops = { 392static struct regulator_ops tps80031_ldo_ops = {
401 .list_voltage = tps80031_ldo_list_voltage, 393 .list_voltage = regulator_list_voltage_linear,
402 .set_voltage_sel = tps80031_ldo_set_voltage_sel, 394 .set_voltage_sel = tps80031_ldo_set_voltage_sel,
403 .get_voltage_sel = tps80031_ldo_get_voltage_sel, 395 .get_voltage_sel = tps80031_ldo_get_voltage_sel,
404 .enable = tps80031_reg_enable, 396 .enable = tps80031_reg_enable,
@@ -407,15 +399,18 @@ static struct regulator_ops tps80031_ldo_ops = {
407}; 399};
408 400
409static struct regulator_ops tps80031_vbus_sw_ops = { 401static struct regulator_ops tps80031_vbus_sw_ops = {
402 .list_voltage = regulator_list_voltage_linear,
410 .enable = tps80031_vbus_enable, 403 .enable = tps80031_vbus_enable,
411 .disable = tps80031_vbus_disable, 404 .disable = tps80031_vbus_disable,
412 .is_enabled = tps80031_vbus_is_enabled, 405 .is_enabled = tps80031_vbus_is_enabled,
413}; 406};
414 407
415static struct regulator_ops tps80031_vbus_hw_ops = { 408static struct regulator_ops tps80031_vbus_hw_ops = {
409 .list_voltage = regulator_list_voltage_linear,
416}; 410};
417 411
418static struct regulator_ops tps80031_ext_reg_ops = { 412static struct regulator_ops tps80031_ext_reg_ops = {
413 .list_voltage = regulator_list_voltage_linear,
419 .enable = tps80031_reg_enable, 414 .enable = tps80031_reg_enable,
420 .disable = tps80031_reg_disable, 415 .disable = tps80031_reg_disable,
421 .is_enabled = tps80031_reg_is_enabled, 416 .is_enabled = tps80031_reg_is_enabled,
@@ -462,6 +457,7 @@ static struct regulator_ops tps80031_ext_reg_ops = {
462 .type = REGULATOR_VOLTAGE, \ 457 .type = REGULATOR_VOLTAGE, \
463 .min_uV = 1000000, \ 458 .min_uV = 1000000, \
464 .uV_step = 100000, \ 459 .uV_step = 100000, \
460 .linear_min_sel = 1, \
465 .n_voltages = 25, \ 461 .n_voltages = 25, \
466 .vsel_mask = LDO_VSEL_MASK, \ 462 .vsel_mask = LDO_VSEL_MASK, \
467 .enable_time = 500, \ 463 .enable_time = 500, \
@@ -477,7 +473,8 @@ static struct regulator_ops tps80031_ext_reg_ops = {
477 .desc = { \ 473 .desc = { \
478 .name = "tps80031_"#_id, \ 474 .name = "tps80031_"#_id, \
479 .id = TPS80031_REGULATOR_##_id, \ 475 .id = TPS80031_REGULATOR_##_id, \
480 .n_voltages = 2, \ 476 .min_uV = max_mV * 1000, \
477 .n_voltages = 1, \
481 .ops = &_ops, \ 478 .ops = &_ops, \
482 .type = REGULATOR_VOLTAGE, \ 479 .type = REGULATOR_VOLTAGE, \
483 .owner = THIS_MODULE, \ 480 .owner = THIS_MODULE, \
@@ -679,7 +676,6 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
679{ 676{
680 struct tps80031_platform_data *pdata; 677 struct tps80031_platform_data *pdata;
681 struct tps80031_regulator_platform_data *tps_pdata; 678 struct tps80031_regulator_platform_data *tps_pdata;
682 struct tps80031_regulator_info *rinfo;
683 struct tps80031_regulator *ri; 679 struct tps80031_regulator *ri;
684 struct tps80031_regulator *pmic; 680 struct tps80031_regulator *pmic;
685 struct regulator_dev *rdev; 681 struct regulator_dev *rdev;
@@ -703,9 +699,8 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
703 699
704 for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { 700 for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) {
705 tps_pdata = pdata->regulator_pdata[num]; 701 tps_pdata = pdata->regulator_pdata[num];
706 rinfo = &tps80031_rinfo[num];
707 ri = &pmic[num]; 702 ri = &pmic[num];
708 ri->rinfo = rinfo; 703 ri->rinfo = &tps80031_rinfo[num];
709 ri->dev = &pdev->dev; 704 ri->dev = &pdev->dev;
710 705
711 check_smps_mode_mult(pdev->dev.parent, ri); 706 check_smps_mode_mult(pdev->dev.parent, ri);
@@ -788,6 +783,6 @@ static void __exit tps80031_regulator_exit(void)
788module_exit(tps80031_regulator_exit); 783module_exit(tps80031_regulator_exit);
789 784
790MODULE_ALIAS("platform:tps80031-regulator"); 785MODULE_ALIAS("platform:tps80031-regulator");
791MODULE_DESCRIPTION("Regulator Driver for TI TPS80031 PMIC"); 786MODULE_DESCRIPTION("Regulator Driver for TI TPS80031/TPS80032 PMIC");
792MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>"); 787MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
793MODULE_LICENSE("GPL v2"); 788MODULE_LICENSE("GPL v2");