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

Commit f8cc14ff authored by Umang Agrawal's avatar Umang Agrawal
Browse files

power: smb1355: Fix SMB1355 disable logic



For disabling SMB1355, we switch SMB1355 to command control mode.
However, by default, command control bit is set to enable SMB1355,
resulting in enablement of SMB1355. Fix this by initializing command
control bit to disable SMB1355.

Change-Id: I290cb980d58ddc0118c24c46433c20a13cad0dab
Signed-off-by: default avatarUmang Agrawal <uagrawal@codeaurora.org>
parent 0c098091
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@
#define BATT_GT_PRE_TO_FAST_BIT			BIT(4)
#define ENABLE_CHARGING_BIT			BIT(3)

#define CHGR_CHARGING_ENABLE_CMD_REG		(CHGR_BASE + 0x42)
#define CHARGING_ENABLE_CMD_BIT			BIT(0)

#define CHGR_CFG2_REG				(CHGR_BASE + 0x51)
#define CHG_EN_SRC_BIT				BIT(7)
#define CHG_EN_POLARITY_BIT			BIT(6)
@@ -1039,7 +1042,17 @@ static int smb1355_init_hw(struct smb1355 *chip)
		return rc;
	}

	/* disable parallel charging path */
	/*
	 * Disable command based SMB1355 enablement and disable parallel
	 * charging path by switching to command based mode.
	 */
	rc = smb1355_masked_write(chip, CHGR_CHARGING_ENABLE_CMD_REG,
				CHARGING_ENABLE_CMD_BIT, 0);
	if (rc < 0) {
		pr_err("Coudln't configure command bit, rc=%d\n", rc);
		return rc;
	}

	rc = smb1355_set_parallel_charging(chip, true);
	if (rc < 0) {
		pr_err("Couldn't disable parallel path rc=%d\n", rc);