Skip to content

Commit b92f787

Browse files
ldewanganbroonie
authored andcommitted
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>
1 parent 1a0bb67 commit b92f787

1 file changed

Lines changed: 42 additions & 38 deletions

File tree

‎drivers/regulator/tps80031-regulator.c‎

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ static int tps80031_reg_is_enabled(struct regulator_dev *rdev)
105105
u8 reg_val;
106106
int ret;
107107

108-
if (ri->ext_ctrl_flag & EXT_PWR_REQ)
108+
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
109109
return true;
110110

111-
ret = tps80031_read(parent, SLAVE_ID1, ri->rinfo->state_reg, &reg_val);
111+
ret = tps80031_read(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
112+
&reg_val);
112113
if (ret < 0) {
113114
dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n",
114115
ri->rinfo->state_reg, ret);
115116
return ret;
116117
}
117-
return ((reg_val & STATE_MASK) == STATE_ON);
118+
return ((reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON);
118119
}
119120

120121
static int tps80031_reg_enable(struct regulator_dev *rdev)
@@ -123,11 +124,11 @@ static int tps80031_reg_enable(struct regulator_dev *rdev)
123124
struct device *parent = to_tps80031_dev(rdev);
124125
int ret;
125126

126-
if (ri->ext_ctrl_flag & EXT_PWR_REQ)
127+
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
127128
return 0;
128129

129-
ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->state_reg,
130-
STATE_ON, STATE_MASK);
130+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
131+
TPS80031_STATE_ON, TPS80031_STATE_MASK);
131132
if (ret < 0) {
132133
dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",
133134
ri->rinfo->state_reg, ret);
@@ -142,11 +143,11 @@ static int tps80031_reg_disable(struct regulator_dev *rdev)
142143
struct device *parent = to_tps80031_dev(rdev);
143144
int ret;
144145

145-
if (ri->ext_ctrl_flag & EXT_PWR_REQ)
146+
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
146147
return 0;
147148

148-
ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->state_reg,
149-
STATE_OFF, STATE_MASK);
149+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
150+
TPS80031_STATE_OFF, TPS80031_STATE_MASK);
150151
if (ret < 0)
151152
dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",
152153
ri->rinfo->state_reg, ret);
@@ -299,14 +300,14 @@ static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)
299300
uint8_t ctrl1 = 0;
300301
uint8_t ctrl3 = 0;
301302

