Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350584
b: refs/heads/master
c: b0284de
h: refs/heads/master
v: v3
  • Loading branch information
Lee Jones committed Dec 11, 2012
1 parent d2aa4a5 commit ff0d54a
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 153 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e3a71e56c8c48862015ecf1ae0b9362dc28a453
refs/heads/master: b0284de05e07d56ff7de154d0c9263788755f5eb
6 changes: 3 additions & 3 deletions trunk/drivers/power/ab8500_bmdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ struct abx500_bm_data ab8500_bm_data = {
.fg_params = &fg,
};

int __devinit bmdevs_of_probe(struct device *dev,
struct device_node *np,
struct abx500_bm_data **battery)
int __devinit ab8500_bm_of_probe(struct device *dev,
struct device_node *np,
struct abx500_bm_data **battery)
{
struct batres_vs_temp *tmp_batres_tbl;
struct device_node *np_bat_supply;
Expand Down
60 changes: 30 additions & 30 deletions trunk/drivers/power/ab8500_btemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct ab8500_btemp_ranges {
* @parent: Pointer to the struct ab8500
* @gpadc: Pointer to the struct gpadc
* @fg: Pointer to the struct fg
* @bat: Pointer to the abx500_bm platform data
* @bm: Platform specific battery management information
* @btemp_psy: Structure for BTEMP specific battery properties
* @events: Structure for information about events triggered
* @btemp_ranges: Battery temperature range structure
Expand All @@ -95,7 +95,7 @@ struct ab8500_btemp {
struct ab8500 *parent;
struct ab8500_gpadc *gpadc;
struct ab8500_fg *fg;
struct abx500_bm_data *bat;
struct abx500_bm_data *bm;
struct power_supply btemp_psy;
struct ab8500_btemp_events events;
struct ab8500_btemp_ranges btemp_ranges;
Expand Down Expand Up @@ -149,13 +149,13 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
return (450000 * (v_batctrl)) / (1800 - v_batctrl);
}

if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL) {
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL) {
/*
* If the battery has internal NTC, we use the current
* source to calculate the resistance, 7uA or 20uA
*/
rbs = (v_batctrl * 1000
- di->bat->gnd_lift_resistance * inst_curr)
- di->bm->gnd_lift_resistance * inst_curr)
/ di->curr_source;
} else {
/*
Expand Down Expand Up @@ -211,7 +211,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
return 0;

/* Only do this for batteries with internal NTC */
if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
curr = BAT_CTRL_7U_ENA;
else
Expand Down Expand Up @@ -243,7 +243,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
__func__);
goto disable_curr_source;
}
} else if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
} else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
dev_dbg(di->dev, "Disable BATCTRL curr source\n");

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

id = di->bat->batt_id;
id = di->bm->batt_id;

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

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

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

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

di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
di->bat->batt_id = BATTERY_UNKNOWN;
di->bm->batt_id = BATTERY_UNKNOWN;

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

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

di->bat->batt_id = i;
di->bm->batt_id = i;
break;
}
}

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

return di->bat->batt_id;
return di->bm->batt_id;
}

