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

Commit 034277ed authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

power: smb1351: set correct usb mode polarity when in parallel mode



Currently, the smb1351 driver does not set the same USB100/USB500 mode
polarity when ran in parallel mode. This can cause current limits of
500/900mA to be switched with 100/150mA.

Fix this by setting the same bits the smb1351 does in its normal hw_init
routine.

CRs-Fixed: 877809
Change-Id: I44ae3086fd86e46b15a2c16368fcd5aade771319
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent 155c846a
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -1352,7 +1352,7 @@ static int smb1351_parallel_set_chg_present(struct smb1351_charger *chip,
						int present)
{
	int rc;
	u8 reg;
	u8 reg, mask = 0;

	/* Check if SMB1351 is present */
	rc = smb1351_read_reg(chip, CHG_REVISION_REG, &reg);
@@ -1419,6 +1419,20 @@ static int smb1351_parallel_set_chg_present(struct smb1351_charger *chip,
			return rc;
		}

		/*
		 * setup USB 2.0/3.0 detection and USB 500/100
		 * command polarity
		 */
		reg = USB_2_3_MODE_SEL_BY_I2C | USB_CMD_POLARITY_500_1_100_0;
		mask = USB_2_3_MODE_SEL_BIT | USB_5_1_CMD_POLARITY_BIT;
		rc = smb1351_masked_write(chip,
				CHG_OTH_CURRENT_CTRL_REG, mask, reg);
		if (rc) {
			pr_err("Couldn't set CHG_OTH_CURRENT_CTRL_REG rc=%d\n",
					rc);
			return rc;
		}

		/* set fast charging current limit */
		chip->fastchg_current_max_ma = SMB1351_CHG_FAST_MIN_MA;
		rc = smb1351_fastchg_current_set(chip,