302-
ret = tps80031_read(parent, SLAVE_ID2,
303+
ret = tps80031_read(parent, TPS80031_SLAVE_ID2,
303304
TPS80031_CHARGERUSB_CTRL1, &ctrl1);
304305
if (ret < 0) {
305306
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
306307
TPS80031_CHARGERUSB_CTRL1, ret);
307308
return ret;
308309
}
309-
ret = tps80031_read(parent, SLAVE_ID2,
310+
ret = tps80031_read(parent, TPS80031_SLAVE_ID2,
310311
TPS80031_CHARGERUSB_CTRL3, &ctrl3);
311312
if (ret < 0) {
312313
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
@@ -324,15 +325,15 @@ static int tps80031_vbus_enable(struct regulator_dev *rdev)
324325
struct device *parent = to_tps80031_dev(rdev);
325326
int ret;
326327

327-
ret = tps80031_set_bits(parent, SLAVE_ID2,
328+
ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,
328329
TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);
329330
if (ret < 0) {
330331
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
331332
TPS80031_CHARGERUSB_CTRL1, ret);
332333
return ret;
333334
}
334335

335-
ret = tps80031_set_bits(parent, SLAVE_ID2,
336+
ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,
336337
TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);
337338
if (ret < 0) {
338339
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)
348349
struct device *parent = to_tps80031_dev(rdev);
349350
int ret = 0;
350351

351-
if (ri->config_flags & VBUS_DISCHRG_EN_PDN) {
352-
ret = tps80031_write(parent, SLAVE_ID2,
352+
if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {
353+
ret = tps80031_write(parent, TPS80031_SLAVE_ID2,
353354
USB_VBUS_CTRL_SET, VBUS_DISCHRG);
354355
if (ret < 0) {
355356
dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",
@@ -358,15 +359,15 @@ static int tps80031_vbus_disable(struct regulator_dev *rdev)
358359
}
359360
}
360361

361-
ret = tps80031_clr_bits(parent, SLAVE_ID2,
362+
ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,
362363
TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);
363364
if (ret < 0) {
364365
dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n",
365366
TPS80031_CHARGERUSB_CTRL1, ret);
366367
return ret;
367368
}
368369

369-
ret = tps80031_clr_bits(parent, SLAVE_ID2,
370+
ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,
370371
TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);
371372
if (ret < 0) {
372373
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)
375376
}
376377

377378
mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000));
378-
if (ri->config_flags & VBUS_DISCHRG_EN_PDN) {
379-
ret = tps80031_write(parent, SLAVE_ID2,
379+
if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {
380+
ret = tps80031_write(parent, TPS80031_SLAVE_ID2,
380381
USB_VBUS_CTRL_CLR, VBUS_DISCHRG);
381382
if (ret < 0) {
382383
dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",
@@ -433,7 +434,7 @@ static struct regulator_ops tps80031_ext_reg_ops = {
433434
.state_reg = TPS80031_##_id##_CFG_STATE, \
434435
.force_reg = TPS80031_##_id##_CFG_FORCE, \
435436
.volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \
436-
.volt_id = SLAVE_##_volt_id, \
437+
.volt_id = TPS80031_SLAVE_##_volt_id, \
437438
.preq_bit = _pbit, \
438439
.desc = { \
439440
.name = "tps80031_"#_id, \
@@ -451,7 +452,7 @@ static struct regulator_ops tps80031_ext_reg_ops = {
451452
.trans_reg = TPS80031_##_id##_CFG_TRANS, \
452453
.state_reg = TPS80031_##_id##_CFG_STATE, \
453454
.volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \
454-
.volt_id = SLAVE_ID1, \
455+
.volt_id = TPS80031_SLAVE_ID1, \
455456
.preq_bit = _preq_bit, \
456457
.desc = { \
457458
.owner = THIS_MODULE, \
@@ -471,7 +472,7 @@ static struct regulator_ops tps80031_ext_reg_ops = {
471472
{ \
472473
.trans_reg = TPS80031_##_id##_CFG_TRANS, \
473474
.state_reg = TPS80031_##_id##_CFG_STATE, \
474-
.volt_id = SLAVE_ID1, \
475+
.volt_id = TPS80031_SLAVE_ID1, \
475476
.preq_bit = _pbit, \
476477
.desc = { \
477478
.name = "tps80031_"#_id, \
@@ -524,9 +525,10 @@ static int tps80031_power_req_config(struct device *parent,
524525
}
525526

526527
skip_pwr_req_config:
527-
if (tps80031_pdata->ext_ctrl_flag & PWR_ON_ON_SLEEP) {
528-
ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->trans_reg,
529-
TRANS_SLEEP_ON, TRANS_SLEEP_MASK);
528+
if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) {
529+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
530+
ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON,
531+
TPS80031_TRANS_SLEEP_MASK);
530532
if (ret < 0) {
531533
dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n",
532534
ri->rinfo->trans_reg, ret);
@@ -544,16 +546,17 @@ static int tps80031_regulator_config(struct device *parent,
544546

545547
switch (ri->rinfo->desc.id) {
546548
case TPS80031_REGULATOR_LDOUSB:
547-
if (ri->config_flags &
548-
(USBLDO_INPUT_VSYS | USBLDO_INPUT_PMID)) {
549+
if (ri->config_flags & (TPS80031_USBLDO_INPUT_VSYS |
550+
TPS80031_USBLDO_INPUT_PMID)) {
549551
unsigned val = 0;
550-
if (ri->config_flags & USBLDO_INPUT_VSYS)
552+
if (ri->config_flags & TPS80031_USBLDO_INPUT_VSYS)
551553
val = MISC2_LDOUSB_IN_VSYS;
552554
else
553555
val = MISC2_LDOUSB_IN_PMID;
554556

555-
ret = tps80031_update(parent, SLAVE_ID1,
556-
TPS80031_MISC2, val, MISC2_LDOUSB_IN_MASK);
557+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
558+
TPS80031_MISC2, val,
559+
MISC2_LDOUSB_IN_MASK);
557560
if (ret < 0) {
558561
dev_err(ri->dev,
559562
"LDOUSB config failed, e= %d\n", ret);
@@ -563,8 +566,8 @@ static int tps80031_regulator_config(struct device *parent,
563566
break;
564567

565568
case TPS80031_REGULATOR_LDO3:
566-
if (ri->config_flags & LDO3_OUTPUT_VIB) {
567-
ret = tps80031_update(parent, SLAVE_ID1,
569+
if (ri->config_flags & TPS80031_LDO3_OUTPUT_VIB) {
570+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
568571
TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL,
569572
MISC2_LDO3_SEL_VIB_MASK);
570573
if (ret < 0) {
@@ -577,17 +580,18 @@ static int tps80031_regulator_config(struct device *parent,
577580

578581
case TPS80031_REGULATOR_VBUS:
579582
/* 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))
581584
ri->rinfo->desc.ops = &tps80031_vbus_sw_ops;
582585
break;
583586
default:
584587
break;
585588
}
586589

587590
/* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */
588-
ret = tps80031_update(parent, SLAVE_ID1, ri->rinfo->trans_reg,
589-
TRANS_ACTIVE_ON | TRANS_SLEEP_OFF | TRANS_OFF_OFF,
590-
TRANS_ACTIVE_MASK | TRANS_SLEEP_MASK | TRANS_OFF_MASK);
591+
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg,
592+
TPS80031_TRANS_ACTIVE_ON | TPS80031_TRANS_SLEEP_OFF |
593+
TPS80031_TRANS_OFF_OFF, TPS80031_TRANS_ACTIVE_MASK |
594+
TPS80031_TRANS_SLEEP_MASK | TPS80031_TRANS_OFF_MASK);
591595
if (ret < 0) {
592596
dev_err(ri->dev, "trans reg update failed, e %d\n", ret);
593597
return ret;
@@ -604,14 +608,14 @@ static int check_smps_mode_mult(struct device *parent,
604608
u8 smps_offset;
605609
u8 smps_mult;
606610

607-
ret = tps80031_read(parent, SLAVE_ID1,
611+
ret = tps80031_read(parent, TPS80031_SLAVE_ID1,
608612
TPS80031_SMPS_OFFSET, &smps_offset);
609613
if (ret < 0) {
610614
dev_err(parent, "Error in reading smps offset register\n");
611615
return ret;
612616
}
613617

614-
ret = tps80031_read(parent, SLAVE_ID1,
618+
ret = tps80031_read(parent, TPS80031_SLAVE_ID1,
615619
TPS80031_SMPS_MULT, &smps_mult);
616620
if (ret < 0) {
617621
dev_err(parent, "Error in reading smps mult register\n");

0 commit comments

Comments
 (0)