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

Commit 54434ff9 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-bms: do not change OCV to reach 0% at boot"

parents 6421ddcc 4d238cc7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2264,6 +2264,7 @@ static void configure_soc_wakeup(struct qpnp_bms_chip *chip,
			(uint16_t)ocv_raw);
}

#define BAD_SOC_THRESH	-10
static int calculate_raw_soc(struct qpnp_bms_chip *chip,
					struct raw_soc_params *raw,
					struct soc_params *params,
@@ -2280,7 +2281,7 @@ static int calculate_raw_soc(struct qpnp_bms_chip *chip,
	soc = DIV_ROUND_CLOSEST((remaining_usable_charge_uah * 100),
				(params->fcc_uah - params->uuc_uah));

	if (chip->first_time_calc_soc && soc < 0) {
	if (chip->first_time_calc_soc && soc > BAD_SOC_THRESH && soc < 0) {
		/*
		 * first time calcualtion and the pon ocv  is too low resulting
		 * in a bad soc. Adjust ocv to get 0 soc
@@ -2305,7 +2306,7 @@ static int calculate_raw_soc(struct qpnp_bms_chip *chip,
	if (soc > 100)
		soc = 100;

	if (soc < 0) {
	if (soc > BAD_SOC_THRESH && soc < 0) {
		pr_debug("bad rem_usb_chg = %d rem_chg %d, cc_uah %d, unusb_chg %d\n",
				remaining_usable_charge_uah,
				params->ocv_charge_uah,