/**
Expand Down Expand Up @@ -586,9 +586,9 @@ static void ab8500_btemp_periodic_work(struct work_struct *work)
}

if (di->events.ac_conn || di->events.usb_conn)
interval = di->bat->temp_interval_chg;
interval = di->bm->temp_interval_chg;
else
interval = di->bat->temp_interval_nochg;
interval = di->bm->temp_interval_nochg;

/* Schedule a new measurement */
queue_delayed_work(di->btemp_wq,
Expand Down Expand Up @@ -815,7 +815,7 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
val->intval = 1;
break;
case POWER_SUPPLY_PROP_TECHNOLOGY:
val->intval = di->bat->bat_type[di->bat->batt_id].name;
val->intval = di->bm->bat_type[di->bm->batt_id].name;
break;
case POWER_SUPPLY_PROP_TEMP:
val->intval = ab8500_btemp_get_temp(di);
Expand Down Expand Up @@ -985,10 +985,10 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s no mem for ab8500_btemp\n", __func__);
return -ENOMEM;
}
di->bat = pdev->mfd_cell->platform_data;
if (!di->bat) {
di->bm = pdev->mfd_cell->platform_data;
if (!di->bm) {
if (np) {
ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm);
if (ret) {
dev_err(&pdev->dev,
"failed to get battery information\n");
Expand Down
24 changes: 12 additions & 12 deletions trunk/drivers/power/ab8500_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct ab8500_charger_usb_state {
* @autopower_cfg platform specific power config support for "pwron after pwrloss"
* @parent: Pointer to the struct ab8500
* @gpadc: Pointer to the struct gpadc
* @bat: Pointer to the abx500_bm platform data
* @bm: Platform specific battery management information
* @flags: Structure for information about events triggered
* @usb_state: Structure for usb stack information
* @ac_chg: AC charger power supply
Expand Down Expand Up @@ -226,7 +226,7 @@ struct ab8500_charger {
bool autopower_cfg;
struct ab8500 *parent;
struct ab8500_gpadc *gpadc;
struct abx500_bm_data *bat;
struct abx500_bm_data *bm;
struct ab8500_charger_event_flags flags;
struct ab8500_charger_usb_state usb_state;
struct ux500_charger ac_chg;
Expand Down Expand Up @@ -1034,7 +1034,7 @@ static int ab8500_charger_set_vbus_in_curr(struct ab8500_charger *di,
int min_value;

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

switch (min_value) {
case 100:
Expand Down Expand Up @@ -1176,7 +1176,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
volt_index = ab8500_voltage_to_regval(vset);
curr_index = ab8500_current_to_regval(iset);
input_curr_index = ab8500_current_to_regval(
di->bat->chg_params->ac_curr_max);
di->bm->chg_params->ac_curr_max);
if (volt_index < 0 || curr_index < 0 || input_curr_index < 0) {
dev_err(di->dev,
"Charger voltage or current too high, "
Expand All @@ -1193,7 +1193,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
}
/* MainChInputCurr: current that can be drawn from the charger*/
ret = ab8500_charger_set_main_in_curr(di,
di->bat->chg_params->ac_curr_max);
di->bm->chg_params->ac_curr_max);
if (ret) {
dev_err(di->dev, "%s Failed to set MainChInputCurr\n",
__func__);
Expand All @@ -1209,7 +1209,7 @@ static int ab8500_charger_ac_en(struct ux500_charger *charger,
}

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

/* Enable Main Charger */
Expand Down Expand Up @@ -1376,7 +1376,7 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger,
return ret;
}
/* Check if VBAT overshoot control should be enabled */
if (!di->bat->enable_overshoot)
if (!di->bm->enable_overshoot)
overshoot = USB_CHG_NO_OVERSHOOT_ENA_N;

/* Enable USB Charger */
Expand Down Expand Up @@ -2454,8 +2454,8 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
ret = abx500_set_register_interruptible(di->dev,
AB8500_RTC,
AB8500_RTC_BACKUP_CHG_REG,
di->bat->bkup_bat_v |
di->bat->bkup_bat_i);
di->bm->bkup_bat_v |
di->bm->bkup_bat_i);
if (ret) {
dev_err(di->dev, "failed to setup backup battery charging\n");
goto out;
Expand Down Expand Up @@ -2644,10 +2644,10 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s no mem for ab8500_charger\n", __func__);
return -ENOMEM;
}
di->bat = pdev->mfd_cell->platform_data;
if (!di->bat) {
di->bm = pdev->mfd_cell->platform_data;
if (!di->bm) {
if (np) {
ret = bmdevs_of_probe(&pdev->dev, np, &di->bat);
ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm);
if (ret) {
dev_err(&pdev->dev,
"failed to get battery information\n");
Expand Down
Loading

0 comments on commit ff0d54a

Please sign in to comment.