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

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

power: qpnp-qg: Add a start condition to begin CL



Only start capacity learning if the charge current is
greater than 100mA (device is actually charging).

Change-Id: I9b07e5fb32f4bfc814337224bf41d44043603741
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 4a00f6e6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2277,6 +2277,17 @@ static const struct power_supply_desc qg_psy_desc = {
	.property_is_writeable = qg_property_is_writeable,
};

#define DEFAULT_CL_BEGIN_IBAT_UA	(-100000)
static bool qg_cl_ok_to_begin(void *data)
{
	struct qpnp_qg *chip = data;

	if (chip->last_fifo_i_ua < DEFAULT_CL_BEGIN_IBAT_UA)
		return true;

	return false;
}

#define DEFAULT_RECHARGE_SOC 95
static int qg_charge_full_update(struct qpnp_qg *chip)
{
@@ -3752,6 +3763,7 @@ static int qg_alg_init(struct qpnp_qg *chip)
	cl->get_cc_soc = qg_get_cc_soc;
	cl->get_learned_capacity = qg_get_learned_capacity;
	cl->store_learned_capacity = qg_store_learned_capacity;
	cl->ok_to_begin = qg_cl_ok_to_begin;
	cl->data = chip;

	rc = cap_learning_init(cl);