msm: power: Revert LGE power patches

Revert the following customer changes in order to clean up this
branch.

This reverts commit 33ddf5a9eaa031c00b00846458f2ba534e6807b8.
This reverts commit f17df2402b795faf2c03de6d8a5b12378674f3be.
This reverts commit 0a488464c03806e1f775c35d7b2c83650eaab4ef.
This reverts commit 23d2a7cd02b081e1cf2578c02b7ecd3a65319d4e.
This reverts commit 90e32fa7cb701d922825e40b82b566e4af843ea2.
This reverts commit 7346d0fbd3c338d55330766e0f1867f19b364fed.
This reverts commit eb59bf66db9f2ca6e79552f4f72aa56f8c6abd27.
This reverts commit 9c56de000bb2390191fa2ddaea738e6d3e8f5d4f.
This reverts commit 7a72ca62c3f64c7b914edd8d9dbb75933b3c845e.
This reverts commit 76048dac5085eca4459ee5ea5dd4876a1f518cfa.
This reverts commit bfafe7ec7cdeef5b44b32f9aa6ee03beba2020e0.
This reverts commit e346f7a7b8ead1bbb106f4eb1e766c49407bffde.
This reverts commit 1265899c012a463cb0521ed73f2abe057692a9db
This reverts commit 1ff608a341b87defa586ca4a24d0bd89abfdfbb3
This reverts commit 5f030effc8c1af159ad13e77d4c169f037d6c9e4.
This reverts commit 19c87ddde66fd6aad61a60e466a75af235fca7f9.
This reverts commit 905eac978c30c96c5d12a81c1f6968d8c57a645f.
This reverts commit 1bd7c8643cdd8fdc7cf649ec465cc454315a6753.
This reverts commit 69f1730e0d249bad3b4f0fc0f94d917c16c3df19.
This reverts commit 2073afb7ee8b3f80f1f3184bd7ac99ead581adee
This reverts commit 8126554cf049d13f4dd2d815d86ea289efdc6f3a.
This reverts commit 45ccbb53cfc227fd3811e71b0bd813432c96ee9e
This reverts commit 325995993eb806285a35381e803ed5432fe5a93a.
This reverts commit 84cf5a3959bcf412c4b48f8a29b8255c18602d1b.
This reverts commit 839d5a50c761787ded6b8558fa37696be81196fe.
This reverts commit d4b1fb57463d04aeca5ae9bfd2181faa016f97c2.
This reverts commit 2ab04b0deb912a5a52899a50ced73e36974a6a00.
This reverts commit 3a3de0ee621625c8767e0d3c7106c52fcf834499.
This reverts commit f278add027723a90b11c9a97f6d1b09c1aaec795.
This reverts commit 1a749b700752efcc8d832f7b83554df2771dce53.

Change-Id: I21863586360b6bc57dd6d631c34725bea963cffa
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
diff --git a/drivers/power/pm8921-bms.c b/drivers/power/pm8921-bms.c
index 247b721..c19015f 100644
--- a/drivers/power/pm8921-bms.c
+++ b/drivers/power/pm8921-bms.c
@@ -22,7 +22,6 @@
 #include <linux/mfd/pm8xxx/pm8xxx-adc.h>
 #include <linux/mfd/pm8xxx/pm8921-charger.h>
 #include <linux/mfd/pm8xxx/ccadc.h>
-#include <linux/power/bq51051b_charger.h>
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
 #include <linux/debugfs.h>
@@ -55,9 +54,6 @@
 #define TEMP_IAVG_STORAGE	0x105
 #define TEMP_IAVG_STORAGE_USE_MASK	0x0F
 
