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

Commit 59384b11 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Vamshi Krishna B V
Browse files

power: qpnp-smbcharger: reduce USB ICL to 500mA while shutting down



In the shutdown path the driver resets PMI's USB ICL to HVDCP limits while
disabling parallel charger and right after that the driver reruns AICL
by momentarily disabling it. Some HVDCP chargers collapse during this
time because the PMI attempts to draw the HVDCP limit current (default
2.7A).

To avoid this situation, reduce ICL to 500mA. The system is going to
shutdown and even though this register is dVdd backed, the CSIR
initialization will reset the ICL back to a higher value.

CRs-Fixed: 991066
Change-Id: I690b604435b03779cef40314bba262d4c684a7c0
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: default avatarVamshi Krishna B V <vbv@codeaurora.org>
parent 8f85c53c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -352,6 +352,7 @@ enum wake_reason {
#define WEAK_CHARGER_ICL_VOTER	"WEAK_CHARGER_ICL_VOTER"
#define SW_AICL_ICL_VOTER	"SW_AICL_ICL_VOTER"
#define CHG_SUSPEND_WORKAROUND_ICL_VOTER "CHG_SUSPEND_WORKAROUND_ICL_VOTER"
#define SHUTDOWN_WORKAROUND_ICL_VOTER "SHUTDOWN_WORKAROUND_ICL_VOTER"

/* USB SUSPEND VOTERS */
/* userspace has suspended charging altogether */
@@ -8413,6 +8414,12 @@ static void smbchg_shutdown(struct platform_device *pdev)
	if (!is_hvdcp_present(chip))
		return;

	pr_smb(PR_MISC, "Reducing to 500mA\n");
	rc = vote(chip->usb_icl_votable, SHUTDOWN_WORKAROUND_ICL_VOTER, true,
			500);
	if (rc < 0)
		pr_err("Couldn't vote 500mA ICL\n");

	pr_smb(PR_MISC, "Disable Parallel\n");
	mutex_lock(&chip->parallel.lock);
	smbchg_parallel_en = 0;