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

Commit a39aab58 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Vamshi Krishna B V
Browse files

power: qpnp-smbcharger: Handle USB removal during pulsing



Handle removal of USB during QC 3.0 pulsing operation.
While at it, cancel hvdcp detection work before updating input
status to USB driver on charger removal.

CRs-Fixed: 1011956
Change-Id: I28cf37e60746eab126e7cd6822de9b35b8f832bf
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
Signed-off-by: default avatarVamshi Krishna B V <vbv@codeaurora.org>
parent cd718a3b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4616,6 +4616,8 @@ static void handle_usb_removal(struct smbchg_chip *chip)
	/* Clear typec current status */
	if (chip->typec_psy)
		chip->typec_current_ma = 0;
	/* cancel/wait for hvdcp pending work if any */
	cancel_delayed_work_sync(&chip->hvdcp_det_work);
	smbchg_change_usb_supply_type(chip, POWER_SUPPLY_TYPE_UNKNOWN);
	extcon_set_cable_state_(chip->extcon, EXTCON_USB, chip->usb_present);
	if (chip->dpdm_reg)
@@ -5448,6 +5450,10 @@ static int smbchg_prepare_for_pulsing_lite(struct smbchg_chip *chip)
out:
	chip->hvdcp_3_det_ignore_uv = false;
	restore_from_hvdcp_detection(chip);
	if (!is_src_detect_high(chip)) {
		pr_smb(PR_MISC, "HVDCP removed - force removal\n");
		update_usb_status(chip, 0, true);
	}
	return rc;
}

@@ -5467,6 +5473,10 @@ static int smbchg_unprepare_for_pulsing_lite(struct smbchg_chip *chip)
	if (rc < 0)
		pr_err("Couldn't retract HVDCP ICL vote rc=%d\n", rc);

	if (!is_src_detect_high(chip)) {
		pr_smb(PR_MISC, "HVDCP removed\n");
		update_usb_status(chip, 0, 0);
	}
	smbchg_handle_hvdcp3_disable(chip);

	return rc;