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

Commit b153d2c7 authored by Anirudh Ghayal's avatar Anirudh Ghayal
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>
parent fb8a39c1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4687,6 +4687,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);
	if (!chip->skip_usb_notification) {
		pr_smb(PR_MISC, "setting usb psy present = %d\n",
@@ -5515,6 +5517,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;
}

@@ -5534,6 +5540,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;