-#define PON_CNTRL_6		0x018
-#define WD_BIT		BIT(7)
-
 enum pmic_bms_interrupts {
 	PM8921_BMS_SBI_WRITE_OK,
 	PM8921_BMS_CC_THR,
@@ -138,7 +134,7 @@
 	unsigned long		tm_sec;
 	int			enable_fcc_learning;
 	int			shutdown_soc;
-	int			shutdown_iavg_ma;
+	int			shutdown_iavg_ua;
 	struct delayed_work	calculate_soc_delayed_work;
 	struct timespec		t_soc_queried;
 	int			shutdown_soc_valid_limit;
@@ -151,16 +147,6 @@
 	int			ibat_at_cv_ua;
 	int			soc_at_cv;
 	int			prev_chg_soc;
-	int			last_reported_soc;
-	int			eoc_check_soc;
-	int			soc_adjusted;
-	int			bms_support_wlc;
-	int			wlc_term_ua;
-	int			wlc_max_voltage_uv;
-	int			(*wlc_is_plugged)(void);
-	int			vbat_at_cv;
-	int			(*is_warm_reset)(void);
-	int			first_fixed_iavg_ma;
 };
 
 /*
@@ -171,7 +157,7 @@
 static int shutdown_soc_invalid;
 static struct pm8921_bms_chip *the_chip;
 
-#define DEFAULT_RBATT_MOHMS			200
+#define DEFAULT_RBATT_MOHMS		128
 #define DEFAULT_OCV_MICROVOLTS		3900000
 #define DEFAULT_CHARGE_CYCLES		0
 
@@ -360,21 +346,13 @@
 	return 0;
 }
 
-static int usb_chg_plugged_in(struct pm8921_bms_chip *chip)
+static int usb_chg_plugged_in(void)
 {
 	int val = pm8921_is_usb_chg_plugged_in();
 
-	/* if the charger driver was not initialized, use the restart reason */
-	if (val == -EINVAL) {
-		if (pm8xxx_restart_reason(chip->dev->parent)
-				== PM8XXX_RESTART_CHG)
-			val = 1;
-		else
-			val = 0;
-	}
-
-	if (chip->bms_support_wlc)
-		val |= chip->wlc_is_plugged();
+	/* treat as if usb is not present in case of error */
+	if (val == -EINVAL)
+		val = 0;
 
 	return val;
 }
@@ -836,26 +814,28 @@
 }
 
 static int interpolate_pc(struct pm8921_bms_chip *chip,
-				int batt_temp_degc, int ocv)
+				int batt_temp, int ocv)
 {
 	int i, j, pcj, pcj_minus_one, pc;
 	int rows = chip->pc_temp_ocv_lut->rows;
 	int cols = chip->pc_temp_ocv_lut->cols;
 
+	/* batt_temp is in tenths of degC - convert it to degC for lookups */
+	batt_temp = batt_temp/10;
 
-	if (batt_temp_degc < chip->pc_temp_ocv_lut->temp[0]) {
-		pr_debug("batt_temp %d < known temp range\n", batt_temp_degc);
-		batt_temp_degc = chip->pc_temp_ocv_lut->temp[0];
+	if (batt_temp < chip->pc_temp_ocv_lut->temp[0]) {
+		pr_debug("batt_temp %d < known temp range for pc\n", batt_temp);
+		batt_temp = chip->pc_temp_ocv_lut->temp[0];
 	}
-	if (batt_temp_degc > chip->pc_temp_ocv_lut->temp[cols - 1]) {
-		pr_debug("batt_temp %d > known temp range\n", batt_temp_degc);
-		batt_temp_degc = chip->pc_temp_ocv_lut->temp[cols - 1];
+	if (batt_temp > chip->pc_temp_ocv_lut->temp[cols - 1]) {
+		pr_debug("batt_temp %d > known temp range for pc\n", batt_temp);
+		batt_temp = chip->pc_temp_ocv_lut->temp[cols - 1];
 	}
 
 	for (j = 0; j < cols; j++)
-		if (batt_temp_degc <= chip->pc_temp_ocv_lut->temp[j])
+		if (batt_temp <= chip->pc_temp_ocv_lut->temp[j])
 			break;
-	if (batt_temp_degc == chip->pc_temp_ocv_lut->temp[j]) {
+	if (batt_temp == chip->pc_temp_ocv_lut->temp[j]) {
 		/* found an exact match for temp in the table */
 		if (ocv >= chip->pc_temp_ocv_lut->ocv[0][j])
 			return chip->pc_temp_ocv_lut->percent[0];
@@ -878,7 +858,7 @@
 	}
 
 	/*
-	 * batt_temp_degc is within temperature for
+	 * batt_temp is within temperature for
 	 * column j-1 and j
 	 */
 	if (ocv >= chip->pc_temp_ocv_lut->ocv[0][j])
@@ -918,7 +898,7 @@
 				chip->pc_temp_ocv_lut->temp[j-1],
 				pcj,
 				chip->pc_temp_ocv_lut->temp[j],
-				batt_temp_degc);
+				batt_temp);
 			return pc;
 		}
 	}
