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

Commit b05a0f59 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: supply: qcom: Disable suspend on collapse on USB removal"

parents 63b8a425 4dd02661
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -218,7 +218,6 @@ struct smb_dt_props {
	int			term_current_src;
	int			term_current_thresh_hi_ma;
	int			term_current_thresh_lo_ma;
	int			disable_suspend_on_collapse;
};

struct smb5 {
@@ -556,7 +555,7 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node)
	of_property_read_u32(node, "qcom,connector-internal-pull-kohm",
					&chg->connector_pull_up);

	chip->dt.disable_suspend_on_collapse = of_property_read_bool(node,
	chg->disable_suspend_on_collapse = of_property_read_bool(node,
					"qcom,disable-suspend-on-collapse");
	chg->smb_pull_up = -EINVAL;
	of_property_read_u32(node, "qcom,smb-internal-pull-kohm",
@@ -2148,7 +2147,7 @@ static int smb5_init_hw(struct smb5 *chip)
	mask = USBIN_AICL_PERIODIC_RERUN_EN_BIT | USBIN_AICL_ADC_EN_BIT
			| USBIN_AICL_EN_BIT | SUSPEND_ON_COLLAPSE_USBIN_BIT;
	val = USBIN_AICL_PERIODIC_RERUN_EN_BIT | USBIN_AICL_EN_BIT;
	if (!chip->dt.disable_suspend_on_collapse)
	if (!chg->disable_suspend_on_collapse)
		val |= SUSPEND_ON_COLLAPSE_USBIN_BIT;
	if (chip->dt.adc_based_aicl)
		val |= USBIN_AICL_ADC_EN_BIT;
+16 −10
Original line number Diff line number Diff line
@@ -1354,12 +1354,15 @@ static void smblib_uusb_removal(struct smb_charger *chg)
			smblib_err(chg, "Couldn't restore max pulses rc=%d\n",
					rc);

		if (!chg->disable_suspend_on_collapse) {
			rc = smblib_masked_write(chg, USBIN_AICL_OPTIONS_CFG_REG,
						 SUSPEND_ON_COLLAPSE_USBIN_BIT,
						 SUSPEND_ON_COLLAPSE_USBIN_BIT);
			if (rc < 0)
			smblib_err(chg, "Couldn't turn on SUSPEND_ON_COLLAPSE_USBIN_BIT rc=%d\n",
				smblib_err(chg,
					"Couldn't turn on SUSPEND_ON_COLLAPSE_USBIN_BIT rc=%d\n",
					rc);
		}

		chg->qc2_unsupported_voltage = QC2_COMPLIANT;
	}
@@ -6458,12 +6461,15 @@ static void typec_src_removal(struct smb_charger *chg)
			smblib_err(chg, "Couldn't restore max pulses rc=%d\n",
					rc);

		if (!chg->disable_suspend_on_collapse) {
			rc = smblib_masked_write(chg, USBIN_AICL_OPTIONS_CFG_REG,
						 SUSPEND_ON_COLLAPSE_USBIN_BIT,
						 SUSPEND_ON_COLLAPSE_USBIN_BIT);
			if (rc < 0)
			smblib_err(chg, "Couldn't turn on SUSPEND_ON_COLLAPSE_USBIN_BIT rc=%d\n",
				smblib_err(chg,
					"Couldn't turn on SUSPEND_ON_COLLAPSE_USBIN_BIT rc=%d\n",
					rc);
		}

		chg->qc2_unsupported_voltage = QC2_COMPLIANT;
	}
+1 −0
Original line number Diff line number Diff line
@@ -594,6 +594,7 @@ struct smb_charger {
	bool			apsd_ext_timeout;
	bool			qc3p5_detected;
	int			qc3p5_detected_mw;
	bool			disable_suspend_on_collapse;

	/* workaround flag */
	int		real_charger_type;