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

Commit 09d088f3 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-fg-gen3: Configure ESR timer at shutdown



On the PMW3100 wear platform which supports TWM mode, the FG
ESR timer (during TWM) can be increased as the system power
consumption is low. Add support for it by configuring the
ESR timer at shutdown.

Change-Id: I6cb2859437fcbcd1ffb1a73a190f0def86f9deaa
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent e149f565
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -179,6 +179,14 @@ First Level Node - FG Gen3 device
		    Element 0 - Retry value for timer
		    Element 1 - Maximum value for timer

- qcom,fg-esr-timer-shutdown
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Number of cycles between ESR pulses at/after shutdwon.This is
		    defined when TWM (traditional watch mode) is supported.
		    Element 0 - Retry value for timer
		    Element 1 - Maximum value for timer

- qcom,fg-esr-pulse-thresh-ma
	Usage:      optional
	Value type: <u32>
+1 −0
Original line number Diff line number Diff line
@@ -297,6 +297,7 @@ struct fg_dt_props {
	int	esr_timer_charging[NUM_ESR_TIMERS];
	int	esr_timer_awake[NUM_ESR_TIMERS];
	int	esr_timer_asleep[NUM_ESR_TIMERS];
	int	esr_timer_shutdown[NUM_ESR_TIMERS];
	int	rconn_mohms;
	int	esr_clamp_mohms;
	int	cl_start_soc;
+14 −0
Original line number Diff line number Diff line
@@ -5350,6 +5350,13 @@ static int fg_parse_dt(struct fg_chip *chip)
		chip->dt.esr_timer_asleep[TIMER_MAX] = -EINVAL;
	}

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

	chip->cyc_ctr.en = of_property_read_bool(node, "qcom,cycle-counter-en");

	chip->dt.force_load_profile = of_property_read_bool(node,
@@ -5871,6 +5878,13 @@ static void fg_gen3_shutdown(struct platform_device *pdev)
			return;
		}
	}
	rc = fg_set_esr_timer(chip, chip->dt.esr_timer_shutdown[TIMER_RETRY],
				chip->dt.esr_timer_shutdown[TIMER_MAX], false,
				FG_IMA_NO_WLOCK);
	if (rc < 0)
		pr_err("Error in setting ESR timer at shutdown, rc=%d\n", rc);

	fg_cleanup(chip);
}

static const struct of_device_id fg_gen3_match_table[] = {