@@ -930,7 +910,7 @@
 		return pcj_minus_one;
 
 	pr_debug("%d ocv wasn't found for temp %d in the LUT returning 100%%",
-							ocv, batt_temp_degc);
+							ocv, batt_temp);
 	return 100;
 }
 
@@ -964,7 +944,7 @@
 
 	mutex_unlock(&the_chip->bms_output_lock);
 
-	usb_chg = usb_chg_plugged_in(the_chip);
+	usb_chg = usb_chg_plugged_in();
 
 	convert_vbatt_raw_to_uv(the_chip, usb_chg, vbat_raw, vbat_uv);
 	convert_vsense_to_uv(the_chip, vsense_raw, &vsense_uv);
@@ -990,40 +970,6 @@
 		raw->last_good_ocv_raw -= MBG_TRANSIENT_ERROR_RAW;
 }
 
-#define SEL_ALT_OREG_BIT  BIT(2)
-static int ocv_ir_compensation(struct pm8921_bms_chip *chip, int ocv)
-{
-	int compensated_ocv;
-	int ibatt_ua;
-	int rbatt_mohm = chip->default_rbatt_mohm + chip->rconn_mohm;
-
-	pm_bms_masked_write(chip, BMS_TEST1,
-			SEL_ALT_OREG_BIT, SEL_ALT_OREG_BIT);
-
-	/* since the SEL_ALT_OREG_BIT is set this will give us VSENSE_OCV */
-	pm8921_bms_get_battery_current(&ibatt_ua);
-	compensated_ocv = ocv + div_s64((s64)ibatt_ua * rbatt_mohm, 1000);
-	pr_info("comp ocv = %d, ocv = %d, ibatt_ua = %d, rbatt_mohm = %d\n",
-			compensated_ocv, ocv, ibatt_ua, rbatt_mohm);
-
-	pm_bms_masked_write(chip, BMS_TEST1, SEL_ALT_OREG_BIT, 0);
-	return compensated_ocv;
-}
-
-static bool is_warm_restart(struct pm8921_bms_chip *chip)
-{
-	u8 reg;
-	int rc;
-
-	rc = pm8xxx_readb(chip->dev->parent, PON_CNTRL_6, &reg);
-	if (rc) {
-		pr_err("err reading pon 6 rc = %d\n", rc);
-		return false;
-	}
-
-	return reg & WD_BIT;
-}
-
 static int read_soc_params_raw(struct pm8921_bms_chip *chip,
 				struct pm8921_soc_params *raw)
 {
@@ -1039,22 +985,14 @@
 	pm_bms_unlock_output_data(chip);
 	mutex_unlock(&chip->bms_output_lock);
 
-	usb_chg =  usb_chg_plugged_in(chip);
+	usb_chg =  usb_chg_plugged_in();
 
 	if (chip->prev_last_good_ocv_raw == 0) {
 		chip->prev_last_good_ocv_raw = raw->last_good_ocv_raw;
 		adjust_pon_ocv_raw(chip, raw);
 		convert_vbatt_raw_to_uv(chip, usb_chg,
 			raw->last_good_ocv_raw, &raw->last_good_ocv_uv);
-		raw->last_good_ocv_uv = ocv_ir_compensation(chip,
-						raw->last_good_ocv_uv);
 		chip->last_ocv_uv = raw->last_good_ocv_uv;
-
-		if (is_warm_restart(chip)) {
-			shutdown_soc_invalid = 1;
-			pr_info("discard shutdown soc! cc_raw = 0x%x\n", raw->cc);
-		}
-
 		pr_debug("PON_OCV_UV = %d\n", chip->last_ocv_uv);
 	} else if (chip->prev_last_good_ocv_raw != raw->last_good_ocv_raw) {
 		chip->prev_last_good_ocv_raw = raw->last_good_ocv_raw;
@@ -1182,7 +1120,7 @@
 {
 	int pc, scalefactor;
 
-	pc = interpolate_pc(chip, batt_temp / 10, ocv_uv / 1000);
+	pc = interpolate_pc(chip, batt_temp, ocv_uv / 1000);
 	pr_debug("pc = %u for ocv = %dmicroVolts batt_temp = %d\n",
 					pc, ocv_uv, batt_temp);
 
@@ -1397,13 +1335,13 @@
 
 	/*
 	 * if we are called first time fill all the
-	 * samples with the the shutdown_iavg_ma
+	 * samples with the the shutdown_iavg_ua
 	 */
-	if (firsttime && chip->shutdown_iavg_ma != 0) {
-		pr_emerg("Using shutdown_iavg_ma = %d in all samples\n",
-				chip->shutdown_iavg_ma);
+	if (firsttime && chip->shutdown_iavg_ua != 0) {
+		pr_emerg("Using shutdown_iavg_ua = %d in all samples\n",
+				chip->shutdown_iavg_ua);
 		for (i = 0; i < IAVG_SAMPLES; i++)
-			iavg_samples[i] = chip->shutdown_iavg_ma;
+			iavg_samples[i] = chip->shutdown_iavg_ua;
 
 		iavg_index = 0;
 		iavg_num_samples = IAVG_SAMPLES;
@@ -1650,40 +1588,20 @@
 				int fcc_uah, int cc_uah, int uuc_uah)
 {
 	int chg_soc;
-	int max_vol;
-	int eoc_current;
-
-	max_vol = chip->max_voltage_uv;
-	eoc_current = -chip->chg_term_ua;
-
-	if (chip->bms_support_wlc && chip->wlc_is_plugged()) {
-		max_vol = chip->wlc_max_voltage_uv;
-		eoc_current = -chip->wlc_term_ua;
-	}
 
 	if (chip->soc_at_cv == -EINVAL) {
 		/* In constant current charging return the calc soc */
-		if (vbat_uv <= max_vol)
+		if (vbat_uv <= chip->max_voltage_uv)
 			pr_debug("CC CHG SOC %d\n", soc);
 
 		/* Note the CC to CV point */
-		if (vbat_uv >= max_vol) {
+		if (vbat_uv >= chip->max_voltage_uv) {
 			chip->soc_at_cv = soc;
 			chip->prev_chg_soc = soc;
 			chip->ibat_at_cv_ua = ibat_ua;
-			chip->vbat_at_cv = vbat_uv;
 			pr_debug("CC_TO_CV ibat_ua = %d CHG SOC %d\n",
 					ibat_ua, soc);
 		}
-		else if(soc >= 95)
-		{
-			chip->soc_at_cv = soc;
-			chip->prev_chg_soc = soc;
-			chip->ibat_at_cv_ua = ibat_ua;
-			chip->vbat_at_cv = vbat_uv;
-			pr_debug("Force CC_TO_CV ibat_ua = %d CHG SOC %d\n",
-					ibat_ua, soc);
-		}
 		return soc;
 	}
 
@@ -1696,25 +1614,15 @@
 	 * if voltage lessened (possibly because of a system load)
 	 * keep reporting the prev chg soc
 	 */
-	if (vbat_uv <= chip->vbat_at_cv) {
+	if (vbat_uv <= chip->max_voltage_uv) {
 		pr_debug("vbat %d < max = %d CC CHG SOC %d\n",
-			vbat_uv, chip->vbat_at_cv, chip->prev_chg_soc);
-		return chip->prev_chg_soc;
-	}
-
-	if (chip->bms_support_wlc
-			&& chip->wlc_is_plugged()
-			&& chip->prev_chg_soc < 99
-			&& ibat_ua > eoc_current) {
-		pr_info("ibat < eco_current ! soc = %d \n", chip->prev_chg_soc);
+			vbat_uv, chip->max_voltage_uv, chip->prev_chg_soc);
 		return chip->prev_chg_soc;
 	}
 
 	chg_soc = linear_interpolate(chip->soc_at_cv, chip->ibat_at_cv_ua,
-					100, eoc_current,
+					100, -100000,
 					ibat_ua);
-	if (chg_soc > 100)
-		chg_soc = 100;
 
 	/* always report a higher soc */
 	if (chg_soc > chip->prev_chg_soc) {
@@ -1853,13 +1761,17 @@
 	 * soc = 0 should happen only when soc_est == 0
 	 */
 	if (soc_new == 0 && soc_est != 0)
-		soc_new = 2;
+		soc_new = 1;
 
 	soc = soc_new;
 
 out:
-	pr_info("ibat_ua = %d, vbat_uv = %d, soc = %d, batt_temp=%d\n",
-			ibat_ua, vbat_uv, soc, batt_temp);
+	pr_debug("ibat_ua = %d, vbat_uv = %d, ocv_est_uv = %d, pc_est = %d, "
+		"soc_est = %d, n = %d, delta_ocv_uv = %d, last_ocv_uv = %d, "
+		"pc_new = %d, soc_new = %d, rbatt = %d, m = %d\n",
+		ibat_ua, vbat_uv, ocv_est_uv, pc_est,
+		soc_est, n, delta_ocv_uv, chip->last_ocv_uv,
+		pc_new, soc_new, rbatt, m);
 
 	return soc;
 }
@@ -1902,14 +1814,14 @@
 	if (rc) {
 		pr_err("failed to read addr = %d %d assuming %d\n",
 				TEMP_IAVG_STORAGE, rc, IAVG_START);
-		chip->shutdown_iavg_ma = IAVG_START;
+		chip->shutdown_iavg_ua = IAVG_START;
 	} else {
 		temp &= TEMP_IAVG_STORAGE_USE_MASK;
 
 		if (temp == 0) {
-			chip->shutdown_iavg_ma = IAVG_START;
+			chip->shutdown_iavg_ua = IAVG_START;
 		} else {
-			chip->shutdown_iavg_ma = IAVG_START
+			chip->shutdown_iavg_ua = IAVG_START
 					+ IAVG_STEP_SIZE_MA * (temp + 1);
 		}
 	}
@@ -1923,7 +1835,7 @@
 		if (chip->shutdown_soc == 0) {
 			pr_debug("No shutdown soc available\n");
 			shutdown_soc_invalid = 1;
-			chip->shutdown_iavg_ma = 0;
+			chip->shutdown_iavg_ua = 0;
 		} else if (chip->shutdown_soc == SOC_ZERO) {
 			chip->shutdown_soc = 0;
 		}
@@ -1932,16 +1844,12 @@
 	if (chip->ignore_shutdown_soc) {
 		shutdown_soc_invalid = 1;
 		chip->shutdown_soc = 0;
-		chip->shutdown_iavg_ma = 0;
-	}
-
-	if (chip->first_fixed_iavg_ma && !chip->ignore_shutdown_soc) {
-		chip->shutdown_iavg_ma = chip->first_fixed_iavg_ma;
+		chip->shutdown_iavg_ua = 0;
 	}
 
 	pr_debug("shutdown_soc = %d shutdown_iavg = %d shutdown_soc_invalid = %d\n",
 			chip->shutdown_soc,
-			chip->shutdown_iavg_ma,
+			chip->shutdown_iavg_ua,
 			shutdown_soc_invalid);
 }
 
@@ -2010,45 +1918,6 @@
 
 	return 1;
 }
-
-static int is_eoc_adjust(struct pm8921_bms_chip *chip, int soc)
-{
-	int batt_state = pm8921_get_batt_state();
-	int ret = 0;
-
-	if (soc != 100)
-		return 0;
-
-	switch (batt_state) {
-	case POWER_SUPPLY_STATUS_CHARGING:
-		if (chip->start_percent != -EINVAL
-				&& chip->start_percent != 100)
-			ret = 1;
-		break;
-	case POWER_SUPPLY_STATUS_DISCHARGING:
-	case POWER_SUPPLY_STATUS_NOT_CHARGING:
-		if (chip->soc_adjusted == 1)
-			ret = 1;
-		break;
-	default:
-		break;
-	}
-
-	return ret;
-}
-
-static int is_recharging(struct pm8921_bms_chip *chip, int soc)
-{
-	if (soc == -EINVAL)
-		return 0;
-	if ((pm8921_get_batt_state() == POWER_SUPPLY_STATUS_FULL)
-			&& (soc < 100)
-			&& (pm8921_get_batt_health()
-				!= POWER_SUPPLY_HEALTH_OVERHEAT))
-		return 1;
-	return 0;
-}
-
 /*
  * Remaining Usable Charge = remaining_charge (charge at ocv instance)
  *				- coloumb counter charge
@@ -2170,20 +2039,16 @@
 
 		chip->pon_ocv_uv = chip->last_ocv_uv;
 		chip->last_ocv_uv = new_ocv;
+		remaining_charge_uah = new_rc_uah;
 		unusable_charge_uah = new_ucc_uah;
 		rbatt = new_rbatt;
 
-		if ((new_rc_uah - remaining_charge_uah) > fcc_uah*5/100)
-			remaining_charge_uah = new_rc_uah - fcc_uah*1/100;
-		else
-			remaining_charge_uah = new_rc_uah;
-
 		remaining_usable_charge_uah = remaining_charge_uah
 					- cc_uah
 					- unusable_charge_uah;
 
-		soc = (remaining_usable_charge_uah * 100)/
-					(fcc_uah - unusable_charge_uah);
+		soc = DIV_ROUND_CLOSEST((remaining_usable_charge_uah * 100),
+					(fcc_uah - unusable_charge_uah));
 
 		pr_debug("DONE for shutdown_soc = %d soc is %d, adjusted ocv to %duV\n",
 				shutdown_soc, soc, chip->last_ocv_uv);
@@ -2225,13 +2090,6 @@
 
 	soc = calculate_state_of_charge(chip, &raw,
 					batt_temp, last_chargecycles);
-
-	if (chip->eoc_check_soc
-			&& is_recharging(chip, chip->last_reported_soc)) {
-		pm8921_force_start_charging();
-		pr_info("Recharging is started\n");
-	}
-
 	mutex_unlock(&chip->last_ocv_uv_mutex);
 
 	schedule_delayed_work(&chip->calculate_soc_delayed_work,
@@ -2306,22 +2164,13 @@
 	}
 
 	/* last_soc < soc  ... scale and catch up */
-	if (last_soc != -EINVAL && soc != 100
-			&& (last_soc < soc || the_chip->start_percent != -EINVAL))
+	if (last_soc != -EINVAL && last_soc < soc && soc != 100)
 		soc = scale_soc_while_chg(chip, delta_time_us, soc, last_soc);
 
-	if (chip->eoc_check_soc && is_eoc_adjust(chip, soc)) {
-		soc = soc - 1;
-		chip->soc_adjusted = 1;
-	} else {
-		chip->soc_adjusted = 0;
-	}
-
 	last_soc = soc;
 	backup_soc_and_iavg(chip, batt_temp, last_soc);
 	pr_debug("Reported SOC = %d\n", last_soc);
 	chip->t_soc_queried = now;
-	chip->last_reported_soc = last_soc;
 
 	return last_soc;
 }
@@ -2402,8 +2251,7 @@
 	}
 	voltage = xoadc_reading_to_microvolt(result.adc_code);
 
-	usb_chg = usb_chg_plugged_in(chip);
-
+	usb_chg = usb_chg_plugged_in();
 	pr_debug("result 0.625V = 0x%x, voltage = %duV adc_meas = %lld "
 				"usb_chg = %d\n",
 				result.adc_code, voltage, result.measurement,
@@ -2890,8 +2738,7 @@
 	 */
 	ocv_uv = 0;
 	pm_bms_read_output_data(chip, LAST_GOOD_OCV_VALUE, &ocv_raw);
-	usb_chg = usb_chg_plugged_in(chip);
-
+	usb_chg = usb_chg_plugged_in();
 	rc = convert_vbatt_raw_to_uv(chip, usb_chg, ocv_raw, &ocv_uv);
 	if (rc || ocv_uv == 0) {
 		rc = adc_based_ocv(chip, &ocv_uv);
@@ -2932,8 +2779,6 @@
 		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) {
@@ -2972,8 +2817,6 @@
 		chip->default_rbatt_mohm = desay_5200_data.default_rbatt_mohm;
 		chip->delta_rbatt_mohm = desay_5200_data.delta_rbatt_mohm;
 		return 0;
-lge:
-		return 0;
 }
 
 enum bms_request_operation {
@@ -3354,17 +3197,6 @@
 	chip->batt_id_channel = pdata->bms_cdata.batt_id_channel;
 	chip->revision = pm8xxx_get_revision(chip->dev->parent);
 	chip->enable_fcc_learning = pdata->enable_fcc_learning;
-	chip->last_reported_soc = -EINVAL;
-	chip->eoc_check_soc = pdata->eoc_check_soc;
-	chip->soc_adjusted = 0;
-	chip->bms_support_wlc = pdata->bms_support_wlc;
-	if (chip->bms_support_wlc) {
-		chip->wlc_term_ua = pdata->wlc_term_ua;
-		chip->wlc_max_voltage_uv = pdata->wlc_max_voltage_uv;
-		chip->wlc_is_plugged = pdata->wlc_is_plugged;
-	}
-	chip->vbat_at_cv = -EINVAL;
-	chip->first_fixed_iavg_ma = pdata->first_fixed_iavg_ma;
 
 	mutex_init(&chip->calib_mutex);
 	INIT_WORK(&chip->calib_hkadc_work, calibrate_hkadc_work);