msm: bms: fix data for palladium battery.

The battery data is incorrect and is causing SOC jumps. The SOC is often
inaccurate and would jump from e.g. 40 to 35 in a few seconds due to a bad
battery profile.

Fix the values to use an accurate battery profile that reflects the
battery resistance and voltage versus percent values which help alleviate
the jumps.

Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
(cherry picked from commit 21184fc6fb7820f0cdcc8c9c597013cda75aaf56)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
(cherry picked from commit 0001021632a1581b52310e220d67b6d7b2af294e)

Change-Id: I37d148ab50c028db6cd6e27c1d5de40dec93ac81
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/mach-msm/bms-batterydata.c b/arch/arm/mach-msm/bms-batterydata.c
index 77e7dab..81ab121 100644
--- a/arch/arm/mach-msm/bms-batterydata.c
+++ b/arch/arm/mach-msm/bms-batterydata.c
@@ -12,116 +12,97 @@
 
 #include <linux/mfd/pm8xxx/pm8921-bms.h>
 
-static struct single_row_lut palladium_1500_fcc_temp = {
-	.x	= {-30, -20, -10, 0, 10, 25, 40, 60},
-	.y	= {1103, 1179, 1284, 1330, 1420, 1511, 1541, 1571},
-	.cols	= 8,
+static struct single_row_lut fcc_temp = {
+	.x		= {-20, 0, 25, 40, 65},
+	.y		= {1492, 1492, 1493, 1483, 1502},
+	.cols	= 5
 };
 
-static struct single_row_lut palladium_1500_fcc_sf = {
-	.x	= {100, 200, 300, 400, 500},
-	.y	= {97, 93, 93, 90, 87},
-	.cols	= 5,
-};
-
-static struct sf_lut palladium_1500_pc_sf = {
-	.rows		= 10,
+static struct pc_temp_ocv_lut pc_temp_ocv = {
+	.rows		= 29,
 	.cols		= 5,
-	/* row_entries are chargecycles */
-	.row_entries	= {100, 200, 300, 400, 500},
-	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
-	.sf		= {
-			{97, 93, 93, 90, 87},
-			{97, 93, 93, 90, 87},
-			{98, 94, 92, 89, 86},
-			{98, 94, 92, 89, 86},
-			{99, 94, 92, 88, 86},
-			{99, 95, 92, 88, 87},
-			{99, 95, 92, 88, 87},
-			{99, 95, 92, 88, 87},
-			{99, 95, 92, 88, 87},
-			{99, 95, 92, 88, 87}
-	},
+	.temp		= {-20, 0, 25, 40, 65},
+	.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		= {
+				{4173, 4167, 4163, 4156, 4154},
+				{4104, 4107, 4108, 4102, 4104},
+				{4057, 4072, 4069, 4061, 4060},
+				{3973, 4009, 4019, 4016, 4020},
+				{3932, 3959, 3981, 3982, 3983},
+				{3899, 3928, 3954, 3950, 3950},
+				{3868, 3895, 3925, 3921, 3920},
+				{3837, 3866, 3898, 3894, 3892},
+				{3812, 3841, 3853, 3856, 3862},
+				{3794, 3818, 3825, 3823, 3822},
+				{3780, 3799, 3804, 3804, 3803},
+				{3768, 3787, 3790, 3788, 3788},
+				{3757, 3779, 3778, 3775, 3776},
+				{3747, 3772, 3771, 3766, 3765},
+				{3736, 3763, 3766, 3760, 3746},
+				{3725, 3749, 3756, 3747, 3729},
+				{3714, 3718, 3734, 3724, 3706},
+				{3701, 3703, 3696, 3689, 3668},
+				{3675, 3695, 3682, 3675, 3662},
+				{3670, 3691, 3680, 3673, 3661},
+				{3661, 3686, 3679, 3672, 3656},
+				{3649, 3680, 3676, 3669, 3641},
+				{3633, 3669, 3667, 3655, 3606},
+				{3610, 3647, 3640, 3620, 3560},
+				{3580, 3607, 3596, 3572, 3501},
+				{3533, 3548, 3537, 3512, 3425},
+				{3457, 3468, 3459, 3429, 3324},
+				{3328, 3348, 3340, 3297, 3172},
+				{3000, 3000, 3000, 3000, 3000}
+	}
 };
 
-static struct sf_lut palladium_1500_rbatt_sf = {
-	.rows		= 19,
+static struct sf_lut rbatt_sf = {
+	.rows		= 29,
 	.cols		= 5,
 	/* row_entries are temperature */
 	.row_entries	= {-20, 0, 20, 40, 65},
-	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50,
-				45, 40, 35, 30, 25, 20, 15, 10
-	},
+	.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},
 	.sf		= {
-					{645, 301, 100, 80, 69},
-					{616, 290, 100, 79, 69},
-					{586, 279, 100, 78, 68},
-					{564, 270, 100, 78, 68},
-					{546, 262, 100, 78, 68},
-					{537, 256, 100, 79, 68},
-					{536, 253, 100, 79, 69},
-					{552, 258, 100, 81, 71},
-					{618, 284, 100, 80, 72},
-					{643, 290, 100, 77, 68},
-					{673, 294, 100, 77, 68},
-					{720, 296, 100, 77, 69},
-					{769, 294, 100, 76, 68},
-					{821, 288, 100, 74, 67},
-					{892, 284, 100, 74, 61},
-					{1003, 290, 100, 71, 58},
-					{1192, 307, 100, 70, 58},
-					{1579, 345, 100, 68, 57},
-					{1261, 324, 100, 68, 57},
+				{357, 187, 100, 91, 91},
+				{400, 208, 105, 94, 94},
+				{390, 204, 106, 95, 96},
+				{391, 201, 108, 98, 98},
+				{391, 202, 110, 98, 100},
+				{390, 200, 110, 99, 102},
+				{389, 200, 110, 99, 102},
+				{393, 202, 101, 93, 100},
+				{407, 205, 99, 89, 94},
+				{428, 208, 100, 91, 96},
+				{455, 212, 102, 92, 98},
+				{495, 220, 104, 93, 101},
+				{561, 232, 107, 95, 102},
+				{634, 245, 112, 98, 98},
+				{714, 258, 114, 98, 98},
+				{791, 266, 114, 97, 100},
+				{871, 289, 108, 95, 97},
+				{973, 340, 124, 108, 105},
+				{489, 241, 109, 96, 99},
+				{511, 246, 110, 96, 99},
+				{534, 252, 111, 95, 98},
+				{579, 263, 112, 96, 96},
+				{636, 276, 111, 95, 97},
+				{730, 294, 109, 96, 99},
+				{868, 328, 112, 98, 104},
+				{1089, 374, 119, 101, 115},
+				{1559, 457, 128, 105, 213},
+				{12886, 1026, 637, 422, 3269},
+				{170899, 127211, 98968, 88907, 77102},
 	}
 };
-static struct pc_temp_ocv_lut palladium_1500_pc_temp_ocv = {
-	.rows		= 29,
-	.cols		= 8,
-	.temp		= {-30, -20, -10, 0, 10, 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		= {
-			{3673, 3814, 3945, 4025, 4106, 4176, 4218, 4260},
-			{3613, 3751, 3880, 3959, 4038, 4107, 4149, 4190},
-			{3573, 3710, 3837, 3916, 3994, 4062, 4103, 4144},
-			{3534, 3670, 3796, 3873, 3951, 4019, 4059, 4099},
-			{3491, 3625, 3749, 3826, 3902, 3969, 4009, 4049},
-			{3464, 3597, 3721, 3796, 3872, 3939, 3978, 4018},
-			{3436, 3568, 3691, 3766, 3841, 3907, 3946, 3985},
-			{3407, 3537, 3659, 3733, 3808, 3873, 3912, 3951},
-			{3377, 3507, 3627, 3701, 3775, 3840, 3878, 3917},
-			{3355, 3484, 3604, 3677, 3751, 3815, 3853, 3891},
-			{3339, 3467, 3586, 3659, 3732, 3796, 3834, 3872},
-			{3324, 3452, 3570, 3643, 3716, 3780, 3818, 3855},
-			{3312, 3440, 3558, 3630, 3703, 3766, 3804, 3842},
-			{3303, 3430, 3548, 3620, 3692, 3756, 3793, 3831},
-			{3297, 3424, 3541, 3614, 3686, 3749, 3787, 3824},
-			{3288, 3414, 3531, 3603, 3675, 3738, 3776, 3813},
-			{3272, 3398, 3514, 3586, 3658, 3720, 3757, 3795},
-			{3240, 3365, 3480, 3551, 3622, 3684, 3721, 3758},
-			{3224, 3348, 3463, 3533, 3604, 3666, 3702, 3739},
-			{3221, 3344, 3459, 3530, 3600, 3662, 3695, 3728},
-			{3216, 3340, 3454, 3525, 3595, 3657, 3686, 3715},
-			{3212, 3335, 3449, 3520, 3590, 3652, 3677, 3703},
-			{3203, 3326, 3440, 3510, 3580, 3642, 3664, 3686},
-			{3185, 3307, 3420, 3490, 3560, 3621, 3639, 3657},
-			{3176, 3298, 3411, 3481, 3550, 3611, 3626, 3640},
-			{3151, 3272, 3384, 3453, 3522, 3583, 3593, 3604},
-			{3106, 3225, 3335, 3446, 3472, 3531, 3538, 3545},
-			{3021, 3217, 3245, 3417, 3429, 3435, 3439, 3442},
-			{3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000}
-	},
-};
 
 struct pm8921_bms_battery_data palladium_1500_data = {
 	.fcc			= 1500,
-	.fcc_temp_lut		= &palladium_1500_fcc_temp,
-	.fcc_sf_lut		= &palladium_1500_fcc_sf,
-	.pc_temp_ocv_lut	= &palladium_1500_pc_temp_ocv,
-	.pc_sf_lut		= &palladium_1500_pc_sf,
-	.rbatt_sf_lut		= &palladium_1500_rbatt_sf,
-	.default_rbatt_mohm	= 254,
-	.delta_rbatt_mohm	= 60,
+	.fcc_temp_lut		= &fcc_temp,
+	.pc_temp_ocv_lut	= &pc_temp_ocv,
+	.rbatt_sf_lut		= &rbatt_sf,
+	.default_rbatt_mohm	= 236,
 };