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

Commit 81899be2 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Fix ESR timer initialization



Currently, while parsing the ESR charging and discharging timers
from the device tree, they're initialized to -EINVAL only if the
parsing function returns an error. Since the default values for
ESR timers are set to 0, fg_set_esr_timer() when called can set
the timers to 0 when it is not supposed to. Fix it.

CRs-Fixed: 2280822
Change-Id: I59bcc627fa836adfef210890e9019dc6c04bb614
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent f6fbeafa
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -3882,35 +3882,35 @@ static int fg_gen4_parse_dt(struct fg_gen4_chip *chip)
	else
		chip->dt.delta_soc_thr = temp;

	rc = fg_parse_dt_property_u32_array(node, "qcom,fg-esr-timer-chg-fast",
		chip->dt.esr_timer_chg_fast, NUM_ESR_TIMERS);
	if (rc < 0) {
	chip->dt.esr_timer_chg_fast[TIMER_RETRY] = -EINVAL;
	chip->dt.esr_timer_chg_fast[TIMER_MAX] = -EINVAL;
	}
	rc = fg_parse_dt_property_u32_array(node, "qcom,fg-esr-timer-chg-fast",
		chip->dt.esr_timer_chg_fast, NUM_ESR_TIMERS);
	if (rc < 0)
		return rc;

	chip->dt.esr_timer_dischg_fast[TIMER_RETRY] = -EINVAL;
	chip->dt.esr_timer_dischg_fast[TIMER_MAX] = -EINVAL;
	rc = fg_parse_dt_property_u32_array(node,
		"qcom,fg-esr-timer-dischg-fast", chip->dt.esr_timer_dischg_fast,
		NUM_ESR_TIMERS);
	if (rc < 0) {
		chip->dt.esr_timer_dischg_fast[TIMER_RETRY] = -EINVAL;
		chip->dt.esr_timer_dischg_fast[TIMER_MAX] = -EINVAL;
	}
	if (rc < 0)
		return rc;

	rc = fg_parse_dt_property_u32_array(node, "qcom,fg-esr-timer-chg-slow",
		chip->dt.esr_timer_chg_slow, NUM_ESR_TIMERS);
	if (rc < 0) {
	chip->dt.esr_timer_chg_slow[TIMER_RETRY] = -EINVAL;
	chip->dt.esr_timer_chg_slow[TIMER_MAX] = -EINVAL;
	}
	rc = fg_parse_dt_property_u32_array(node, "qcom,fg-esr-timer-chg-slow",
		chip->dt.esr_timer_chg_slow, NUM_ESR_TIMERS);
	if (rc < 0)
		return rc;

	chip->dt.esr_timer_dischg_slow[TIMER_RETRY] = -EINVAL;
	chip->dt.esr_timer_dischg_slow[TIMER_MAX] = -EINVAL;
	rc = fg_parse_dt_property_u32_array(node,
		"qcom,fg-esr-timer-dischg-slow", chip->dt.esr_timer_dischg_slow,
		NUM_ESR_TIMERS);
	if (rc < 0) {
		chip->dt.esr_timer_dischg_slow[TIMER_RETRY] = -EINVAL;
		chip->dt.esr_timer_dischg_slow[TIMER_MAX] = -EINVAL;
	}
	if (rc < 0)
		return rc;

	chip->dt.force_load_profile = of_property_read_bool(node,
					"qcom,fg-force-load-profile");