diff options
author | Johan Gardsmark <johan.gardsmark@stericsson.com> | 2011-02-21 13:52:35 +0100 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-02-23 11:54:19 +0100 |
commit | 5326512be3ff90893f2084187322dec59f0c8d15 (patch) | |
tree | d307dd11ba7aeb68367f7300277f62136ff266f0 /drivers/power | |
parent | a40486d6572a8bc2768d242c9c7689a00c375b59 (diff) |
ARM: ux500: Move board specific bm parameters
This patch moves the board specific charger and battery parameters
to a separate file. Also, some parameter names are corrected and
simplified.
ST-Ericsson ID: WP325165
Change-Id: I90aedb1b623f85f1c877afbe44aa8c802f5fd640
Signed-off-by: Johan Gardsmark <johan.gardsmark@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/16609
Reviewed-by: Johan PALSSON <johan.palsson@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/Kconfig | 10 | ||||
-rw-r--r-- | drivers/power/ab8500_btemp.c | 31 | ||||
-rw-r--r-- | drivers/power/ab8500_chargalg.c | 16 |
3 files changed, 29 insertions, 28 deletions
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index c767b332e14..8530dcab2e0 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -146,12 +146,12 @@ config AB8500_BM bool "AB8500 Battery Management Driver" depends on AB8500_CORE && AB8500_GPADC && ARCH_U8500 help - say Y to include support for AB8500 battery management. + Say Y to include support for AB8500 battery management. -config BATTERY_PACK_INT_NTC - bool "NTC resistor placed in battery pack" +config AB8500_BATTERY_THERM_ON_BATCTRL + bool "Thermistor connected on BATCTRL ADC" depends on AB8500_BM help - Say Y to enable support for the battery with an internal battery - pack NTC resistor combined with an ID resistor. + Say Y to enable battery temperature measurements using + thermistor connected on BATCTRL ADC. endif # POWER_SUPPLY diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index f8e0f78564d..9a814f7d470 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -130,7 +130,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, rbs = (450000 * (v_batctrl)) / (1800 - v_batctrl); break; default: - if (di->bat->therm == THERM_BATTERY_PACK) { + if (di->bat->adc_therm == ADC_THERM_BATCTRL) { /* * If the battery has internal NTC, we use the current * source to calculate the resistance, 7uA or 20uA @@ -192,7 +192,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->therm == THERM_BATTERY_PACK && enable) { + if (di->bat->adc_therm == ADC_THERM_BATCTRL && enable) { if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) curr = BAT_CTRL_7U_ENA; else @@ -224,7 +224,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, __func__); goto disable_curr_source; } - } else if (di->bat->therm == THERM_BATTERY_PACK && !enable) { + } else if (di->bat->adc_therm == ADC_THERM_BATCTRL && !enable) { dev_dbg(di->dev, "Disable BATCTRL curr source\n"); /* Write 0 to the curr bits */ @@ -401,12 +401,12 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di) int temp; static int prev; int rbat, rntc, vntc; - u8 t; + u8 id; - if (di->bat->therm == THERM_BATTERY_PACK && - di->bat->batt_id != BATTERY_UNKNOWN) { + id = di->bat->batt_id; - t = di->bat->batt_id; + if (di->bat->adc_therm == ADC_THERM_BATCTRL && + id != BATTERY_UNKNOWN) { rbat = ab8500_btemp_get_batctrl_res(di); if (rbat < 0) { @@ -420,8 +420,8 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di) } temp = ab8500_btemp_res_to_temp(di, - di->bat->bat_type[t].r_to_t_tbl, - di->bat->bat_type[t].n_temp_tbl_elements, rbat); + di->bat->bat_type[id].r_to_t_tbl, + di->bat->bat_type[id].n_temp_tbl_elements, rbat); } else { vntc = ab8500_gpadc_convert(di->gpadc, BTEMP_BALL); if (vntc < 0) { @@ -436,8 +436,9 @@ 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->pcb_ntc, - di->bat->n_temp_tbl_elements, rntc); + 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); prev = temp; } dev_dbg(di->dev, "Battery temperature is %d\n", temp); @@ -470,11 +471,11 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) 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)) { - dev_dbg(di->dev, "Battery detected" - " as thermistor type: %d" + dev_dbg(di->dev, "Battery detected on %s" " low %d < res %d < high: %d" " index: %d\n", - di->bat->therm, + di->bat->adc_therm == ADC_THERM_BATCTRL ? + "BATCTRL" : "BATTEMP", di->bat->bat_type[i].resis_low, res, di->bat->bat_type[i].resis_high, i); @@ -493,7 +494,7 @@ 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->therm == THERM_BATTERY_PACK && di->bat->batt_id == 1) { + if (di->bat->adc_therm == ADC_THERM_BATCTRL && di->bat->batt_id == 1) { dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; } diff --git a/drivers/power/ab8500_chargalg.c b/drivers/power/ab8500_chargalg.c index 96c20df02b8..051b0d38488 100644 --- a/drivers/power/ab8500_chargalg.c +++ b/drivers/power/ab8500_chargalg.c @@ -1192,8 +1192,8 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) case STATE_NORMAL_INIT: ab8500_chargalg_start_charging(di, - di->bat->bat_type[di->bat->batt_id].normal_ip_vol_lvl, - di->bat->bat_type[di->bat->batt_id].normal_op_cur_lvl); + di->bat->bat_type[di->bat->batt_id].normal_vol_lvl, + di->bat->bat_type[di->bat->batt_id].normal_cur_lvl); ab8500_chargalg_state_to(di, STATE_NORMAL); ab8500_chargalg_start_safety_timer(di); ab8500_chargalg_stop_maintenance_timer(di); @@ -1220,9 +1220,9 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) di->bat->batt_id].maint_a_chg_timer_h); ab8500_chargalg_start_charging(di, di->bat->bat_type[ - di->bat->batt_id].maint_a_ip_vol_lvl, + di->bat->batt_id].maint_a_vol_lvl, di->bat->bat_type[ - di->bat->batt_id].maint_a_op_cur_lvl); + di->bat->batt_id].maint_a_cur_lvl); ab8500_chargalg_state_to(di, STATE_MAINTENANCE_A); power_supply_changed(&di->chargalg_psy); /* Intentional fallthrough*/ @@ -1241,9 +1241,9 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) di->bat->batt_id].maint_b_chg_timer_h); ab8500_chargalg_start_charging(di, di->bat->bat_type[ - di->bat->batt_id].maint_b_ip_vol_lvl, + di->bat->batt_id].maint_b_vol_lvl, di->bat->bat_type[ - di->bat->batt_id].maint_b_op_cur_lvl); + di->bat->batt_id].maint_b_cur_lvl); ab8500_chargalg_state_to(di, STATE_MAINTENANCE_B); power_supply_changed(&di->chargalg_psy); /* Intentional fallthrough*/ @@ -1259,9 +1259,9 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di) case STATE_TEMP_LOWHIGH_INIT: ab8500_chargalg_start_charging(di, di->bat->bat_type[ - di->bat->batt_id].low_high_ip_vol_lvl, + di->bat->batt_id].low_high_vol_lvl, di->bat->bat_type[ - di->bat->batt_id].low_high_op_cur_lvl); + di->bat->batt_id].low_high_cur_lvl); ab8500_chargalg_stop_maintenance_timer(di); di->charge_status = POWER_SUPPLY_STATUS_CHARGING; ab8500_chargalg_state_to(di, STATE_TEMP_LOWHIGH); |