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

Commit abc63c08 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: fg-alg: add min_start_soc to begin the capacity learning"

parents 033096f5 8bd6de99
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -391,13 +391,15 @@ static int cap_learning_process_full_data(struct cap_learning *cl)
 */
static int cap_learning_begin(struct cap_learning *cl, u32 batt_soc)
{
	int rc, cc_soc_sw, batt_soc_msb;
	int rc, cc_soc_sw, batt_soc_msb, batt_soc_pct;

	batt_soc_msb = batt_soc >> 24;
	if (DIV_ROUND_CLOSEST(batt_soc_msb * 100, FULL_SOC_RAW) >
		cl->dt.start_soc) {
		pr_debug("Battery SOC %d is high!, not starting\n",
			batt_soc_msb);
	batt_soc_pct = DIV_ROUND_CLOSEST(batt_soc_msb * 100, FULL_SOC_RAW);

	if (batt_soc_pct > cl->dt.max_start_soc ||
			batt_soc_pct < cl->dt.min_start_soc) {
		pr_debug("Battery SOC %d is high/low, not starting\n",
			batt_soc_pct);
		return -EINVAL;
	}

+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@ struct cycle_counter {
};

struct cl_params {
	int	start_soc;
	int	min_start_soc;
	int	max_start_soc;
	int	max_temp;
	int	min_temp;
	int	max_cap_inc;
+2 −2
Original line number Diff line number Diff line
@@ -2941,9 +2941,9 @@ static int fg_gen4_parse_dt(struct fg_gen4_chip *chip)

	rc = of_property_read_u32(node, "qcom,cl-start-capacity", &temp);
	if (rc < 0)
		chip->cl->dt.start_soc = DEFAULT_CL_START_SOC;
		chip->cl->dt.max_start_soc = DEFAULT_CL_START_SOC;
	else
		chip->cl->dt.start_soc = temp;
		chip->cl->dt.max_start_soc = temp;

	rc = of_property_read_u32(node, "qcom,cl-min-temp", &temp);
	if (rc < 0)