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

Commit be228ea9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

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

parents e6860653 060bc2d8
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);
}