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

Commit 53516322 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: add support for ESR fast calibration



Add support for ESR fast calibration algorithm as per hardware
recommendation. ESR timers will be configured with a faster
period and the measured ESR will be used to feedback the FG
hardware so that the ESR can be measured quickly again. Once
the ESR fast calibration is done after a certain number of
measurements, ESR timers will be configured back with a default
or slow period and ESR delta interrupt will be kept disabled.

Also, change the ESR pulse threshold from 110 mA to 47 mA so that
ESR pulses can be qualified better.

Change-Id: I9fa58ff1efbdc1b8fedf94acc33a43a91a94fad1
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 489afaf5
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -111,6 +111,46 @@ First Level Node - FG Gen4 device
		    Element 0 - Retry value for timer
		    Element 1 - Maximum value for timer

- qcom,fg-esr-cal-soc-thresh
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: SOC thresholds applied when ESR fast calibration is done.
		    Array of 2 elements if specified. This should be specified
		    if ESR fast calibration algorithm is needed.
		    Element 0 - Minimum SOC threshold in percentage
		    Element 1 - Maximum SOC threshold in percentage

- qcom,fg-esr-cal-temp-thresh
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: Battery temperature thresholds applied when ESR fast
		    calibration is done. Array of 2 elements if specified.
		    This should be specified if ESR fast calibration algorithm
		    is needed.
		    Element 0 - Minimum temperature threshold in Celsius
		    Element 1 - Maximum temperature threshold in Celsius

- qcom,fg-delta-esr-disable-count
	Usage:      optional
	Value type: <u32>
	Definition: Value after which delta ESR interrupt will be disabled.
		    This is applicable only when ESR fast calibration is
		    enabled. Default value is 10.

- qcom,fg-delta-esr-thr
	Usage:      optional
	Value type: <u32>
	Definition: Threshold for delta ESR interrupt in uOhms. Default value
		    is 1832. If ESR fast calibration algorithm is enabled, this
		    will be overridden with a maximum value.

- qcom,fg-esr-filter-factor
	Usage:      optional
	Value type: <u32>
	Definition: ESR filter factor used in ESR fast calibration algorithm.
		    This factor will be used when ESR correction delta is
		    applied after the calculation. Default value is 2.

- qcom,fg-esr-pulse-thresh-ma
	Usage:      optional
	Value type: <u32>
+9 −0
Original line number Diff line number Diff line
@@ -63,10 +63,14 @@
#define SRAM_WRITE		"fg_sram_write"
#define PROFILE_LOAD		"fg_profile_load"
#define TTF_PRIMING		"fg_ttf_priming"
#define ESR_CALIB		"fg_esr_calib"

/* Delta BSOC irq votable reasons */
#define DELTA_BSOC_IRQ_VOTER	"fg_delta_bsoc_irq"

/* Delta ESR irq votable reasons */
#define DELTA_ESR_IRQ_VOTER	"fg_delta_esr_irq"

/* Battery missing irq votable reasons */
#define BATT_MISS_IRQ_VOTER	"fg_batt_miss_irq"

@@ -205,6 +209,11 @@ enum fg_sram_param_id {
	FG_SRAM_SLOPE_LIMIT,
	FG_SRAM_BATT_TEMP_COLD,
	FG_SRAM_BATT_TEMP_HOT,
	FG_SRAM_ESR_CAL_SOC_MIN,
	FG_SRAM_ESR_CAL_SOC_MAX,
	FG_SRAM_ESR_CAL_TEMP_MIN,
	FG_SRAM_ESR_CAL_TEMP_MAX,
	FG_SRAM_DELTA_ESR_THR,
	FG_SRAM_MAX,
};

+535 −27

File changed.

Preview size limit exceeded, changes collapsed.