power: support LGE battery 2100mAh

Add battery 2100mAh profile and update Battery mornitoring system(BMS)

Change-Id: Iea118f1665241c7e4192a77db791b80426a01b60
This commit is contained in:
roy.park 2012-06-18 22:49:20 -07:00 committed by Iliyan Malchev
parent 3259f9d959
commit 0f8e962294
4 changed files with 122 additions and 2 deletions

View file

@ -11,6 +11,111 @@
*/
#include <linux/mfd/pm8xxx/pm8921-bms.h>
static struct single_row_lut lge_2100_fcc_temp = {
.x = {-20, 0, 25, 40, 60 },
.y = {2114, 2114, 2115, 2111, 2104 },
.cols = 5
};
static struct single_row_lut lge_2100_fcc_sf = {
.x = {0 },
.y = {100 },
.cols = 1
};
static struct sf_lut lge_2100_rbatt_sf = {
.rows = 28,
.cols = 5,
.row_entries = {-20, 0, 25, 40, 60 },
.percent = {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50,
45, 40, 35, 30, 25, 20, 15, 10,
9, 8, 7, 6, 5, 4, 3, 2, 1 },
.sf = {
{950,394,100,65,43},
{989,398,110,71,47},
{1007,394,116,77,51},
{1038,391,119,79,55},
{1102,395,122,81,58},
{1223,400,123,81,59},
{1378,409,124,83,60},
{1548,418,118,81,59},
{1717,423,111,68,48},
{1878,431,115,69,47},
{2050,442,123,73,51},
{2208,461,132,77,55},
{2383,485,143,82,58},
{2575,512,153,88,55},
{2815,538,163,92,53},
{3121,620,170,91,55},
{3565,794,170,85,50},
{4330,985,212,104,61},
{2534,561,184,96,58},
{2722,569,189,98,59},
{2957,580,195,100,59},
{3228,592,202,101,56},
{3564,602,206,99,55},
{4012,614,211,99,56},
{4622,632,223,105,61},
{5479,665,243,115,66},
{6782,760,270,127,70},
{9140,1069,307,141,81},
}
};
static struct pc_temp_ocv_lut lge_2100_pc_temp_ocv = {
.rows = 29,
.cols = 5,
.temp = {-20, 0, 25, 40, 60 },
.percent = {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50,
45, 40, 35, 30, 25, 20, 15, 10,
9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
.ocv = {
{4335, 4333, 4329, 4324, 4317 },
{4241, 4256, 4259, 4259, 4254 },
{4165, 4195, 4201, 4201, 4197 },
{4089, 4135, 4145, 4145, 4142 },
{4028, 4076, 4092, 4092, 4089 },
{3978, 4019, 4042, 4042, 4039 },
{3940, 3965, 3993, 3994, 3993 },
{3907, 3924, 3953, 3955, 3953 },
{3879, 3888, 3906, 3916, 3915 },
{3853, 3855, 3862, 3865, 3865 },
{3828, 3826, 3831, 3833, 3833 },
{3806, 3802, 3808, 3809, 3809 },
{3785, 3785, 3791, 3789, 3790 },
{3766, 3772, 3777, 3775, 3775 },
{3747, 3760, 3767, 3764, 3756 },
{3730, 3737, 3755, 3750, 3736 },
{3710, 3722, 3733, 3725, 3712 },
{3684, 3707, 3694, 3686, 3672 },
{3647, 3686, 3677, 3671, 3660 },
{3638, 3681, 3674, 3669, 3658 },
{3626, 3674, 3670, 3665, 3655 },
{3611, 3665, 3663, 3656, 3645 },
{3593, 3648, 3643, 3633, 3618 },
{3567, 3616, 3605, 3593, 3577 },
{3531, 3569, 3551, 3542, 3528 },
{3478, 3502, 3485, 3480, 3467 },
{3403, 3409, 3405, 3399, 3382 },
{3281, 3281, 3284, 3271, 3247 },
{3000, 3000, 3000, 3000, 3000 }
}
};
static struct sf_lut lge_2100_pc_sf = {
.rows = 1,
.cols = 1,
.row_entries = {0 },
.percent = {100 },
.sf = {
{100 }
}
};
struct pm8921_bms_battery_data lge_2100_mako_data = {
.fcc = 2100,
.fcc_temp_lut = &lge_2100_fcc_temp,
.fcc_sf_lut = &lge_2100_fcc_sf,
.pc_temp_ocv_lut = &lge_2100_pc_temp_ocv,
.pc_sf_lut = &lge_2100_pc_sf,
.rbatt_sf_lut = &lge_2100_rbatt_sf,
.default_rbatt_mohm = 98,
};
static struct single_row_lut palladium_1500_fcc_temp = {
.x = {-30, -20, -10, 0, 10, 25, 40, 60},

View file

@ -365,7 +365,7 @@ apq8064_pm8xxx_ccadc_pdata = {
static struct pm8921_bms_platform_data
apq8064_pm8921_bms_pdata __devinitdata = {
.battery_type = BATT_UNKNOWN, //FIXME Define correct type
.battery_type = BATT_LGE,
.r_sense = 10,
.i_test = 834,
.v_failure = 3300,

View file

@ -157,7 +157,7 @@ static DEFINE_MUTEX(soc_invalidation_mutex);
static int shutdown_soc_invalid;
static struct pm8921_bms_chip *the_chip;
#define DEFAULT_RBATT_MOHMS 128
#define DEFAULT_RBATT_MOHMS 200
#define DEFAULT_OCV_MICROVOLTS 3900000
#define DEFAULT_CHARGE_CYCLES 0
@ -2779,6 +2779,8 @@ static int set_battery_data(struct pm8921_bms_chip *chip)
goto desay;
else if (chip->batt_type == BATT_PALLADIUM)
goto palladium;
else if (chip->batt_type == BATT_LGE)
goto lge;
battery_id = read_battery_id(chip);
if (battery_id < 0) {
@ -2817,6 +2819,17 @@ desay:
chip->default_rbatt_mohm = desay_5200_data.default_rbatt_mohm;
chip->delta_rbatt_mohm = desay_5200_data.delta_rbatt_mohm;
return 0;
lge:
chip->fcc = lge_2100_mako_data.fcc;
chip->fcc_temp_lut = lge_2100_mako_data.fcc_temp_lut;
chip->fcc_sf_lut = lge_2100_mako_data.fcc_sf_lut;
chip->pc_temp_ocv_lut = lge_2100_mako_data.pc_temp_ocv_lut;
chip->pc_sf_lut = lge_2100_mako_data.pc_sf_lut;
chip->rbatt_sf_lut = lge_2100_mako_data.rbatt_sf_lut;
chip->default_rbatt_mohm
= lge_2100_mako_data.default_rbatt_mohm;
chip->delta_rbatt_mohm = lge_2100_mako_data.delta_rbatt_mohm;
return 0;
}
enum bms_request_operation {

View file

@ -108,6 +108,7 @@ enum battery_type {
BATT_UNKNOWN = 0,
BATT_PALLADIUM,
BATT_DESAY,
BATT_LGE,
};
/**
@ -139,6 +140,7 @@ struct pm8921_bms_platform_data {
#if defined(CONFIG_PM8921_BMS) || defined(CONFIG_PM8921_BMS_MODULE)
extern struct pm8921_bms_battery_data palladium_1500_data;
extern struct pm8921_bms_battery_data desay_5200_data;
extern struct pm8921_bms_battery_data lge_2100_mako_data;
/**
* pm8921_bms_get_vsense_avg - return the voltage across the sense
* resitor in microvolts