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

Commit 46b35fdc authored by Harry Yang's avatar Harry Yang
Browse files

power: smb5: Enable AICL rerun



Enable AICL periodic rerun and set rerun time 12 seconds.

Change-Id: If2cb383bb70bfeb9b0c4ae6f6257e4ba36a6cc88
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent 01beaf22
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1447,15 +1447,24 @@ static int smb5_init_hw(struct smb5 *chip)

	/*
	 * AICL configuration:
	 * start from min and AICL ADC disable
	 * start from min and AICL ADC disable, and enable aicl rerun
	 */
	rc = smblib_masked_write(chg, USBIN_AICL_OPTIONS_CFG_REG,
				USBIN_AICL_ADC_EN_BIT, 0);
		USBIN_AICL_PERIODIC_RERUN_EN_BIT | USBIN_AICL_ADC_EN_BIT,
		USBIN_AICL_PERIODIC_RERUN_EN_BIT);
	if (rc < 0) {
		dev_err(chg->dev, "Couldn't configure AICL rc=%d\n", rc);
		return rc;
	}

	rc = smblib_write(chg, AICL_RERUN_TIME_CFG_REG,
				AICL_RERUN_TIME_12S_VAL);
	if (rc < 0) {
		dev_err(chg->dev,
			"Couldn't configure AICL rerun interval rc=%d\n", rc);
		return rc;
	}

	/* enable the charging path */
	rc = vote(chg->chg_disable_votable, DEFAULT_VOTER, false, 0);
	if (rc < 0) {
+4 −0
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ enum {
#define USBIN_CURRENT_LIMIT_CFG_REG		(USBIN_BASE + 0x70)

#define USBIN_AICL_OPTIONS_CFG_REG		(USBIN_BASE + 0x80)
#define USBIN_AICL_PERIODIC_RERUN_EN_BIT	BIT(4)
#define USBIN_AICL_ADC_EN_BIT			BIT(3)

/********************************
@@ -352,6 +353,9 @@ enum {
#define BARK_WDOG_INT_EN_BIT			BIT(6)
#define WDOG_TIMER_EN_ON_PLUGIN_BIT		BIT(1)

#define AICL_RERUN_TIME_CFG_REG			(MISC_BASE + 0x61)
#define AICL_RERUN_TIME_12S_VAL			0x01

#define MISC_SMB_CFG_REG			(MISC_BASE + 0x90)
#define SMB_EN_SEL_BIT				BIT(4)
#define CP_EN_POLARITY_CFG_BIT			BIT(3)