diff options
author | Gregory Hermant <gregory.hermant@calao-systems.com> | 2012-01-09 16:05:16 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:01:16 +0200 |
commit | 6a0539427c26331555fb63ac77fed4685fb4c4b7 (patch) | |
tree | 2625e0f1f792efa17108c2bc26b4f9136d930031 | |
parent | 4d065fcbb3d121c28d06e2201cf9c3fc93d848c1 (diff) |
Add support for the 9100 Li-ION battery and adjust the bkup battery charger parameters
Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-bm.c | 56 | ||||
-rw-r--r-- | drivers/power/Kconfig | 6 | ||||
-rw-r--r-- | drivers/power/ab8500_charger.c | 18 |
3 files changed, 75 insertions, 5 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-bm.c b/arch/arm/mach-ux500/board-mop500-bm.c index 1d13eb82ba2..400f89a85cc 100644 --- a/arch/arm/mach-ux500/board-mop500-bm.c +++ b/arch/arm/mach-ux500/board-mop500-bm.c @@ -149,6 +149,40 @@ static struct res_to_temp temp_tbl[] = { {65, 9425}, }; +#ifdef CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL +/* + * Note that the batres_vs_temp table must be strictly sorted by falling + * temperature values to work. + */ +static struct batres_vs_temp temp_to_batres_tbl[] = { + { 40, 120}, + { 30, 135}, + { 20, 165}, + { 10, 230}, + { 00, 325}, + {-10, 445}, + {-20, 595}, +}; +#else +/* + * Note that the batres_vs_temp table must be strictly sorted by falling + * temperature values to work. + */ +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY +#define BATRES 180 +#else +#define BATRES 300 +#endif +static struct batres_vs_temp temp_to_batres_tbl[] = { + { 60, BATRES}, + { 30, BATRES}, + { 20, BATRES}, + { 10, BATRES}, + { 00, BATRES}, + {-10, BATRES}, + {-20, BATRES}, +}; +#endif static const struct battery_type bat_type[] = { [BATTERY_UNKNOWN] = { /* First element always represent the UNKNOWN battery */ @@ -156,13 +190,27 @@ static const struct battery_type bat_type[] = { .resis_high = 0, .resis_low = 0, .battery_resistance = 300, +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY + .charge_full_design = 2600, +#else .charge_full_design = 612, +#endif .nominal_voltage = 3700, +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY + .termination_vol = 4150, +#else .termination_vol = 4050, +#endif .termination_curr = 200, +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY + .recharge_vol = 4130, + .normal_cur_lvl = 520, + .normal_vol_lvl = 4200, +#else .recharge_vol = 3990, .normal_cur_lvl = 400, .normal_vol_lvl = 4100, +#endif .maint_a_cur_lvl = 400, .maint_a_vol_lvl = 4050, .maint_a_chg_timer_h = 60, @@ -404,13 +452,21 @@ struct ab8500_bm_data ab8500_bm_data = { .usb_safety_tmr_h = 4, .bkup_bat_v = BUP_VCH_SEL_2P6V, .bkup_bat_i = BUP_ICH_SEL_150UA, +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY + .no_maintenance = true, +#else .no_maintenance = false, +#endif #ifdef CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL .adc_therm = ADC_THERM_BATCTRL, #else .adc_therm = ADC_THERM_BATTEMP, #endif +#ifdef CONFIG_AB8500_9100_LI_ION_BATTERY + .chg_unknown_bat = true, +#else .chg_unknown_bat = false, +#endif .enable_overshoot = false, .fg_res = 100, .cap_levels = &cap_levels, diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 0626dfa9ff6..56dfe432b74 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -308,6 +308,12 @@ config AB8500_BATTERY_THERM_ON_BATCTRL Say Y to enable battery temperature measurements using thermistor connected on BATCTRL ADC. +config AB8500_9100_LI_ION_BATTERY + bool "Enable support of the 9100 Li-ion battery charging" + depends on AB8500_BM + help + Say Y to enable support of the 9100 Li-ion battery charging. + config AB5500_BM bool "AB5500 Battery Management Driver" depends on AB5500_CORE && AB5500_GPADC && MACH_U5500 diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index c355738a31a..13f2975445f 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -29,6 +29,7 @@ #include <linux/mfd/abx500/ab8500-gpadc.h> #include <linux/mfd/abx500/ux500_chargalg.h> #include <linux/usb/otg.h> +#include <asm/mach-types.h> /* Charger constants */ #define NO_PW_CONN 0 @@ -2354,11 +2355,18 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) } /* Backup battery voltage and current */ - ret = abx500_set_register_interruptible(di->dev, - AB8500_RTC, - AB8500_RTC_BACKUP_CHG_REG, - di->bat->bkup_bat_v | - di->bat->bkup_bat_i); + if (machine_is_snowball()) + ret = abx500_set_register_interruptible(di->dev, + AB8500_RTC, + AB8500_RTC_BACKUP_CHG_REG, + BUP_VCH_SEL_3P1V | + BUP_ICH_SEL_150UA); + else + ret = abx500_set_register_interruptible(di->dev, + AB8500_RTC, + AB8500_RTC_BACKUP_CHG_REG, + di->bat->bkup_bat_v | + di->bat->bkup_bat_i); if (ret) { dev_err(di->dev, "failed to setup backup battery charging\n"); goto out; |