Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350583
b: refs/heads/master
c: 8e3a71e
h: refs/heads/master
i:
  350581: c9d4de7
  350579: 2216247
  350575: 46dbaec
v: v3
  • Loading branch information
Lee Jones committed Dec 11, 2012
1 parent 401c666 commit d2aa4a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 29 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: 43dc4470e3c8465b438676484280b6e4187b78e4
refs/heads/master: 8e3a71e56c8c48862015ecf1ae0b9362dc28a453
49 changes: 21 additions & 28 deletions trunk/drivers/power/ab8500_bmdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,38 +456,29 @@ int __devinit bmdevs_of_probe(struct device *dev,
struct device_node *np,
struct abx500_bm_data **battery)
{
struct abx500_battery_type *btype;
struct batres_vs_temp *tmp_batres_tbl;
struct device_node *np_bat_supply;
struct abx500_bm_data *bat;
const char *btech;
int i, thermistor;
int i;

*battery = &ab8500_bm_data;

/* get phandle to 'battery-info' node */
np_bat_supply = of_parse_phandle(np, "battery", 0);
if (!np_bat_supply) {
dev_err(dev, "missing property battery\n");
dev_err(dev, "battery node or reference missing\n");
return -EINVAL;
}

if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl"))
thermistor = NTC_INTERNAL;
else
thermistor = NTC_EXTERNAL;

bat = *battery;
if (thermistor == NTC_EXTERNAL) {
bat->n_btypes = 4;
bat->bat_type = bat_type_ext_thermistor;
bat->adc_therm = ABx500_ADC_THERM_BATTEMP;
}

btech = of_get_property(np_bat_supply, "stericsson,battery-type", NULL);
if (!btech) {
dev_warn(dev, "missing property battery-name/type\n");
return -EINVAL;
}

bat = *battery;

if (strncmp(btech, "LION", 4) == 0) {
bat->no_maintenance = true;
bat->chg_unknown_bat = true;
Expand All @@ -498,20 +489,22 @@ int __devinit bmdevs_of_probe(struct device *dev,
bat->bat_type[BATTERY_UNKNOWN].normal_vol_lvl = 4200;
}

/* select the battery resolution table */
for (i = 0; i < bat->n_btypes; ++i) {
btype = (bat->bat_type + i);
if (thermistor == NTC_EXTERNAL) {
btype->batres_tbl =
temp_to_batres_tbl_ext_thermistor;
} else if (strncmp(btech, "LION", 4) == 0) {
btype->batres_tbl =
temp_to_batres_tbl_9100;
} else {
btype->batres_tbl =
temp_to_batres_tbl_thermistor;
}
if (of_property_read_bool(np_bat_supply, "thermistor-on-batctrl")) {
if (strncmp(btech, "LION", 4) == 0)
tmp_batres_tbl = temp_to_batres_tbl_9100;
else
tmp_batres_tbl = temp_to_batres_tbl_thermistor;
} else {
bat->n_btypes = 4;
bat->bat_type = bat_type_ext_thermistor;
bat->adc_therm = ABx500_ADC_THERM_BATTEMP;
tmp_batres_tbl = temp_to_batres_tbl_ext_thermistor;
}

/* select the battery resolution table */
for (i = 0; i < bat->n_btypes; ++i)
bat->bat_type[i]->batres_tbl = tmp_batres_tbl;

of_node_put(np_bat_supply);

return 0;
Expand Down

0 comments on commit d2aa4a5

Please sign in to comment.