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

Commit 2ccc177b authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power: qpnp-fg-gen4: Modify Full SoC Ki coefficients



Change default values of Full SoC Ki coefficients to 40 (decimal) when
they are not specified via device tree, and also set them to zero while
discharging.

Change-Id: Ibc98a67e8d4da2c2ea3f3b48ef43e0497b55842f
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 38b3a2b2
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1408,8 +1408,8 @@ static void fg_gen4_update_rslow_coeff(struct fg_dev *fg, int batt_temp)
	}
}

#define KI_COEFF_FULL_SOC_NORM_DEFAULT		733
#define KI_COEFF_FULL_SOC_LOW_DEFAULT		184
#define KI_COEFF_FULL_SOC_NORM_DEFAULT	2442
#define KI_COEFF_FULL_SOC_LOW_DEFAULT	2442
static int fg_gen4_adjust_ki_coeff_full_soc(struct fg_gen4_chip *chip,
						int batt_temp)
{
@@ -1417,15 +1417,13 @@ static int fg_gen4_adjust_ki_coeff_full_soc(struct fg_gen4_chip *chip,
	int rc, ki_coeff_full_soc_norm, ki_coeff_full_soc_low;
	u8 val;

	if (batt_temp < 0) {
	if ((batt_temp < 0) ||
		(fg->charge_status == POWER_SUPPLY_STATUS_DISCHARGING)) {
		ki_coeff_full_soc_norm = 0;
		ki_coeff_full_soc_low = 0;
	} else if (fg->charge_status == POWER_SUPPLY_STATUS_DISCHARGING) {
	} else if (fg->charge_status == POWER_SUPPLY_STATUS_CHARGING) {
		ki_coeff_full_soc_norm = chip->dt.ki_coeff_full_soc_dischg[0];
		ki_coeff_full_soc_low = chip->dt.ki_coeff_full_soc_dischg[1];
	} else {
		ki_coeff_full_soc_norm = KI_COEFF_FULL_SOC_NORM_DEFAULT;
		ki_coeff_full_soc_low = KI_COEFF_FULL_SOC_LOW_DEFAULT;
	}

	if (chip->ki_coeff_full_soc[0] == ki_coeff_full_soc_norm &&
@@ -5222,6 +5220,9 @@ static int fg_parse_ki_coefficients(struct fg_dev *fg)
	struct device_node *node = fg->dev->of_node;
	int rc, i;

	chip->dt.ki_coeff_full_soc_dischg[0] = KI_COEFF_FULL_SOC_NORM_DEFAULT;
	chip->dt.ki_coeff_full_soc_dischg[1] = KI_COEFF_FULL_SOC_LOW_DEFAULT;

	if (of_find_property(node, "qcom,ki-coeff-full-dischg", NULL)) {
		rc = fg_parse_dt_property_u32_array(node,
			"qcom,ki-coeff-full-dischg",