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

Commit e79508d1 authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

power: qpnp-smbcharger: use the fuel gauge ADC as termination source



Currently the charger always uses the analog current comparators in
order to detect the end of charge condition. However, if the charger is
using the fuel gauge charging resume function, it could reach end of
charge at a time where the fuel gauge still thinks that SOC is less than
full. This can cause the charger to repeatedly enter charging cycles.

Fix this by changing the charger to use the fuel gauge adcs if fuel
gauge is selected as the resume source.

Change-Id: I2f97a078ed7653ad278145e41418f75d26444ddd
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent e491998d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3514,6 +3514,7 @@ static inline int get_bpd(const char *name)
#define CHGR_CFG1			0xFB
#define RECHG_THRESHOLD_SRC_BIT		BIT(1)
#define TERM_I_SRC_BIT			BIT(2)
#define TERM_SRC_FG			BIT(2)
#define CHGR_CFG2			0xFC
#define CHG_INHIB_CFG_REG		0xF7
#define CHG_INHIBIT_50MV_VAL		0x00
@@ -3641,7 +3642,7 @@ static int smbchg_hw_init(struct smbchg_chip *chip)
	if (chip->chg_inhibit_source_fg)
		rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1,
			TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT,
			RECHG_THRESHOLD_SRC_BIT);
			TERM_SRC_FG | RECHG_THRESHOLD_SRC_BIT);
	else
		rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1,
			TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, 0);