Skip to content

Commit b0284de

Browse files
author
Lee Jones
committed
ab8500_bm: Rename battery management platform data to something more logical
The platform specific battery management configuration data structure is currently called 'bat' short for 'battery'; however, it contains information for all components of the battery management group, rather than information pertaining to the battery itself - there are other structures for that. So, in keeping with its structure namesake 'abx500_bm_data', we rename it to 'bm' here. Using similar logic, we're also renaming 'bmdevs_of_probe' to the more device specific 'ab8500_bm_of_probe'. Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 8e3a71e commit b0284de

6 files changed

Lines changed: 152 additions & 152 deletions

File tree

‎drivers/power/ab8500_bmdata.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,9 @@ struct abx500_bm_data ab8500_bm_data = {
452452
.fg_params = &fg,
453453
};
454454

455-
int __devinit bmdevs_of_probe(struct device *dev,
456-
struct device_node *np,
457-
struct abx500_bm_data **battery)
455+
int __devinit ab8500_bm_of_probe(struct device *dev,
456+
struct device_node *np,
457+
struct abx500_bm_data **battery)
458458
{
459459
struct batres_vs_temp *tmp_batres_tbl;
460460
struct device_node *np_bat_supply;

‎drivers/power/ab8500_btemp.c‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct ab8500_btemp_ranges {
7878
* @parent: Pointer to the struct ab8500
7979
* @gpadc: Pointer to the struct gpadc
8080
* @fg: Pointer to the struct fg
81-
* @bat: Pointer to the abx500_bm platform data
81+
* @bm: Platform specific battery management information
8282
* @btemp_psy: Structure for BTEMP specific battery properties
8383
* @events: Structure for information about events triggered
8484
* @btemp_ranges: Battery temperature range structure
@@ -95,7 +95,7 @@ struct ab8500_btemp {
9595
struct ab8500 *parent;
9696
struct ab8500_gpadc *gpadc;
9797
struct ab8500_fg *fg;
98-
struct abx500_bm_data *bat;
98+
struct abx500_bm_data *bm;
9999
struct power_supply btemp_psy;
100100
struct ab8500_btemp_events events;
101101
struct ab8500_btemp_ranges btemp_ranges;
@@ -149,13 +149,13 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
149149
return (450000 * (v_batctrl)) / (1800 - v_batctrl);
150150
}
151151

152-
if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL) {
152+
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL) {
153153
/*
154154
* If the battery has internal NTC, we use the current
155155
* source to calculate the resistance, 7uA or 20uA
156156
*/
157157
rbs = (v_batctrl * 1000
158-
- di->bat->gnd_lift_resistance * inst_curr)
158+
- di->bm->gnd_lift_resistance * inst_curr)
159159
/ di->curr_source;
160160
} else {
161161
/*
@@ -211,7 +211,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
211211
return 0;
212212

213213
/* Only do this for batteries with internal NTC */
214-
if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
214+
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
215215
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
216216
curr = BAT_CTRL_7U_ENA;
217217
else
@@ -243,7 +243,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
243243
__func__);
244244
goto disable_curr_source;
245245
}
246-
} else if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
246+
} else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
247247
dev_dbg(di->dev, "Disable BATCTRL curr source\n");
248248

249249
/* Write 0 to the curr bits */
@@ -459,9 +459,9 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
459459
int rbat, rntc, vntc;
460460
u8 id;
461461

462-
id = di->bat->batt_id;
462+
id = di->bm->batt_id;
463463

464-
if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
464+
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL &&
465465
id != BATTERY_UNKNOWN) {
466466

467467
rbat = ab8500_btemp_get_batctrl_res(di);
@@ -476,8 +476,8 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
476476
}
477477

478478
temp = ab8500_btemp_res_to_temp(di,
479-
di->bat->bat_type[id].r_to_t_tbl,
480-
di->bat->bat_type[id].n_temp_tbl_elements, rbat);
479+
di->bm->bat_type[id].r_to_t_tbl,
480+
di->bm->bat_type[id].n_temp_tbl_elements, rbat);
481481
} else {
482482
vntc = ab8500_gpadc_convert(di->gpadc, BTEMP_BALL);
483483
if (vntc < 0) {
@@ -493,8 +493,8 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
493493
rntc = 230000 * vntc / (VTVOUT_V - vntc);
494494

495495
temp = ab8500_btemp_res_to_temp(di,
496-
di->bat->bat_type[id].r_to_t_tbl,
497-
di->bat->bat_type[id].n_temp_tbl_elements, rntc);
496+
di->bm->bat_type[id].r_to_t_tbl,
497+
di->bm->bat_type[id].n_temp_tbl_elements, rntc);
498498
prev = temp;
499499
}
500500
dev_dbg(di->dev, "Battery temperature is %d\n", temp);
@@ -515,7 +515,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
515515
u8 i;
516516

