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

Commit d20de5a2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb1351: fix parallel mode i2c errors from incorrect check"

parents 07e9a73d 046fe371
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@
			status = "okay";
			qcom,bcl-lm-threshold-ma = <127>;
			qcom,bcl-mh-threshold-ma = <405>;
			qcom,fg-iterm-ma = <100>;
			qcom,fg-iterm-ma = <125>;
			qcom,fg-chg-iterm-ma = <100>;
			qcom,cycle-counter-en;
			qcom,capacity-learning-on;
+22 −8
Original line number Diff line number Diff line
@@ -1352,14 +1352,7 @@ static int smb1351_parallel_set_chg_present(struct smb1351_charger *chip,
						int present)
{
	int rc;
	u8 reg;

	/* Check if SMB1351 is present */
	rc = smb1351_read_reg(chip, CHG_REVISION_REG, &reg);
	if (rc) {
		pr_debug("Failed to detect smb1351-parallel-charger, may be absent\n");
		return -ENODEV;
	}
	u8 reg, mask = 0;

	if (present == chip->parallel_charger_present) {
		pr_debug("present %d -> %d, skipping\n",
@@ -1368,6 +1361,13 @@ static int smb1351_parallel_set_chg_present(struct smb1351_charger *chip,
	}

	if (present) {
		/* Check if SMB1351 is present */
		rc = smb1351_read_reg(chip, CHG_REVISION_REG, &reg);
		if (rc) {
			pr_debug("Failed to detect smb1351-parallel-charger, may be absent\n");
			return -ENODEV;
		}

		rc = smb1351_enable_volatile_writes(chip);
		if (rc) {
			pr_err("Couldn't configure for volatile rc = %d\n", rc);
@@ -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,