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

Commit ca60967b authored by Sahil Chandna's avatar Sahil Chandna Committed by Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Add support for weighted capacity learning



Add support to loosen capacity learning qualifying criterion.
This helps to learn capacity from any starting battery SOC to
any ending battery SOC, provided, battery SOC changes by at least
10 % during charging. Assign weight to this capacity learning
event based on the change in battery SOC.

Change-Id: I67cf2e810649c9d77b7aeca79e235be4ab01027f
Signed-off-by: default avatarSahil Chandna <chandna@codeaurora.org>
parent 2082efff
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4493,6 +4493,7 @@ static void fg_gen4_parse_batt_temp_dt(struct fg_gen4_chip *chip)
#define DEFAULT_CL_MAX_DEC_DECIPERC	100
#define DEFAULT_CL_MIN_LIM_DECIPERC	0
#define DEFAULT_CL_MAX_LIM_DECIPERC	0
#define DEFAULT_CL_DELTA_BATT_SOC	10
#define DEFAULT_ESR_PULSE_THRESH_MA	47
#define DEFAULT_ESR_MEAS_CURR_MA	120

@@ -4658,6 +4659,14 @@ static int fg_gen4_parse_dt(struct fg_gen4_chip *chip)
	else
		chip->cl->dt.max_start_soc = temp;

	chip->cl->dt.min_delta_batt_soc = DEFAULT_CL_DELTA_BATT_SOC;
	/* read from DT property and update, if value exists */
	of_property_read_u32(node, "qcom,cl-min-delta-batt-soc",
					&chip->cl->dt.min_delta_batt_soc);

	chip->cl->dt.cl_wt_enable = of_property_read_bool(node,
						"qcom,cl-wt-enable");

	rc = of_property_read_u32(node, "qcom,cl-min-temp", &temp);
	if (rc < 0)
		chip->cl->dt.min_temp = DEFAULT_CL_MIN_TEMP_DECIDEGC;