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

Commit c85cf111 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-fg: fix error in calculating cc_to_soc coefficient"

parents 074ed27b 3d1ffb74
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2926,7 +2926,7 @@ static void fg_cap_learning_load_data(struct fg_chip *chip)
static void fg_cap_learning_save_data(struct fg_chip *chip)
{
	int16_t cc_mah;
	int64_t cc_to_soc_coeff;
	int64_t cc_to_soc_coeff, mah_to_soc;
	int rc;
	u8 data[2];

@@ -2951,7 +2951,9 @@ static void fg_cap_learning_save_data(struct fg_chip *chip)
		if (rc) {
			pr_err("Failed to read mah_to_soc_conv_cs: %d\n", rc);
		} else {
			cc_to_soc_coeff = div64_s64(half_float(data), cc_mah);
			mah_to_soc = data[1] << 8 | data[0];
			mah_to_soc *= MICRO_UNIT;
			cc_to_soc_coeff = div64_s64(mah_to_soc, cc_mah);
			half_float_to_buffer(cc_to_soc_coeff, data);
			rc = fg_mem_write(chip, (u8 *)data,
					ACTUAL_CAPACITY_REG, 2,