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

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

Merge "power: qpnp-smb5: Update legacy cable detection logic in bootup"

parents b8e32185 d8359aa1
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -2149,16 +2149,13 @@ static int smb5_configure_typec(struct smb_charger *chg)
	}

	/*
	 * Across reboot, standard typeC cables get detected as legacy cables
	 * due to VBUS attachment prior to CC attach/dettach. To handle this,
	 * "early_usb_attach" flag is used, which assumes that across reboot,
	 * the cable connected can be standard typeC. However, its jurisdiction
	 * is limited to PD capable designs only. Hence, for non-PD type designs
	 * reset legacy cable detection by disabling/enabling typeC mode.
	 * Across reboot, standard typeC cables get detected as legacy
	 * cables due to VBUS attachment prior to CC attach/detach. Reset
	 * the legacy detection logic by enabling/disabling the typeC mode.
	 */
	if (chg->pd_not_supported && (val & TYPEC_LEGACY_CABLE_STATUS_BIT)) {
	if (val & TYPEC_LEGACY_CABLE_STATUS_BIT) {
		pval.intval = POWER_SUPPLY_TYPEC_PR_NONE;
		smblib_set_prop_typec_power_role(chg, &pval);
		rc = smblib_set_prop_typec_power_role(chg, &pval);
		if (rc < 0) {
			dev_err(chg->dev, "Couldn't disable TYPEC rc=%d\n", rc);
			return rc;
@@ -2168,7 +2165,7 @@ static int smb5_configure_typec(struct smb_charger *chg)
		msleep(50);

		pval.intval = POWER_SUPPLY_TYPEC_PR_DUAL;
		smblib_set_prop_typec_power_role(chg, &pval);
		rc = smblib_set_prop_typec_power_role(chg, &pval);
		if (rc < 0) {
			dev_err(chg->dev, "Couldn't enable TYPEC rc=%d\n", rc);
			return rc;
+6 −1
Original line number Diff line number Diff line
@@ -4447,7 +4447,12 @@ int smblib_set_prop_typec_power_role(struct smb_charger *chg,
	smblib_dbg(chg, PR_MISC, "power role change: %d --> %d!",
			chg->power_role, val->intval);

	if (chg->power_role == val->intval) {
	/*
	 * Force the power-role if the initial value is NONE, for the
	 * legacy cable detection WA.
	 */
	if (chg->power_role == val->intval &&
			chg->power_role != POWER_SUPPLY_TYPEC_PR_NONE) {
		smblib_dbg(chg, PR_MISC, "power role already in %d, ignore!",
				chg->power_role);
		return 0;