Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f90799cd authored by Kavya Nunna's avatar Kavya Nunna Committed by Gerrit - the friendly Code Review server
Browse files

power: vm-bms: Modify the function names for batterydata interface



Modify the function names of batterydata interface to avoid conflict with
the qg battery interface as it uses the same names.

Change-Id: I4ea1b91c664d920d20e0a588901138e27bbe5bb8
Signed-off-by: default avatarKavya Nunna <knunna@codeaurora.org>
parent 44bdb591
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ static long battery_data_ioctl(struct file *file, unsigned int cmd,


	switch (cmd) {
	switch (cmd) {
	case BPIOCXSOC:
	case BPIOCXSOC:
		soc = interpolate_pc(battery->profile->pc_temp_ocv_lut,
		soc = interpolate_pc_bms(battery->profile->pc_temp_ocv_lut,
					bp.batt_temp, bp.ocv_uv / 1000);
					bp.batt_temp, bp.ocv_uv / 1000);
		rc = put_user(soc, &bp_user->soc);
		rc = put_user(soc, &bp_user->soc);
		if (rc) {
		if (rc) {
@@ -77,7 +77,7 @@ static long battery_data_ioctl(struct file *file, unsigned int cmd,
				bp.ocv_uv / 1000, bp.batt_temp, soc);
				bp.ocv_uv / 1000, bp.batt_temp, soc);
		break;
		break;
	case BPIOCXRBATT:
	case BPIOCXRBATT:
		rbatt_sf = interpolate_scalingfactor(
		rbatt_sf = interpolate_scalingfactor_bms(
				battery->profile->rbatt_sf_lut,
				battery->profile->rbatt_sf_lut,
				bp.batt_temp, bp.soc);
				bp.batt_temp, bp.soc);
		rc = put_user(rbatt_sf, &bp_user->rbatt_sf);
		rc = put_user(rbatt_sf, &bp_user->rbatt_sf);
@@ -89,7 +89,7 @@ static long battery_data_ioctl(struct file *file, unsigned int cmd,
					bp.soc, bp.batt_temp, rbatt_sf);
					bp.soc, bp.batt_temp, rbatt_sf);
		break;
		break;
	case BPIOCXSLOPE:
	case BPIOCXSLOPE:
		slope = interpolate_slope(battery->profile->pc_temp_ocv_lut,
		slope = interpolate_slope_bms(battery->profile->pc_temp_ocv_lut,
							bp.batt_temp, bp.soc);
							bp.batt_temp, bp.soc);
		rc = put_user(slope, &bp_user->slope);
		rc = put_user(slope, &bp_user->slope);
		if (rc) {
		if (rc) {
@@ -100,7 +100,7 @@ static long battery_data_ioctl(struct file *file, unsigned int cmd,
					bp.soc, bp.batt_temp, slope);
					bp.soc, bp.batt_temp, slope);
		break;
		break;
	case BPIOCXFCC:
	case BPIOCXFCC:
		fcc_mah = interpolate_fcc(battery->profile->fcc_temp_lut,
		fcc_mah = interpolate_fcc_bms(battery->profile->fcc_temp_lut,
							bp.batt_temp);
							bp.batt_temp);
		rc = put_user(fcc_mah, &bp_user->fcc_mah);
		rc = put_user(fcc_mah, &bp_user->fcc_mah);
		if (rc) {
		if (rc) {
+30 −30
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/batterydata-lib.h>
#include <linux/batterydata-lib.h>


int linear_interpolate(int y0, int x0, int y1, int x1, int x)
int linear_interpolate_bms(int y0, int x0, int y1, int x1, int x)
{
{
	if (y0 == y1 || x == x0)
	if (y0 == y1 || x == x0)
		return y0;
		return y0;
@@ -25,7 +25,7 @@ int linear_interpolate(int y0, int x0, int y1, int x1, int x)
	return y0 + ((y1 - y0) * (x - x0) / (x1 - x0));
	return y0 + ((y1 - y0) * (x - x0) / (x1 - x0));
}
}


static int interpolate_single_lut_scaled(struct single_row_lut *lut,
static int interpolate_single_lut_scaled_bms(struct single_row_lut *lut,
						int x, int scale)
						int x, int scale)
{
{
	int i, result;
	int i, result;
@@ -47,7 +47,7 @@ static int interpolate_single_lut_scaled(struct single_row_lut *lut,
	if (x == lut->x[i] * scale) {
	if (x == lut->x[i] * scale) {
		result = lut->y[i];
		result = lut->y[i];
	} else {
	} else {
		result = linear_interpolate(
		result = linear_interpolate_bms(
			lut->y[i - 1],
			lut->y[i - 1],
			lut->x[i - 1] * scale,
			lut->x[i - 1] * scale,
			lut->y[i],
			lut->y[i],
@@ -57,14 +57,14 @@ static int interpolate_single_lut_scaled(struct single_row_lut *lut,
	return result;
	return result;
}
}


int interpolate_fcc(struct single_row_lut *fcc_temp_lut, int batt_temp)
int interpolate_fcc_bms(struct single_row_lut *fcc_temp_lut, int batt_temp)
{
{
	return interpolate_single_lut_scaled(fcc_temp_lut,
	return interpolate_single_lut_scaled_bms(fcc_temp_lut,
						batt_temp,
						batt_temp,
						DEGC_SCALE);
						DEGC_SCALE);
}
}


int interpolate_scalingfactor_fcc(struct single_row_lut *fcc_sf_lut,
int interpolate_scalingfactor_fcc_bms(struct single_row_lut *fcc_sf_lut,
		int cycles)
		int cycles)
{
{
	/*
	/*
@@ -72,12 +72,12 @@ int interpolate_scalingfactor_fcc(struct single_row_lut *fcc_sf_lut,
	 * that case return 100%
	 * that case return 100%
	 */
	 */
	if (fcc_sf_lut)
	if (fcc_sf_lut)
		return interpolate_single_lut_scaled(fcc_sf_lut, cycles, 1);
		return interpolate_single_lut_scaled_bms(fcc_sf_lut, cycles, 1);
	else
	else
		return 100;
		return 100;
}
}


int interpolate_scalingfactor(struct sf_lut *sf_lut, int row_entry, int pc)
int interpolate_scalingfactor_bms(struct sf_lut *sf_lut, int row_entry, int pc)
{
{
	int i, scalefactorrow1, scalefactorrow2, scalefactor, rows, cols;
	int i, scalefactorrow1, scalefactorrow2, scalefactor, rows, cols;
	int row1 = 0;
	int row1 = 0;
@@ -124,7 +124,7 @@ int interpolate_scalingfactor(struct sf_lut *sf_lut, int row_entry, int pc)
		if (row_entry <= sf_lut->row_entries[i] * DEGC_SCALE)
		if (row_entry <= sf_lut->row_entries[i] * DEGC_SCALE)
			break;
			break;
	if (row_entry == sf_lut->row_entries[i] * DEGC_SCALE) {
	if (row_entry == sf_lut->row_entries[i] * DEGC_SCALE) {
		scalefactor = linear_interpolate(
		scalefactor = linear_interpolate_bms(
				sf_lut->sf[row1][i],
				sf_lut->sf[row1][i],
				sf_lut->percent[row1],
				sf_lut->percent[row1],
				sf_lut->sf[row2][i],
				sf_lut->sf[row2][i],
@@ -133,21 +133,21 @@ int interpolate_scalingfactor(struct sf_lut *sf_lut, int row_entry, int pc)
		return scalefactor;
		return scalefactor;
	}
	}


	scalefactorrow1 = linear_interpolate(
	scalefactorrow1 = linear_interpolate_bms(
				sf_lut->sf[row1][i - 1],
				sf_lut->sf[row1][i - 1],
				sf_lut->row_entries[i - 1] * DEGC_SCALE,
				sf_lut->row_entries[i - 1] * DEGC_SCALE,
				sf_lut->sf[row1][i],
				sf_lut->sf[row1][i],
				sf_lut->row_entries[i] * DEGC_SCALE,
				sf_lut->row_entries[i] * DEGC_SCALE,
				row_entry);
				row_entry);


	scalefactorrow2 = linear_interpolate(
	scalefactorrow2 = linear_interpolate_bms(
				sf_lut->sf[row2][i - 1],
				sf_lut->sf[row2][i - 1],
				sf_lut->row_entries[i - 1] * DEGC_SCALE,
				sf_lut->row_entries[i - 1] * DEGC_SCALE,
				sf_lut->sf[row2][i],
				sf_lut->sf[row2][i],
				sf_lut->row_entries[i] * DEGC_SCALE,
				sf_lut->row_entries[i] * DEGC_SCALE,
				row_entry);
				row_entry);


	scalefactor = linear_interpolate(
	scalefactor = linear_interpolate_bms(
				scalefactorrow1,
				scalefactorrow1,
				sf_lut->percent[row1],
				sf_lut->percent[row1],
				scalefactorrow2,
				scalefactorrow2,
@@ -158,7 +158,7 @@ int interpolate_scalingfactor(struct sf_lut *sf_lut, int row_entry, int pc)
}
}


/* get ocv given a soc  -- reverse lookup */
/* get ocv given a soc  -- reverse lookup */
int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_ocv_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
				int batt_temp, int pc)
				int batt_temp, int pc)
{
{
	int i, ocvrow1, ocvrow2, ocv, rows, cols;
	int i, ocvrow1, ocvrow2, ocv, rows, cols;
@@ -199,7 +199,7 @@ int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
		if (batt_temp <= pc_temp_ocv->temp[i] * DEGC_SCALE)
		if (batt_temp <= pc_temp_ocv->temp[i] * DEGC_SCALE)
			break;
			break;
	if (batt_temp == pc_temp_ocv->temp[i] * DEGC_SCALE) {
	if (batt_temp == pc_temp_ocv->temp[i] * DEGC_SCALE) {
		ocv = linear_interpolate(
		ocv = linear_interpolate_bms(
				pc_temp_ocv->ocv[row1][i],
				pc_temp_ocv->ocv[row1][i],
				pc_temp_ocv->percent[row1],
				pc_temp_ocv->percent[row1],
				pc_temp_ocv->ocv[row2][i],
				pc_temp_ocv->ocv[row2][i],
@@ -208,21 +208,21 @@ int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
		return ocv;
		return ocv;
	}
	}


	ocvrow1 = linear_interpolate(
	ocvrow1 = linear_interpolate_bms(
				pc_temp_ocv->ocv[row1][i - 1],
				pc_temp_ocv->ocv[row1][i - 1],
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->ocv[row1][i],
				pc_temp_ocv->ocv[row1][i],
				pc_temp_ocv->temp[i] * DEGC_SCALE,
				pc_temp_ocv->temp[i] * DEGC_SCALE,
				batt_temp);
				batt_temp);


	ocvrow2 = linear_interpolate(
	ocvrow2 = linear_interpolate_bms(
				pc_temp_ocv->ocv[row2][i - 1],
				pc_temp_ocv->ocv[row2][i - 1],
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->ocv[row2][i],
				pc_temp_ocv->ocv[row2][i],
				pc_temp_ocv->temp[i] * DEGC_SCALE,
				pc_temp_ocv->temp[i] * DEGC_SCALE,
				batt_temp);
				batt_temp);


	ocv = linear_interpolate(
	ocv = linear_interpolate_bms(
				ocvrow1,
				ocvrow1,
				pc_temp_ocv->percent[row1],
				pc_temp_ocv->percent[row1],
				ocvrow2,
				ocvrow2,
@@ -232,7 +232,7 @@ int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
	return ocv;
	return ocv;
}
}


int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_pc_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
				int batt_temp, int ocv)
				int batt_temp, int ocv)
{
{
	int i, j, pcj, pcj_minus_one, pc;
	int i, j, pcj, pcj_minus_one, pc;
@@ -262,7 +262,7 @@ int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
			if (ocv >= pc_temp_ocv->ocv[i][j]) {
			if (ocv >= pc_temp_ocv->ocv[i][j]) {
				if (ocv == pc_temp_ocv->ocv[i][j])
				if (ocv == pc_temp_ocv->ocv[i][j])
					return pc_temp_ocv->percent[i];
					return pc_temp_ocv->percent[i];
				pc = linear_interpolate(
				pc = linear_interpolate_bms(
					pc_temp_ocv->percent[i],
					pc_temp_ocv->percent[i],
					pc_temp_ocv->ocv[i][j],
					pc_temp_ocv->ocv[i][j],
					pc_temp_ocv->percent[i - 1],
					pc_temp_ocv->percent[i - 1],
@@ -288,7 +288,7 @@ int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
		if (pcj == 0
		if (pcj == 0
			&& is_between(pc_temp_ocv->ocv[i][j],
			&& is_between(pc_temp_ocv->ocv[i][j],
				pc_temp_ocv->ocv[i+1][j], ocv)) {
				pc_temp_ocv->ocv[i+1][j], ocv)) {
			pcj = linear_interpolate(
			pcj = linear_interpolate_bms(
				pc_temp_ocv->percent[i],
				pc_temp_ocv->percent[i],
				pc_temp_ocv->ocv[i][j],
				pc_temp_ocv->ocv[i][j],
				pc_temp_ocv->percent[i + 1],
				pc_temp_ocv->percent[i + 1],
@@ -299,7 +299,7 @@ int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
		if (pcj_minus_one == 0
		if (pcj_minus_one == 0
			&& is_between(pc_temp_ocv->ocv[i][j-1],
			&& is_between(pc_temp_ocv->ocv[i][j-1],
				pc_temp_ocv->ocv[i+1][j-1], ocv)) {
				pc_temp_ocv->ocv[i+1][j-1], ocv)) {
			pcj_minus_one = linear_interpolate(
			pcj_minus_one = linear_interpolate_bms(
				pc_temp_ocv->percent[i],
				pc_temp_ocv->percent[i],
				pc_temp_ocv->ocv[i][j-1],
				pc_temp_ocv->ocv[i][j-1],
				pc_temp_ocv->percent[i + 1],
				pc_temp_ocv->percent[i + 1],
@@ -308,7 +308,7 @@ int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
		}
		}


		if (pcj && pcj_minus_one) {
		if (pcj && pcj_minus_one) {
			pc = linear_interpolate(
			pc = linear_interpolate_bms(
				pcj_minus_one,
				pcj_minus_one,
				pc_temp_ocv->temp[j-1] * DEGC_SCALE,
				pc_temp_ocv->temp[j-1] * DEGC_SCALE,
				pcj,
				pcj,
@@ -329,7 +329,7 @@ int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
	return 100;
	return 100;
}
}


int interpolate_slope(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_slope_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
					int batt_temp, int pc)
					int batt_temp, int pc)
{
{
	int i, ocvrow1, ocvrow2, rows, cols;
	int i, ocvrow1, ocvrow2, rows, cols;
@@ -385,14 +385,14 @@ int interpolate_slope(struct pc_temp_ocv_lut *pc_temp_ocv,
			pc_temp_ocv->percent[row2]);
			pc_temp_ocv->percent[row2]);
		return slope;
		return slope;
	}
	}
	ocvrow1 = linear_interpolate(
	ocvrow1 = linear_interpolate_bms(
			pc_temp_ocv->ocv[row1][i - 1],
			pc_temp_ocv->ocv[row1][i - 1],
			pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
			pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
			pc_temp_ocv->ocv[row1][i],
			pc_temp_ocv->ocv[row1][i],
			pc_temp_ocv->temp[i] * DEGC_SCALE,
			pc_temp_ocv->temp[i] * DEGC_SCALE,
			batt_temp);
			batt_temp);


	ocvrow2 = linear_interpolate(
	ocvrow2 = linear_interpolate_bms(
			pc_temp_ocv->ocv[row2][i - 1],
			pc_temp_ocv->ocv[row2][i - 1],
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->temp[i - 1] * DEGC_SCALE,
				pc_temp_ocv->ocv[row2][i],
				pc_temp_ocv->ocv[row2][i],
@@ -411,7 +411,7 @@ int interpolate_slope(struct pc_temp_ocv_lut *pc_temp_ocv,
}
}




int interpolate_acc(struct ibat_temp_acc_lut *ibat_acc_lut,
int interpolate_acc_bms(struct ibat_temp_acc_lut *ibat_acc_lut,
					int batt_temp, int ibat)
					int batt_temp, int ibat)
{
{
	int i, accrow1, accrow2, rows, cols;
	int i, accrow1, accrow2, rows, cols;
@@ -457,7 +457,7 @@ int interpolate_acc(struct ibat_temp_acc_lut *ibat_acc_lut,
			break;
			break;


	if (batt_temp == (ibat_acc_lut->temp[i] * DEGC_SCALE)) {
	if (batt_temp == (ibat_acc_lut->temp[i] * DEGC_SCALE)) {
		acc = linear_interpolate(
		acc = linear_interpolate_bms(
			ibat_acc_lut->acc[row1][i],
			ibat_acc_lut->acc[row1][i],
			ibat_acc_lut->ibat[row1],
			ibat_acc_lut->ibat[row1],
			ibat_acc_lut->acc[row2][i],
			ibat_acc_lut->acc[row2][i],
@@ -466,21 +466,21 @@ int interpolate_acc(struct ibat_temp_acc_lut *ibat_acc_lut,
		return acc;
		return acc;
	}
	}


	accrow1 = linear_interpolate(
	accrow1 = linear_interpolate_bms(
		ibat_acc_lut->acc[row1][i - 1],
		ibat_acc_lut->acc[row1][i - 1],
		ibat_acc_lut->temp[i - 1] * DEGC_SCALE,
		ibat_acc_lut->temp[i - 1] * DEGC_SCALE,
		ibat_acc_lut->acc[row1][i],
		ibat_acc_lut->acc[row1][i],
		ibat_acc_lut->temp[i] * DEGC_SCALE,
		ibat_acc_lut->temp[i] * DEGC_SCALE,
		batt_temp);
		batt_temp);


	accrow2 = linear_interpolate(
	accrow2 = linear_interpolate_bms(
		ibat_acc_lut->acc[row2][i - 1],
		ibat_acc_lut->acc[row2][i - 1],
		ibat_acc_lut->temp[i - 1] * DEGC_SCALE,
		ibat_acc_lut->temp[i - 1] * DEGC_SCALE,
		ibat_acc_lut->acc[row2][i],
		ibat_acc_lut->acc[row2][i],
		ibat_acc_lut->temp[i] * DEGC_SCALE,
		ibat_acc_lut->temp[i] * DEGC_SCALE,
		batt_temp);
		batt_temp);


	acc = linear_interpolate(accrow1,
	acc = linear_interpolate_bms(accrow1,
			ibat_acc_lut->ibat[row1],
			ibat_acc_lut->ibat[row1],
			accrow2,
			accrow2,
			ibat_acc_lut->ibat[row2],
			ibat_acc_lut->ibat[row2],
+8 −7
Original line number Original line Diff line number Diff line
@@ -953,9 +953,9 @@ static int lookup_soc_ocv(struct qpnp_bms_chip *chip, int ocv_uv, int batt_temp)
	int soc_ocv = 0, soc_cutoff = 0, soc_final = 0;
	int soc_ocv = 0, soc_cutoff = 0, soc_final = 0;
	int fcc, acc, soc_uuc = 0, soc_acc = 0, iavg_ma = 0;
	int fcc, acc, soc_uuc = 0, soc_acc = 0, iavg_ma = 0;


	soc_ocv = interpolate_pc(chip->batt_data->pc_temp_ocv_lut,
	soc_ocv = interpolate_pc_bms(chip->batt_data->pc_temp_ocv_lut,
					batt_temp, ocv_uv / 1000);
					batt_temp, ocv_uv / 1000);
	soc_cutoff = interpolate_pc(chip->batt_data->pc_temp_ocv_lut,
	soc_cutoff = interpolate_pc_bms(chip->batt_data->pc_temp_ocv_lut,
				batt_temp, chip->dt.cfg_v_cutoff_uv / 1000);
				batt_temp, chip->dt.cfg_v_cutoff_uv / 1000);


	soc_final = DIV_ROUND_CLOSEST(100 * (soc_ocv - soc_cutoff),
	soc_final = DIV_ROUND_CLOSEST(100 * (soc_ocv - soc_cutoff),
@@ -974,9 +974,9 @@ static int lookup_soc_ocv(struct qpnp_bms_chip *chip, int ocv_uv, int batt_temp)
			else
			else
				iavg_ma = chip->current_now / 1000;
				iavg_ma = chip->current_now / 1000;


			fcc = interpolate_fcc(chip->batt_data->fcc_temp_lut,
			fcc = interpolate_fcc_bms(chip->batt_data->fcc_temp_lut,
								batt_temp);
								batt_temp);
			acc = interpolate_acc(chip->batt_data->ibat_acc_lut,
			acc = interpolate_acc_bms(chip->batt_data->ibat_acc_lut,
							batt_temp, iavg_ma);
							batt_temp, iavg_ma);
			if (acc <= 0) {
			if (acc <= 0) {
				if (chip->last_acc)
				if (chip->last_acc)
@@ -1249,7 +1249,8 @@ static int get_rbatt(struct qpnp_bms_chip *chip, int soc, int batt_temp)
		return rbatt_mohm;
		return rbatt_mohm;
	}
	}


	scalefactor = interpolate_scalingfactor(chip->batt_data->rbatt_sf_lut,
	scalefactor = interpolate_scalingfactor_bms(
						chip->batt_data->rbatt_sf_lut,
						batt_temp, soc);
						batt_temp, soc);
	rbatt_mohm = (rbatt_mohm * scalefactor) / 100;
	rbatt_mohm = (rbatt_mohm * scalefactor) / 100;


@@ -2847,7 +2848,7 @@ static int interpolate_current_comp(int die_temp)
	if (die_temp == (temp_curr_comp_lut[i].temp_decideg))
	if (die_temp == (temp_curr_comp_lut[i].temp_decideg))
		return temp_curr_comp_lut[i].current_ma;
		return temp_curr_comp_lut[i].current_ma;


	return linear_interpolate(
	return linear_interpolate_bms(
				temp_curr_comp_lut[i - 1].current_ma,
				temp_curr_comp_lut[i - 1].current_ma,
				temp_curr_comp_lut[i - 1].temp_decideg,
				temp_curr_comp_lut[i - 1].temp_decideg,
				temp_curr_comp_lut[i].current_ma,
				temp_curr_comp_lut[i].current_ma,
@@ -2864,7 +2865,7 @@ static void adjust_pon_ocv(struct qpnp_bms_chip *chip, int batt_temp)
	if (rc) {
	if (rc) {
		pr_err("error reading adc channel=%d, rc=%d\n", DIE_TEMP, rc);
		pr_err("error reading adc channel=%d, rc=%d\n", DIE_TEMP, rc);
	} else {
	} else {
		pc = interpolate_pc(chip->batt_data->pc_temp_ocv_lut,
		pc = interpolate_pc_bms(chip->batt_data->pc_temp_ocv_lut,
					batt_temp, chip->last_ocv_uv / 1000);
					batt_temp, chip->last_ocv_uv / 1000);
		/*
		/*
		 * For pc < 2, use the rbatt of pc = 2. This is to avoid
		 * For pc < 2, use the rbatt of pc = 2. This is to avoid
+17 −17
Original line number Original line Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, 2018, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -160,55 +160,55 @@ extern struct bms_battery_data oem_batt_data;
extern struct bms_battery_data QRD_4v35_2000mAh_data;
extern struct bms_battery_data QRD_4v35_2000mAh_data;
extern struct bms_battery_data  qrd_4v2_1300mah_data;
extern struct bms_battery_data  qrd_4v2_1300mah_data;


int interpolate_fcc(struct single_row_lut *fcc_temp_lut, int batt_temp);
int interpolate_fcc_bms(struct single_row_lut *fcc_temp_lut, int batt_temp);
int interpolate_scalingfactor(struct sf_lut *sf_lut, int row_entry, int pc);
int interpolate_scalingfactor_bms(struct sf_lut *sf_lut, int row_entry, int pc);
int interpolate_scalingfactor_fcc(struct single_row_lut *fcc_sf_lut,
int interpolate_scalingfactor_fcc_bms(struct single_row_lut *fcc_sf_lut,
				int cycles);
				int cycles);
int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_pc_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
				int batt_temp_degc, int ocv);
				int batt_temp_degc, int ocv);
int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_ocv_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
				int batt_temp_degc, int pc);
				int batt_temp_degc, int pc);
int interpolate_slope(struct pc_temp_ocv_lut *pc_temp_ocv,
int interpolate_slope_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
					int batt_temp, int pc);
					int batt_temp, int pc);
int interpolate_acc(struct ibat_temp_acc_lut *ibat_acc_lut,
int interpolate_acc_bms(struct ibat_temp_acc_lut *ibat_acc_lut,
					int batt_temp, int ibat);
					int batt_temp, int ibat);
int linear_interpolate(int y0, int x0, int y1, int x1, int x);
int linear_interpolate_bms(int y0, int x0, int y1, int x1, int x);
#else
#else
static inline int interpolate_fcc(struct single_row_lut *fcc_temp_lut,
static inline int interpolate_fcc_bms(struct single_row_lut *fcc_temp_lut,
			int batt_temp)
			int batt_temp)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_scalingfactor(struct sf_lut *sf_lut,
static inline int interpolate_scalingfactor_bms(struct sf_lut *sf_lut,
			int row_entry, int pc)
			int row_entry, int pc)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_scalingfactor_fcc(
static inline int interpolate_scalingfactor_fcc_bms(
			struct single_row_lut *fcc_sf_lut, int cycles)
			struct single_row_lut *fcc_sf_lut, int cycles)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_pc(struct pc_temp_ocv_lut *pc_temp_ocv,
static inline int interpolate_pc_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
			int batt_temp_degc, int ocv)
			int batt_temp_degc, int ocv)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_ocv(struct pc_temp_ocv_lut *pc_temp_ocv,
static inline int interpolate_ocv_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
			int batt_temp_degc, int pc)
			int batt_temp_degc, int pc)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_slope(struct pc_temp_ocv_lut *pc_temp_ocv,
static inline int interpolate_slope_bms(struct pc_temp_ocv_lut *pc_temp_ocv,
					int batt_temp, int pc)
					int batt_temp, int pc)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int linear_interpolate(int y0, int x0, int y1, int x1, int x)
static inline int linear_interpolate_bms(int y0, int x0, int y1, int x1, int x)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
static inline int interpolate_acc(struct ibat_temp_acc_lut *ibat_acc_lut,
static inline int interpolate_acc_bms(struct ibat_temp_acc_lut *ibat_acc_lut,
						int batt_temp, int ibat)
						int batt_temp, int ibat)
{
{
	return -EINVAL;
	return -EINVAL;