diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-11-14 10:39:29 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-15 00:35:50 -0500 |
commit | b92f787d1479ffbf6350114a7353e2fd32cafc41 (patch) | |
tree | 0d5d4aaca65530a339020d839501cf12566b1fa5 /drivers/regulator | |
parent | 1a0bb679bcee5233dc5134e4f5fbf97d8caf8bbb (diff) |
regulator: tps80031: add prefix TPS80031 on common defines.
Pefix "TPS80031" is added on all defines of tps80031 header
to avoid conflict with other header definitions.
Update the regualtor driver of tps80031 to use the same name.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/tps80031-regulator.c | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 04844780b56c..a37ede80abbf 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c | |||
@@ -105,16 +105,17 @@ static int tps80031_reg_is_enabled(struct regulator_dev *rdev) | |||
105 | u8 reg_val; | 105 | u8 reg_val; |
106 | int ret; | 106 | int ret; |
107 | 107 | ||
108 | if (ri->ext_ctrl_flag & EXT_PWR_REQ) | 108 | if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) |
109 | return true; | 109 | return true; |
110 | 110 | ||
111 | ret = tps80031_read(parent, SLAVE_ID1, ri->rinfo->state_reg, ®_val); | 111 | ret = tps80031_read(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, |
112 | ®_val); | ||
112 | if (ret < 0) { | 113 | if (ret < 0) { |
113 | dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n", | 114 | dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n", |
114 | ri->rinfo->state_reg, ret); | 115 | ri->rinfo->state_reg, ret); |
115 | return ret; | 116 | return ret; |
116 | } | 117 | } |
117 | return ((reg_val & STATE_MASK) == STATE_ON); | 118 | return ((reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON); |
118 | } | 119 | } |
119 | 120 | ||
120 | static int tps80031_reg_enable(struct regulator_dev *rdev) | 121 | static int tps80031_reg_enable(struct regulator_dev *rdev) |
@@ -123,11 +124,11 @@ static int tps80031_reg_enable(struct regulator_dev *rdev) | |||
123 | struct device *parent = to_tps80031_dev(rdev); | 124 | struct device *parent = to_tps80031_dev(rdev); |
124 | int ret; | 125 | int ret; |
125 | 126 | ||
126 | if (ri->ext_ctrl_flag & EXT_PWR_REQ) | 127 | if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) |
127 | return 0; | 128 | return 0; |
128 | 129 | ||
129 | ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->state_reg, | 130 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, |
130 | STATE_ON, STATE_MASK); | 131 | TPS80031_STATE_ON, TPS80031_STATE_MASK); |
131 | if (ret < 0) { | 132 | if (ret < 0) { |
132 | dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", | 133 | dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", |
133 | ri->rinfo->state_reg, ret); | 134 | ri->rinfo->state_reg, ret); |
@@ -142,11 +143,11 @@ static int tps80031_reg_disable(struct regulator_dev *rdev) | |||
142 | struct device *parent = to_tps80031_dev(rdev); | 143 | struct device *parent = to_tps80031_dev(rdev); |
143 | int ret; | 144 | int ret; |
144 | 145 | ||
145 | if (ri->ext_ctrl_flag & EXT_PWR_REQ) | 146 | if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) |
146 | return 0; | 147 | return 0; |
147 | 148 | ||
148 | ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->state_reg, | 149 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, |
149 | STATE_OFF, STATE_MASK); | 150 | TPS80031_STATE_OFF, TPS80031_STATE_MASK); |
150 | if (ret < 0) | 151 | if (ret < 0) |
151 | dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", | 152 | dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", |
152 | ri->rinfo->state_reg, ret); | 153 | ri->rinfo->state_reg, ret); |
@@ -299,14 +300,14 @@ static int tps80031_vbus_is_enabled(struct regulator_dev *rdev) | |||
299 | uint8_t ctrl1 = 0; | 300 | uint8_t ctrl1 = 0; |
300 | uint8_t ctrl3 = 0; | 301 | uint8_t ctrl3 = 0; |
301 | 302 | ||
302 | ret = tps80031_read(parent, SLAVE_ID2, | 303 | ret = tps80031_read(parent, TPS80031_SLAVE_ID2, |
303 | TPS80031_CHARGERUSB_CTRL1, &ctrl1); | 304 | TPS80031_CHARGERUSB_CTRL1, &ctrl1); |
304 | if (ret < 0) { | 305 | if (ret < 0) { |
305 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", | 306 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", |
306 | TPS80031_CHARGERUSB_CTRL1, ret); | 307 | TPS80031_CHARGERUSB_CTRL1, ret); |
307 | return ret; | 308 | return ret; |
308 | } | 309 | } |
309 | ret = tps80031_read(parent, SLAVE_ID2, | 310 | ret = tps80031_read(parent, TPS80031_SLAVE_ID2, |
310 | TPS80031_CHARGERUSB_CTRL3, &ctrl3); | 311 | TPS80031_CHARGERUSB_CTRL3, &ctrl3); |
311 | if (ret < 0) { | 312 | if (ret < 0) { |
312 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", | 313 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", |
@@ -324,7 +325,7 @@ static int tps80031_vbus_enable(struct regulator_dev *rdev) | |||
324 | struct device *parent = to_tps80031_dev(rdev); | 325 | struct device *parent = to_tps80031_dev(rdev); |
325 | int ret; | 326 | int ret; |
326 | 327 | ||
327 | ret = tps80031_set_bits(parent, SLAVE_ID2, | 328 | ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2, |
328 | TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); | 329 | TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); |
329 | if (ret < 0) { | 330 | if (ret < 0) { |
330 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", | 331 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", |
@@ -332,7 +333,7 @@ static int tps80031_vbus_enable(struct regulator_dev *rdev) | |||
332 | return ret; | 333 | return ret; |
333 | } | 334 | } |
334 | 335 | ||
335 | ret = tps80031_set_bits(parent, SLAVE_ID2, | 336 | ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2, |
336 | TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); | 337 | TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); |
337 | if (ret < 0) { | 338 | if (ret < 0) { |
338 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", | 339 | dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", |
@@ -348,8 +349,8 @@ static int tps80031_vbus_disable(struct regulator_dev *rdev) | |||
348 | struct device *parent = to_tps80031_dev(rdev); | 349 | struct device *parent = to_tps80031_dev(rdev); |
349 | int ret = 0; | 350 | int ret = 0; |
350 | 351 | ||
351 | if (ri->config_flags & VBUS_DISCHRG_EN_PDN) { | 352 | if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) { |
352 | ret = tps80031_write(parent, SLAVE_ID2, | 353 | ret = tps80031_write(parent, TPS80031_SLAVE_ID2, |
353 | USB_VBUS_CTRL_SET, VBUS_DISCHRG); | 354 | USB_VBUS_CTRL_SET, VBUS_DISCHRG); |
354 | if (ret < 0) { | 355 | if (ret < 0) { |
355 | dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", | 356 | dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", |
@@ -358,7 +359,7 @@ static int tps80031_vbus_disable(struct regulator_dev *rdev) | |||
358 | } | 359 | } |
359 | } | 360 | } |
360 | 361 | ||
361 | ret = tps80031_clr_bits(parent, SLAVE_ID2, | 362 | ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2, |
362 | TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); | 363 | TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); |
363 | if (ret < 0) { | 364 | if (ret < 0) { |
364 | dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", | 365 | dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", |
@@ -366,7 +367,7 @@ static int tps80031_vbus_disable(struct regulator_dev *rdev) | |||
366 | return ret; | 367 | return ret; |
367 | } | 368 | } |
368 | 369 | ||
369 | ret = tps80031_clr_bits(parent, SLAVE_ID2, | 370 | ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2, |
370 | TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); | 371 | TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); |
371 | if (ret < 0) { | 372 | if (ret < 0) { |
372 | dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", | 373 | dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", |
@@ -375,8 +376,8 @@ static int tps80031_vbus_disable(struct regulator_dev *rdev) | |||
375 | } | 376 | } |
376 | 377 | ||
377 | mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000)); | 378 | mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000)); |
378 | if (ri->config_flags & VBUS_DISCHRG_EN_PDN) { | 379 | if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) { |
379 | ret = tps80031_write(parent, SLAVE_ID2, | 380 | ret = tps80031_write(parent, TPS80031_SLAVE_ID2, |
380 | USB_VBUS_CTRL_CLR, VBUS_DISCHRG); | 381 | USB_VBUS_CTRL_CLR, VBUS_DISCHRG); |
381 | if (ret < 0) { | 382 | if (ret < 0) { |
382 | dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", | 383 | dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", |
@@ -433,7 +434,7 @@ static struct regulator_ops tps80031_ext_reg_ops = { | |||
433 | .state_reg = TPS80031_##_id##_CFG_STATE, \ | 434 | .state_reg = TPS80031_##_id##_CFG_STATE, \ |
434 | .force_reg = TPS80031_##_id##_CFG_FORCE, \ | 435 | .force_reg = TPS80031_##_id##_CFG_FORCE, \ |
435 | .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ | 436 | .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ |
436 | .volt_id = SLAVE_##_volt_id, \ | 437 | .volt_id = TPS80031_SLAVE_##_volt_id, \ |
437 | .preq_bit = _pbit, \ | 438 | .preq_bit = _pbit, \ |
438 | .desc = { \ | 439 | .desc = { \ |
439 | .name = "tps80031_"#_id, \ | 440 | .name = "tps80031_"#_id, \ |
@@ -451,7 +452,7 @@ static struct regulator_ops tps80031_ext_reg_ops = { | |||
451 | .trans_reg = TPS80031_##_id##_CFG_TRANS, \ | 452 | .trans_reg = TPS80031_##_id##_CFG_TRANS, \ |
452 | .state_reg = TPS80031_##_id##_CFG_STATE, \ | 453 | .state_reg = TPS80031_##_id##_CFG_STATE, \ |
453 | .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ | 454 | .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ |
454 | .volt_id = SLAVE_ID1, \ | 455 | .volt_id = TPS80031_SLAVE_ID1, \ |
455 | .preq_bit = _preq_bit, \ | 456 | .preq_bit = _preq_bit, \ |
456 | .desc = { \ | 457 | .desc = { \ |
457 | .owner = THIS_MODULE, \ | 458 | .owner = THIS_MODULE, \ |
@@ -471,7 +472,7 @@ static struct regulator_ops tps80031_ext_reg_ops = { | |||
471 | { \ | 472 | { \ |
472 | .trans_reg = TPS80031_##_id##_CFG_TRANS, \ | 473 | .trans_reg = TPS80031_##_id##_CFG_TRANS, \ |
473 | .state_reg = TPS80031_##_id##_CFG_STATE, \ | 474 | .state_reg = TPS80031_##_id##_CFG_STATE, \ |
474 | .volt_id = SLAVE_ID1, \ | 475 | .volt_id = TPS80031_SLAVE_ID1, \ |
475 | .preq_bit = _pbit, \ | 476 | .preq_bit = _pbit, \ |
476 | .desc = { \ | 477 | .desc = { \ |
477 | .name = "tps80031_"#_id, \ | 478 | .name = "tps80031_"#_id, \ |
@@ -524,9 +525,10 @@ static int tps80031_power_req_config(struct device *parent, | |||
524 | } | 525 | } |
525 | 526 | ||
526 | skip_pwr_req_config: | 527 | skip_pwr_req_config: |
527 | if (tps80031_pdata->ext_ctrl_flag & PWR_ON_ON_SLEEP) { | 528 | if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) { |
528 | ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->trans_reg, | 529 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, |
529 | TRANS_SLEEP_ON, TRANS_SLEEP_MASK); | 530 | ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON, |
531 | TPS80031_TRANS_SLEEP_MASK); | ||
530 | if (ret < 0) { | 532 | if (ret < 0) { |
531 | dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n", | 533 | dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n", |
532 | ri->rinfo->trans_reg, ret); | 534 | ri->rinfo->trans_reg, ret); |
@@ -544,16 +546,17 @@ static int tps80031_regulator_config(struct device *parent, | |||
544 | 546 | ||
545 | switch (ri->rinfo->desc.id) { | 547 | switch (ri->rinfo->desc.id) { |
546 | case TPS80031_REGULATOR_LDOUSB: | 548 | case TPS80031_REGULATOR_LDOUSB: |
547 | if (ri->config_flags & | 549 | if (ri->config_flags & (TPS80031_USBLDO_INPUT_VSYS | |
548 | (USBLDO_INPUT_VSYS | USBLDO_INPUT_PMID)) { | 550 | TPS80031_USBLDO_INPUT_PMID)) { |
549 | unsigned val = 0; | 551 | unsigned val = 0; |
550 | if (ri->config_flags & USBLDO_INPUT_VSYS) | 552 | if (ri->config_flags & TPS80031_USBLDO_INPUT_VSYS) |
551 | val = MISC2_LDOUSB_IN_VSYS; | 553 | val = MISC2_LDOUSB_IN_VSYS; |
552 | else | 554 | else |
553 | val = MISC2_LDOUSB_IN_PMID; | 555 | val = MISC2_LDOUSB_IN_PMID; |
554 | 556 | ||
555 | ret = tps80031_update(parent, SLAVE_ID1, | 557 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, |
556 | TPS80031_MISC2, val, MISC2_LDOUSB_IN_MASK); | 558 | TPS80031_MISC2, val, |
559 | MISC2_LDOUSB_IN_MASK); | ||
557 | if (ret < 0) { | 560 | if (ret < 0) { |
558 | dev_err(ri->dev, | 561 | dev_err(ri->dev, |
559 | "LDOUSB config failed, e= %d\n", ret); | 562 | "LDOUSB config failed, e= %d\n", ret); |
@@ -563,8 +566,8 @@ static int tps80031_regulator_config(struct device *parent, | |||
563 | break; | 566 | break; |
564 | 567 | ||
565 | case TPS80031_REGULATOR_LDO3: | 568 | case TPS80031_REGULATOR_LDO3: |
566 | if (ri->config_flags & LDO3_OUTPUT_VIB) { | 569 | if (ri->config_flags & TPS80031_LDO3_OUTPUT_VIB) { |
567 | ret = tps80031_update(parent, SLAVE_ID1, | 570 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, |
568 | TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL, | 571 | TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL, |
569 | MISC2_LDO3_SEL_VIB_MASK); | 572 | MISC2_LDO3_SEL_VIB_MASK); |
570 | if (ret < 0) { | 573 | if (ret < 0) { |
@@ -577,7 +580,7 @@ static int tps80031_regulator_config(struct device *parent, | |||
577 | 580 | ||
578 | case TPS80031_REGULATOR_VBUS: | 581 | case TPS80031_REGULATOR_VBUS: |
579 | /* Provide SW control Ops if VBUS is SW control */ | 582 | /* Provide SW control Ops if VBUS is SW control */ |
580 | if (!(ri->config_flags & VBUS_SW_ONLY)) | 583 | if (!(ri->config_flags & TPS80031_VBUS_SW_ONLY)) |
581 | ri->rinfo->desc.ops = &tps80031_vbus_sw_ops; | 584 | ri->rinfo->desc.ops = &tps80031_vbus_sw_ops; |
582 | break; | 585 | break; |
583 | default: | 586 | default: |
@@ -585,9 +588,10 @@ static int tps80031_regulator_config(struct device *parent, | |||
585 | } | 588 | } |
586 | 589 | ||
587 | /* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */ | 590 | /* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */ |
588 | ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->trans_reg, | 591 | ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg, |
589 | TRANS_ACTIVE_ON | TRANS_SLEEP_OFF | TRANS_OFF_OFF, | 592 | TPS80031_TRANS_ACTIVE_ON | TPS80031_TRANS_SLEEP_OFF | |
590 | TRANS_ACTIVE_MASK | TRANS_SLEEP_MASK | TRANS_OFF_MASK); | 593 | TPS80031_TRANS_OFF_OFF, TPS80031_TRANS_ACTIVE_MASK | |
594 | TPS80031_TRANS_SLEEP_MASK | TPS80031_TRANS_OFF_MASK); | ||
591 | if (ret < 0) { | 595 | if (ret < 0) { |
592 | dev_err(ri->dev, "trans reg update failed, e %d\n", ret); | 596 | dev_err(ri->dev, "trans reg update failed, e %d\n", ret); |
593 | return ret; | 597 | return ret; |
@@ -604,14 +608,14 @@ static int check_smps_mode_mult(struct device *parent, | |||
604 | u8 smps_offset; | 608 | u8 smps_offset; |
605 | u8 smps_mult; | 609 | u8 smps_mult; |
606 | 610 | ||
607 | ret = tps80031_read(parent, SLAVE_ID1, | 611 | ret = tps80031_read(parent, TPS80031_SLAVE_ID1, |
608 | TPS80031_SMPS_OFFSET, &smps_offset); | 612 | TPS80031_SMPS_OFFSET, &smps_offset); |
609 | if (ret < 0) { | 613 | if (ret < 0) { |
610 | dev_err(parent, "Error in reading smps offset register\n"); | 614 | dev_err(parent, "Error in reading smps offset register\n"); |
611 | return ret; | 615 | return ret; |
612 | } | 616 | } |
613 | 617 | ||
614 | ret = tps80031_read(parent, SLAVE_ID1, | 618 | ret = tps80031_read(parent, TPS80031_SLAVE_ID1, |
615 | TPS80031_SMPS_MULT, &smps_mult); | 619 | TPS80031_SMPS_MULT, &smps_mult); |
616 | if (ret < 0) { | 620 | if (ret < 0) { |
617 | dev_err(parent, "Error in reading smps mult register\n"); | 621 | dev_err(parent, "Error in reading smps mult register\n"); |