diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-11-30 05:09:42 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2012-12-11 03:43:53 -0500 |
commit | b0284de05e07d56ff7de154d0c9263788755f5eb (patch) | |
tree | 31821d80be26bdbc701f86192da26489d30c3d9a /drivers/power/ab8500_fg.c | |
parent | 8e3a71e56c8c48862015ecf1ae0b9362dc28a453 (diff) |
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>
Diffstat (limited to 'drivers/power/ab8500_fg.c')
-rw-r--r-- | drivers/power/ab8500_fg.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 5a9f58d4c0fb..4cf231375de3 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -173,7 +173,7 @@ struct inst_curr_result_list { | |||
173 | * @avg_cap: Average capacity filter | 173 | * @avg_cap: Average capacity filter |
174 | * @parent: Pointer to the struct ab8500 | 174 | * @parent: Pointer to the struct ab8500 |
175 | * @gpadc: Pointer to the struct gpadc | 175 | * @gpadc: Pointer to the struct gpadc |
176 | * @bat: Pointer to the abx500_bm platform data | 176 | * @bm: Platform specific battery management information |
177 | * @fg_psy: Structure that holds the FG specific battery properties | 177 | * @fg_psy: Structure that holds the FG specific battery properties |
178 | * @fg_wq: Work queue for running the FG algorithm | 178 | * @fg_wq: Work queue for running the FG algorithm |
179 | * @fg_periodic_work: Work to run the FG algorithm periodically | 179 | * @fg_periodic_work: Work to run the FG algorithm periodically |
@@ -212,7 +212,7 @@ struct ab8500_fg { | |||
212 | struct ab8500_fg_avg_cap avg_cap; | 212 | struct ab8500_fg_avg_cap avg_cap; |
213 | struct ab8500 *parent; | 213 | struct ab8500 *parent; |
214 | struct ab8500_gpadc *gpadc; | 214 | struct ab8500_gpadc *gpadc; |
215 | struct abx500_bm_data *bat; | 215 | struct abx500_bm_data *bm; |
216 | struct power_supply fg_psy; | 216 | struct power_supply fg_psy; |
217 | struct workqueue_struct *fg_wq; | 217 | struct workqueue_struct *fg_wq; |
218 | struct delayed_work fg_periodic_work; | 218 | struct delayed_work fg_periodic_work; |
@@ -355,7 +355,7 @@ static int ab8500_fg_is_low_curr(struct ab8500_fg *di, int curr) | |||
355 | /* | 355 | /* |
356 | * We want to know if we're in low current mode | 356 | * We want to know if we're in low current mode |
357 | */ | 357 | */ |
358 | if (curr > -di->bat->fg_params->high_curr_threshold) | 358 | if (curr > -di->bm->fg_params->high_curr_threshold) |
359 | return true; | 359 | return true; |
360 | else | 360 | else |
361 | return false; | 361 | return false; |
@@ -648,7 +648,7 @@ int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res) | |||
648 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm | 648 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm |
649 | */ | 649 | */ |
650 | val = (val * QLSB_NANO_AMP_HOURS_X10 * 36 * 4) / | 650 | val = (val * QLSB_NANO_AMP_HOURS_X10 * 36 * 4) / |
651 | (1000 * di->bat->fg_res); | 651 | (1000 * di->bm->fg_res); |
652 | 652 | ||
653 | if (di->turn_off_fg) { | 653 | if (di->turn_off_fg) { |
654 | dev_dbg(di->dev, "%s Disable FG\n", __func__); | 654 | dev_dbg(di->dev, "%s Disable FG\n", __func__); |
@@ -751,7 +751,7 @@ static void ab8500_fg_acc_cur_work(struct work_struct *work) | |||
751 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm | 751 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm |
752 | */ | 752 | */ |
753 | di->accu_charge = (val * QLSB_NANO_AMP_HOURS_X10) / | 753 | di->accu_charge = (val * QLSB_NANO_AMP_HOURS_X10) / |
754 | (100 * di->bat->fg_res); | 754 | (100 * di->bm->fg_res); |
755 | 755 | ||
756 | /* | 756 | /* |
757 | * Convert to unit value in mA | 757 | * Convert to unit value in mA |
@@ -763,7 +763,7 @@ static void ab8500_fg_acc_cur_work(struct work_struct *work) | |||
763 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm | 763 | * 112.9nAh assumes 10mOhm, but fg_res is in 0.1mOhm |
764 | */ | 764 | */ |
765 | di->avg_curr = (val * QLSB_NANO_AMP_HOURS_X10 * 36) / | 765 | di->avg_curr = (val * QLSB_NANO_AMP_HOURS_X10 * 36) / |
766 | (1000 * di->bat->fg_res * (di->fg_samples / 4)); | 766 | (1000 * di->bm->fg_res * (di->fg_samples / 4)); |
767 | 767 | ||
768 | di->flags.conv_done = true; | 768 | di->flags.conv_done = true; |
769 | 769 | ||
@@ -815,8 +815,8 @@ static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) | |||
815 | struct abx500_v_to_cap *tbl; | 815 | struct abx500_v_to_cap *tbl; |
816 | int cap = 0; | 816 | int cap = 0; |
817 | 817 | ||
818 | tbl = di->bat->bat_type[di->bat->batt_id].v_to_cap_tbl, | 818 | tbl = di->bm->bat_type[di->bm->batt_id].v_to_cap_tbl, |
819 | tbl_size = di->bat->bat_type[di->bat->batt_id].n_v_cap_tbl_elements; | 819 | tbl_size = di->bm->bat_type[di->bm->batt_id].n_v_cap_tbl_elements; |
820 | 820 | ||
821 | for (i = 0; i < tbl_size; ++i) { | 821 | for (i = 0; i < tbl_size; ++i) { |
822 | if (voltage > tbl[i].voltage) | 822 | if (voltage > tbl[i].voltage) |
@@ -867,8 +867,8 @@ static int ab8500_fg_battery_resistance(struct ab8500_fg *di) | |||
867 | struct batres_vs_temp *tbl; | 867 | struct batres_vs_temp *tbl; |
868 | int resist = 0; | 868 | int resist = 0; |
869 | 869 | ||
870 | tbl = di->bat->bat_type[di->bat->batt_id].batres_tbl; | 870 | tbl = di->bm->bat_type[di->bm->batt_id].batres_tbl; |
871 | tbl_size = di->bat->bat_type[di->bat->batt_id].n_batres_tbl_elements; | 871 | tbl_size = di->bm->bat_type[di->bm->batt_id].n_batres_tbl_elements; |
872 | 872 | ||
873 | for (i = 0; i < tbl_size; ++i) { | 873 | for (i = 0; i < tbl_size; ++i) { |
874 | if (di->bat_temp / 10 > tbl[i].temp) | 874 | if (di->bat_temp / 10 > tbl[i].temp) |
@@ -889,11 +889,11 @@ static int ab8500_fg_battery_resistance(struct ab8500_fg *di) | |||
889 | 889 | ||
890 | dev_dbg(di->dev, "%s Temp: %d battery internal resistance: %d" | 890 | dev_dbg(di->dev, "%s Temp: %d battery internal resistance: %d" |
891 | " fg resistance %d, total: %d (mOhm)\n", | 891 | " fg resistance %d, total: %d (mOhm)\n", |
892 | __func__, di->bat_temp, resist, di->bat->fg_res / 10, | 892 | __func__, di->bat_temp, resist, di->bm->fg_res / 10, |
893 | (di->bat->fg_res / 10) + resist); | 893 | (di->bm->fg_res / 10) + resist); |
894 | 894 | ||
895 | /* fg_res variable is in 0.1mOhm */ | 895 | /* fg_res variable is in 0.1mOhm */ |
896 | resist += di->bat->fg_res / 10; | 896 | resist += di->bm->fg_res / 10; |
897 | 897 | ||
898 | return resist; | 898 | return resist; |
899 | } | 899 | } |
@@ -1111,14 +1111,14 @@ static int ab8500_fg_capacity_level(struct ab8500_fg *di) | |||
1111 | 1111 | ||
1112 | percent = di->bat_cap.permille / 10; | 1112 | percent = di->bat_cap.permille / 10; |
1113 | 1113 | ||
1114 | if (percent <= di->bat->cap_levels->critical || | 1114 | if (percent <= di->bm->cap_levels->critical || |
1115 | di->flags.low_bat) | 1115 | di->flags.low_bat) |
1116 | ret = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; | 1116 | ret = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; |
1117 | else if (percent <= di->bat->cap_levels->low) | 1117 | else if (percent <= di->bm->cap_levels->low) |
1118 | ret = POWER_SUPPLY_CAPACITY_LEVEL_LOW; | 1118 | ret = POWER_SUPPLY_CAPACITY_LEVEL_LOW; |
1119 | else if (percent <= di->bat->cap_levels->normal) | 1119 | else if (percent <= di->bm->cap_levels->normal) |
1120 | ret = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; | 1120 | ret = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; |
1121 | else if (percent <= di->bat->cap_levels->high) | 1121 | else if (percent <= di->bm->cap_levels->high) |
1122 | ret = POWER_SUPPLY_CAPACITY_LEVEL_HIGH; | 1122 | ret = POWER_SUPPLY_CAPACITY_LEVEL_HIGH; |
1123 | else | 1123 | else |
1124 | ret = POWER_SUPPLY_CAPACITY_LEVEL_FULL; | 1124 | ret = POWER_SUPPLY_CAPACITY_LEVEL_FULL; |
@@ -1183,7 +1183,7 @@ static void ab8500_fg_check_capacity_limits(struct ab8500_fg *di, bool init) | |||
1183 | di->bat_cap.prev_percent != | 1183 | di->bat_cap.prev_percent != |
1184 | (di->bat_cap.permille) / 10 && | 1184 | (di->bat_cap.permille) / 10 && |
1185 | (di->bat_cap.permille / 10) < | 1185 | (di->bat_cap.permille / 10) < |
1186 | di->bat->fg_params->maint_thres) { | 1186 | di->bm->fg_params->maint_thres) { |
1187 | dev_dbg(di->dev, | 1187 | dev_dbg(di->dev, |
1188 | "battery reported full " | 1188 | "battery reported full " |
1189 | "but capacity dropping: %d\n", | 1189 | "but capacity dropping: %d\n", |
@@ -1285,7 +1285,7 @@ static void ab8500_fg_algorithm_charging(struct ab8500_fg *di) | |||
1285 | switch (di->charge_state) { | 1285 | switch (di->charge_state) { |
1286 | case AB8500_FG_CHARGE_INIT: | 1286 | case AB8500_FG_CHARGE_INIT: |
1287 | di->fg_samples = SEC_TO_SAMPLE( | 1287 | di->fg_samples = SEC_TO_SAMPLE( |
1288 | di->bat->fg_params->accu_charging); | 1288 | di->bm->fg_params->accu_charging); |
1289 | 1289 | ||
1290 | ab8500_fg_coulomb_counter(di, true); | 1290 | ab8500_fg_coulomb_counter(di, true); |
1291 | ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_READOUT); | 1291 | ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_READOUT); |
@@ -1347,8 +1347,8 @@ static bool check_sysfs_capacity(struct ab8500_fg *di) | |||
1347 | cap_permille = ab8500_fg_convert_mah_to_permille(di, | 1347 | cap_permille = ab8500_fg_convert_mah_to_permille(di, |
1348 | di->bat_cap.user_mah); | 1348 | di->bat_cap.user_mah); |
1349 | 1349 | ||
1350 | lower = di->bat_cap.permille - di->bat->fg_params->user_cap_limit * 10; | 1350 | lower = di->bat_cap.permille - di->bm->fg_params->user_cap_limit * 10; |
1351 | upper = di->bat_cap.permille + di->bat->fg_params->user_cap_limit * 10; | 1351 | upper = di->bat_cap.permille + di->bm->fg_params->user_cap_limit * 10; |
1352 | 1352 | ||
1353 | if (lower < 0) | 1353 | if (lower < 0) |
1354 | lower = 0; | 1354 | lower = 0; |
@@ -1388,7 +1388,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1388 | case AB8500_FG_DISCHARGE_INIT: | 1388 | case AB8500_FG_DISCHARGE_INIT: |
1389 | /* We use the FG IRQ to work on */ | 1389 | /* We use the FG IRQ to work on */ |
1390 | di->init_cnt = 0; | 1390 | di->init_cnt = 0; |
1391 | di->fg_samples = SEC_TO_SAMPLE(di->bat->fg_params->init_timer); | 1391 | di->fg_samples = SEC_TO_SAMPLE(di->bm->fg_params->init_timer); |
1392 | ab8500_fg_coulomb_counter(di, true); | 1392 | ab8500_fg_coulomb_counter(di, true); |
1393 | ab8500_fg_discharge_state_to(di, | 1393 | ab8500_fg_discharge_state_to(di, |
1394 | AB8500_FG_DISCHARGE_INITMEASURING); | 1394 | AB8500_FG_DISCHARGE_INITMEASURING); |
@@ -1401,17 +1401,17 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1401 | * samples to get an initial capacity. | 1401 | * samples to get an initial capacity. |
1402 | * Then go to READOUT | 1402 | * Then go to READOUT |
1403 | */ | 1403 | */ |
1404 | sleep_time = di->bat->fg_params->init_timer; | 1404 | sleep_time = di->bm->fg_params->init_timer; |
1405 | 1405 | ||
1406 | /* Discard the first [x] seconds */ | 1406 | /* Discard the first [x] seconds */ |
1407 | if (di->init_cnt > di->bat->fg_params->init_discard_time) { | 1407 | if (di->init_cnt > di->bm->fg_params->init_discard_time) { |
1408 | ab8500_fg_calc_cap_discharge_voltage(di, true); | 1408 | ab8500_fg_calc_cap_discharge_voltage(di, true); |
1409 | 1409 | ||
1410 | ab8500_fg_check_capacity_limits(di, true); | 1410 | ab8500_fg_check_capacity_limits(di, true); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | di->init_cnt += sleep_time; | 1413 | di->init_cnt += sleep_time; |
1414 | if (di->init_cnt > di->bat->fg_params->init_total_time) | 1414 | if (di->init_cnt > di->bm->fg_params->init_total_time) |
1415 | ab8500_fg_discharge_state_to(di, | 1415 | ab8500_fg_discharge_state_to(di, |
1416 | AB8500_FG_DISCHARGE_READOUT_INIT); | 1416 | AB8500_FG_DISCHARGE_READOUT_INIT); |
1417 | 1417 | ||
@@ -1426,7 +1426,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1426 | /* Intentional fallthrough */ | 1426 | /* Intentional fallthrough */ |
1427 | 1427 | ||
1428 | case AB8500_FG_DISCHARGE_RECOVERY: | 1428 | case AB8500_FG_DISCHARGE_RECOVERY: |
1429 | sleep_time = di->bat->fg_params->recovery_sleep_timer; | 1429 | sleep_time = di->bm->fg_params->recovery_sleep_timer; |
1430 | 1430 | ||
1431 | /* | 1431 | /* |
1432 | * We should check the power consumption | 1432 | * We should check the power consumption |
@@ -1438,9 +1438,9 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1438 | 1438 | ||
1439 | if (ab8500_fg_is_low_curr(di, di->inst_curr)) { | 1439 | if (ab8500_fg_is_low_curr(di, di->inst_curr)) { |
1440 | if (di->recovery_cnt > | 1440 | if (di->recovery_cnt > |
1441 | di->bat->fg_params->recovery_total_time) { | 1441 | di->bm->fg_params->recovery_total_time) { |
1442 | di->fg_samples = SEC_TO_SAMPLE( | 1442 | di->fg_samples = SEC_TO_SAMPLE( |
1443 | di->bat->fg_params->accu_high_curr); | 1443 | di->bm->fg_params->accu_high_curr); |
1444 | ab8500_fg_coulomb_counter(di, true); | 1444 | ab8500_fg_coulomb_counter(di, true); |
1445 | ab8500_fg_discharge_state_to(di, | 1445 | ab8500_fg_discharge_state_to(di, |
1446 | AB8500_FG_DISCHARGE_READOUT); | 1446 | AB8500_FG_DISCHARGE_READOUT); |
@@ -1453,7 +1453,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1453 | di->recovery_cnt += sleep_time; | 1453 | di->recovery_cnt += sleep_time; |
1454 | } else { | 1454 | } else { |
1455 | di->fg_samples = SEC_TO_SAMPLE( | 1455 | di->fg_samples = SEC_TO_SAMPLE( |
1456 | di->bat->fg_params->accu_high_curr); | 1456 | di->bm->fg_params->accu_high_curr); |
1457 | ab8500_fg_coulomb_counter(di, true); | 1457 | ab8500_fg_coulomb_counter(di, true); |
1458 | ab8500_fg_discharge_state_to(di, | 1458 | ab8500_fg_discharge_state_to(di, |
1459 | AB8500_FG_DISCHARGE_READOUT); | 1459 | AB8500_FG_DISCHARGE_READOUT); |
@@ -1462,7 +1462,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1462 | 1462 | ||
1463 | case AB8500_FG_DISCHARGE_READOUT_INIT: | 1463 | case AB8500_FG_DISCHARGE_READOUT_INIT: |
1464 | di->fg_samples = SEC_TO_SAMPLE( | 1464 | di->fg_samples = SEC_TO_SAMPLE( |
1465 | di->bat->fg_params->accu_high_curr); | 1465 | di->bm->fg_params->accu_high_curr); |
1466 | ab8500_fg_coulomb_counter(di, true); | 1466 | ab8500_fg_coulomb_counter(di, true); |
1467 | ab8500_fg_discharge_state_to(di, | 1467 | ab8500_fg_discharge_state_to(di, |
1468 | AB8500_FG_DISCHARGE_READOUT); | 1468 | AB8500_FG_DISCHARGE_READOUT); |
@@ -1509,9 +1509,9 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | di->high_curr_cnt += | 1511 | di->high_curr_cnt += |
1512 | di->bat->fg_params->accu_high_curr; | 1512 | di->bm->fg_params->accu_high_curr; |
1513 | if (di->high_curr_cnt > | 1513 | if (di->high_curr_cnt > |
1514 | di->bat->fg_params->high_curr_time) | 1514 | di->bm->fg_params->high_curr_time) |
1515 | di->recovery_needed = true; | 1515 | di->recovery_needed = true; |
1516 | 1516 | ||
1517 | ab8500_fg_calc_cap_discharge_fg(di); | 1517 | ab8500_fg_calc_cap_discharge_fg(di); |
@@ -1528,7 +1528,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) | |||
1528 | ab8500_fg_calc_cap_discharge_voltage(di, true); | 1528 | ab8500_fg_calc_cap_discharge_voltage(di, true); |
1529 | 1529 | ||
1530 | di->fg_samples = SEC_TO_SAMPLE( | 1530 | di->fg_samples = SEC_TO_SAMPLE( |
1531 | di->bat->fg_params->accu_high_curr); | 1531 | di->bm->fg_params->accu_high_curr); |
1532 | ab8500_fg_coulomb_counter(di, true); | 1532 | ab8500_fg_coulomb_counter(di, true); |
1533 | ab8500_fg_discharge_state_to(di, | 1533 | ab8500_fg_discharge_state_to(di, |
1534 | AB8500_FG_DISCHARGE_READOUT); | 1534 | AB8500_FG_DISCHARGE_READOUT); |
@@ -1721,7 +1721,7 @@ static void ab8500_fg_low_bat_work(struct work_struct *work) | |||
1721 | vbat = ab8500_fg_bat_voltage(di); | 1721 | vbat = ab8500_fg_bat_voltage(di); |
1722 | 1722 | ||
1723 | /* Check if LOW_BAT still fulfilled */ | 1723 | /* Check if LOW_BAT still fulfilled */ |
1724 | if (vbat < di->bat->fg_params->lowbat_threshold) { | 1724 | if (vbat < di->bm->fg_params->lowbat_threshold) { |
1725 | di->flags.low_bat = true; | 1725 | di->flags.low_bat = true; |
1726 | dev_warn(di->dev, "Battery voltage still LOW\n"); | 1726 | dev_warn(di->dev, "Battery voltage still LOW\n"); |
1727 | 1727 | ||
@@ -1779,8 +1779,8 @@ static int ab8500_fg_battok_init_hw_register(struct ab8500_fg *di) | |||
1779 | int ret; | 1779 | int ret; |
1780 | int new_val; | 1780 | int new_val; |
1781 | 1781 | ||
1782 | sel0 = di->bat->fg_params->battok_falling_th_sel0; | 1782 | sel0 = di->bm->fg_params->battok_falling_th_sel0; |
1783 | sel1 = di->bat->fg_params->battok_raising_th_sel1; | 1783 | sel1 = di->bm->fg_params->battok_raising_th_sel1; |
1784 | 1784 | ||
1785 | cbp_sel0 = ab8500_fg_battok_calc(di, sel0); | 1785 | cbp_sel0 = ab8500_fg_battok_calc(di, sel0); |
1786 | cbp_sel1 = ab8500_fg_battok_calc(di, sel1); | 1786 | cbp_sel1 = ab8500_fg_battok_calc(di, sel1); |
@@ -1963,7 +1963,7 @@ static int ab8500_fg_get_property(struct power_supply *psy, | |||
1963 | di->bat_cap.max_mah); | 1963 | di->bat_cap.max_mah); |
1964 | break; | 1964 | break; |
1965 | case POWER_SUPPLY_PROP_ENERGY_NOW: | 1965 | case POWER_SUPPLY_PROP_ENERGY_NOW: |
1966 | if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && | 1966 | if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && |
1967 | di->flags.batt_id_received) | 1967 | di->flags.batt_id_received) |
1968 | val->intval = ab8500_fg_convert_mah_to_uwh(di, | 1968 | val->intval = ab8500_fg_convert_mah_to_uwh(di, |
1969 | di->bat_cap.max_mah); | 1969 | di->bat_cap.max_mah); |
@@ -1978,21 +1978,21 @@ static int ab8500_fg_get_property(struct power_supply *psy, | |||
1978 | val->intval = di->bat_cap.max_mah; | 1978 | val->intval = di->bat_cap.max_mah; |
1979 | break; | 1979 | break; |
1980 | case POWER_SUPPLY_PROP_CHARGE_NOW: | 1980 | case POWER_SUPPLY_PROP_CHARGE_NOW: |
1981 | if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && | 1981 | if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && |
1982 | di->flags.batt_id_received) | 1982 | di->flags.batt_id_received) |
1983 | val->intval = di->bat_cap.max_mah; | 1983 | val->intval = di->bat_cap.max_mah; |
1984 | else | 1984 | else |
1985 | val->intval = di->bat_cap.prev_mah; | 1985 | val->intval = di->bat_cap.prev_mah; |
1986 | break; | 1986 | break; |
1987 | case POWER_SUPPLY_PROP_CAPACITY: | 1987 | case POWER_SUPPLY_PROP_CAPACITY: |
1988 | if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && | 1988 | if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && |
1989 | di->flags.batt_id_received) | 1989 | di->flags.batt_id_received) |
1990 | val->intval = 100; | 1990 | val->intval = 100; |
1991 | else | 1991 | else |
1992 | val->intval = di->bat_cap.prev_percent; | 1992 | val->intval = di->bat_cap.prev_percent; |
1993 | break; | 1993 | break; |
1994 | case POWER_SUPPLY_PROP_CAPACITY_LEVEL: | 1994 | case POWER_SUPPLY_PROP_CAPACITY_LEVEL: |
1995 | if (di->flags.batt_unknown && !di->bat->chg_unknown_bat && | 1995 | if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && |
1996 | di->flags.batt_id_received) | 1996 | di->flags.batt_id_received) |
1997 | val->intval = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; | 1997 | val->intval = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; |
1998 | else | 1998 | else |
@@ -2078,7 +2078,7 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data) | |||
2078 | if (!di->flags.batt_id_received) { | 2078 | if (!di->flags.batt_id_received) { |
2079 | const struct abx500_battery_type *b; | 2079 | const struct abx500_battery_type *b; |
2080 | 2080 | ||
2081 | b = &(di->bat->bat_type[di->bat->batt_id]); | 2081 | b = &(di->bm->bat_type[di->bm->batt_id]); |
2082 | 2082 | ||
2083 | di->flags.batt_id_received = true; | 2083 | di->flags.batt_id_received = true; |
2084 | 2084 | ||
@@ -2155,7 +2155,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di) | |||
2155 | AB8500_SYS_CTRL2_BLOCK, | 2155 | AB8500_SYS_CTRL2_BLOCK, |
2156 | AB8500_LOW_BAT_REG, | 2156 | AB8500_LOW_BAT_REG, |
2157 | ab8500_volt_to_regval( | 2157 | ab8500_volt_to_regval( |
2158 | di->bat->fg_params->lowbat_threshold) << 1 | | 2158 | di->bm->fg_params->lowbat_threshold) << 1 | |
2159 | LOW_BAT_ENABLE); | 2159 | LOW_BAT_ENABLE); |
2160 | if (ret) { | 2160 | if (ret) { |
2161 | dev_err(di->dev, "%s write failed\n", __func__); | 2161 | dev_err(di->dev, "%s write failed\n", __func__); |
@@ -2457,10 +2457,10 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) | |||
2457 | dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__); | 2457 | dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__); |
2458 | return -ENOMEM; | 2458 | return -ENOMEM; |
2459 | } | 2459 | } |
2460 | di->bat = pdev->mfd_cell->platform_data; | 2460 | di->bm = pdev->mfd_cell->platform_data; |
2461 | if (!di->bat) { | 2461 | if (!di->bm) { |
2462 | if (np) { | 2462 | if (np) { |
2463 | ret = bmdevs_of_probe(&pdev->dev, np, &di->bat); | 2463 | ret = ab8500_bm_of_probe(&pdev->dev, np, &di->bm); |
2464 | if (ret) { | 2464 | if (ret) { |
2465 | dev_err(&pdev->dev, | 2465 | dev_err(&pdev->dev, |
2466 | "failed to get battery information\n"); | 2466 | "failed to get battery information\n"); |
@@ -2491,11 +2491,11 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) | |||
2491 | di->fg_psy.external_power_changed = ab8500_fg_external_power_changed; | 2491 | di->fg_psy.external_power_changed = ab8500_fg_external_power_changed; |
2492 | 2492 | ||
2493 | di->bat_cap.max_mah_design = MILLI_TO_MICRO * | 2493 | di->bat_cap.max_mah_design = MILLI_TO_MICRO * |
2494 | di->bat->bat_type[di->bat->batt_id].charge_full_design; | 2494 | di->bm->bat_type[di->bm->batt_id].charge_full_design; |
2495 | 2495 | ||
2496 | di->bat_cap.max_mah = di->bat_cap.max_mah_design; | 2496 | di->bat_cap.max_mah = di->bat_cap.max_mah_design; |
2497 | 2497 | ||
2498 | di->vbat_nom = di->bat->bat_type[di->bat->batt_id].nominal_voltage; | 2498 | di->vbat_nom = di->bm->bat_type[di->bm->batt_id].nominal_voltage; |
2499 | 2499 | ||
2500 | di->init_capacity = true; | 2500 | di->init_capacity = true; |
2501 | 2501 | ||
@@ -2549,7 +2549,7 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) | |||
2549 | goto free_inst_curr_wq; | 2549 | goto free_inst_curr_wq; |
2550 | } | 2550 | } |
2551 | 2551 | ||
2552 | di->fg_samples = SEC_TO_SAMPLE(di->bat->fg_params->init_timer); | 2552 | di->fg_samples = SEC_TO_SAMPLE(di->bm->fg_params->init_timer); |
2553 | ab8500_fg_coulomb_counter(di, true); | 2553 | ab8500_fg_coulomb_counter(di, true); |
2554 | 2554 | ||
2555 | /* Initialize completion used to notify completion of inst current */ | 2555 | /* Initialize completion used to notify completion of inst current */ |