517517
di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
518-
di->bat->batt_id = BATTERY_UNKNOWN;
518+
di->bm->batt_id = BATTERY_UNKNOWN;
519519

520520
res = ab8500_btemp_get_batctrl_res(di);
521521
if (res < 0) {
@@ -524,23 +524,23 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
524524
}
525525

526526
/* BATTERY_UNKNOWN is defined on position 0, skip it! */
527-
for (i = BATTERY_UNKNOWN + 1; i < di->bat->n_btypes; i++) {
528-
if ((res <= di->bat->bat_type[i].resis_high) &&
529-
(res >= di->bat->bat_type[i].resis_low)) {
527+
for (i = BATTERY_UNKNOWN + 1; i < di->bm->n_btypes; i++) {
528+
if ((res <= di->bm->bat_type[i].resis_high) &&
529+
(res >= di->bm->bat_type[i].resis_low)) {
530530
dev_dbg(di->dev, "Battery detected on %s"
531531
" low %d < res %d < high: %d"
532532
" index: %d\n",
533-
di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL ?
533+
di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL ?
534534
"BATCTRL" : "BATTEMP",
535-
di->bat->bat_type[i].resis_low, res,
536-
di->bat->bat_type[i].resis_high, i);
535+
di->bm->bat_type[i].resis_low, res,
536+
di->bm->bat_type[i].resis_high, i);
537537

538-
di->bat->batt_id = i;
538+
di->bm->batt_id = i;
539539
break;
540540
}
541541
}
542542

543-
if (di->bat->batt_id == BATTERY_UNKNOWN) {
543+
if (di->bm->batt_id == BATTERY_UNKNOWN) {
544544
dev_warn(di->dev, "Battery identified as unknown"
545545
", resistance %d Ohm\n", res);
546546
return -ENXIO;
@@ -550,13 +550,13 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
550550
* We only have to change current source if the
551551
* detected type is Type 1, else we use the 7uA source
552552
*/
553-
if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
554-
di->bat->batt_id == 1) {
553+
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL &&
554+
di->bm->batt_id == 1) {
555555
dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
556556
di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
557557
}
558558

559-
return di->bat->batt_id;
559+
return di->bm->batt_id;
560560
}
561561

562562
/**
@@ -586,9 +586,9 @@ static void ab8500_btemp_periodic_work(struct work_struct *work)
586586
}
587587

588588
if (di->events.ac_conn || di->events.usb_conn)
589-
interval = di->bat->temp_interval_chg;
589+
interval = di->bm->temp_interval_chg;
590590
else
591-
interval = di->bat->temp_interval_nochg;
591+
interval = di->bm->temp_interval_nochg;
592592

593593
/* Schedule a new measurement */
594594
queue_delayed_work(di->btemp_wq,
@@ -815,7 +815,7 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
815815
val->intval = 1;
816816
break;
817817
case POWER_SUPPLY_PROP_TECHNOLOGY:
818-
val->intval = di->bat->bat_type[di->bat->batt_id].name;
818+
val->intval = di->bm->bat_type[di->bm->batt_id].name;
819819
break;
820820
case POWER_SUPPLY_PROP_TEMP:
821821
val->intval = ab8500_btemp_get_temp(di);
@@ -985,10 +985,10 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
985985
dev_err(&pdev->dev, "%s no mem for ab8500_btemp\n", __func__);
986986
return -ENOMEM;
987987
}
988-
di->bat = pdev->mfd_cell->platform_data;
989-
if (!di->bat) {
988+
di->bm = pdev->mfd_cell->platform_data;
989+
if (!di->bm) {
990990
if (np) {
991-
ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
991+
ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm);
992992
if (ret) {
993993
dev_err(&pdev->dev,
994994
"failed to get battery information\n");

‎drivers/power/ab8500_charger.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ struct ab8500_charger_usb_state {
189189
* @autopower_cfg platform specific power config support for "pwron after pwrloss"
190190
* @parent: Pointer to the struct ab8500
191191
* @gpadc: Pointer to the struct gpadc
192-
* @bat: Pointer to the abx500_bm platform data
192+
* @bm: Platform specific battery management information
193193
* @flags: Structure for information about events triggered
194194
* @usb_state: Structure for usb stack information
195195
* @ac_chg: AC charger power supply
@@ -226,7 +226,7 @@ struct ab8500_charger {
226226
bool autopower_cfg;
227227
struct ab8500 *parent;
228228
struct ab8500_gpadc *gpadc;
229-
struct abx500_bm_data *bat;
229+
struct abx500_bm_data *bm;
230230
struct ab8500_charger_event_flags flags;
231231
struct ab8500_charger_usb_state usb_state;
232232
struct ux500_charger ac_chg;
@@ -1034,7 +1034,7 @@ static int ab8500_charger_set_vbus_in_curr(struct ab8500_charger *di,
10341034
int min_value;
10351035

10361036
/* We should always use to lowest current limit */
1037-
min_value = min(di->bat->chg_params->usb_curr_max, ich_in);
1037+
min_value = min(di->bm->chg_params->usb_curr_max, ich_in);
10381038

10391039
switch (min_value) {
10401040
case 100:
@@ -1176,7 +1176,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
11761176
volt_index = ab8500_voltage_to_regval(vset);
11771177
curr_index = ab8500_current_to_regval(iset);
11781178
input_curr_index = ab8500_current_to_regval(
1179-
di->bat->chg_params->ac_curr_max);
1179+
di->bm->chg_params->ac_curr_max);
11801180
if (volt_index < 0 || curr_index < 0 || input_curr_index < 0) {
11811181
dev_err(di->dev,
11821182
"Charger voltage or current too high, "
@@ -1193,7 +1193,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
11931193
}
11941194
/* MainChInputCurr: current that can be drawn from the charger*/
11951195
ret = ab8500_charger_set_main_in_curr(di,
1196-
di->bat->chg_params->ac_curr_max);
1196+
di->bm->chg_params->ac_curr_max);
11971197
if (ret) {
11981198
dev_err(di->dev, "%s Failed to set MainChInputCurr\n",
11991199
__func__);
@@ -1209,7 +1209,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
12091209
}
12101210

12111211
/* Check if VBAT overshoot control should be enabled */
1212-
if (!di->bat->enable_overshoot)
1212+
if (!di->bm->enable_overshoot)
12131213
overshoot = MAIN_CH_NO_OVERSHOOT_ENA_N;
12141214

12151215
/* Enable Main Charger */
@@ -1376,7 +1376,7 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger,
13761376
return ret;
13771377
}
13781378
/* Check if VBAT overshoot control should be enabled */
1379-
if (!di->bat->enable_overshoot)
1379+
if (!di->bm->enable_overshoot)
13801380
overshoot = USB_CHG_NO_OVERSHOOT_ENA_N;
13811381

13821382
/* Enable USB Charger */
@@ -2454,8 +2454,8 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
24542454
ret = abx500_set_register_interruptible(di->dev,
24552455
AB8500_RTC,
24562456
AB8500_RTC_BACKUP_CHG_REG,
2457-
di->bat->bkup_bat_v |
2458-
di->bat->bkup_bat_i);
2457+
di->bm->bkup_bat_v |
2458+
di->bm->bkup_bat_i);
24592459
if (ret) {
24602460
dev_err(di->dev, "failed to setup backup battery charging\n");
24612461
goto out;
@@ -2644,10 +2644,10 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
26442644
dev_err(&pdev->dev, "%s no mem for ab8500_charger\n", __func__);
26452645
return -ENOMEM;
26462646
}
2647-
di->bat = pdev->mfd_cell->platform_data;
2648-
if (!di->bat) {
2647+
di->bm = pdev->mfd_cell->platform_data;
2648+
if (!di->bm) {
26492649
if (np) {
2650-
ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
2650+
ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm);
26512651
if (ret) {
26522652
dev_err(&pdev->dev,
26532653
"failed to get battery information\n");

0 commit comments

Comments
 (0)