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

Commit a5b3c596 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 b28b8c7e 9922278e
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -1482,14 +1482,12 @@ 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 && (value & TYPEC_LEGACY_CABLE_STATUS_BIT)) {

	if (value & TYPEC_LEGACY_CABLE_STATUS_BIT) {
		val = QTI_POWER_SUPPLY_TYPEC_PR_NONE;
		rc = smblib_set_prop_typec_power_role(chg, val);
		if (rc < 0) {
+2 −1
Original line number Diff line number Diff line
@@ -4537,7 +4537,8 @@ int smblib_set_prop_typec_power_role(struct smb_charger *chg, int val)
	smblib_dbg(chg, PR_MISC, "power role change: %d --> %d!",
			chg->power_role, val);

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