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

Commit 060bc2d8 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

power: qpnp-vm-bms: update PON OCV compensation table



Update PON OCV current compensation values due the change
in PMIC PBS sequence.

While at it remove capacitive resistance from the RBATT
calculation during PON OCV adjustment as capacitive
resistance is negligible at low current.

CRs-Fixed: 730004
Change-Id: I7516a0a878f3b72449f6cce4de95c5273a495db8
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 2f0184f7
Loading
Loading
Loading
Loading
+10 −17
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ struct bms_wakeup_source {
};

struct temp_curr_comp_map {
	int temp_deg;
	int temp_decideg;
	int current_ma;
};

@@ -275,14 +275,10 @@ struct qpnp_bms_chip {

static struct qpnp_bms_chip *the_chip;

/*
 * TODO: Characterize current compensation at different temperature and
 * update table.
 */
static struct temp_curr_comp_map temp_curr_comp_lut[] = {
			{-200, 40},
			{250, 40},
			{600, 40},
			{-300, 15},
			{250, 17},
			{850, 28},
};

static void disable_bms_irq(struct bms_irq *irq)
@@ -1243,9 +1239,6 @@ static int get_rbatt(struct qpnp_bms_chip *chip, int soc, int batt_temp)
	if (chip->dt.cfg_r_conn_mohm > 0)
		rbatt_mohm += chip->dt.cfg_r_conn_mohm;

	if (chip->batt_data->rbatt_capacitive_mohm > 0)
		rbatt_mohm += chip->batt_data->rbatt_capacitive_mohm;

	return rbatt_mohm;
}

@@ -2594,24 +2587,24 @@ static int interpolate_current_comp(int die_temp)
	int i;
	int num_rows = ARRAY_SIZE(temp_curr_comp_lut);

	if (die_temp <= (temp_curr_comp_lut[0].temp_deg))
	if (die_temp <= (temp_curr_comp_lut[0].temp_decideg))
		return temp_curr_comp_lut[0].current_ma;

	if (die_temp >= (temp_curr_comp_lut[num_rows - 1].temp_deg))
	if (die_temp >= (temp_curr_comp_lut[num_rows - 1].temp_decideg))
		return temp_curr_comp_lut[num_rows - 1].current_ma;

	for (i = 0; i < num_rows - 1; i++)
		if (die_temp  <= (temp_curr_comp_lut[i].temp_deg))
		if (die_temp  <= (temp_curr_comp_lut[i].temp_decideg))
			break;

	if (die_temp == (temp_curr_comp_lut[i].temp_deg))
	if (die_temp == (temp_curr_comp_lut[i].temp_decideg))
		return temp_curr_comp_lut[i].current_ma;

	return linear_interpolate(
				temp_curr_comp_lut[i - 1].current_ma,
				temp_curr_comp_lut[i - 1].temp_deg,
				temp_curr_comp_lut[i - 1].temp_decideg,
				temp_curr_comp_lut[i].current_ma,
				temp_curr_comp_lut[i].temp_deg,
				temp_curr_comp_lut[i].temp_decideg,
				die_temp);
}