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

Commit 379484a3 authored by Harry Yang's avatar Harry Yang
Browse files

power: smblib: suspend USBIN when ICL <= 25mA



USBIN will be suspended when outside consumer sets a low icl. Currently,
the condition is strictly <25mA, and it should be <=25mA.

Change-Id: I915fb736646cd43309c6a5520e5fdf4a9dd51efe
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent 1d9aee75
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -889,7 +889,7 @@ int smblib_set_icl_current(struct smb_charger *chg, int icl_ua)
	bool override;
	bool override;


	/* suspend and return if 25mA or less is requested */
	/* suspend and return if 25mA or less is requested */
	if (icl_ua < USBIN_25MA)
	if (icl_ua <= USBIN_25MA)
		return smblib_set_usb_suspend(chg, true);
		return smblib_set_usb_suspend(chg, true);


	if (icl_ua == INT_MAX)
	if (icl_ua == INT_MAX)
@@ -1015,7 +1015,7 @@ static int smblib_dc_icl_vote_callback(struct votable *votable, void *data,
		icl_ua = 0;
		icl_ua = 0;
	}
	}


	suspend = (icl_ua < USBIN_25MA);
	suspend = (icl_ua <= USBIN_25MA);
	if (suspend)
	if (suspend)
		goto suspend;
		goto suspend;


@@ -4085,7 +4085,7 @@ irqreturn_t smblib_handle_switcher_power_ok(int irq, void *data)


	/* skip suspending input if its already suspended by some other voter */
	/* skip suspending input if its already suspended by some other voter */
	usb_icl = get_effective_result(chg->usb_icl_votable);
	usb_icl = get_effective_result(chg->usb_icl_votable);
	if ((stat & USE_USBIN_BIT) && usb_icl >= 0 && usb_icl < USBIN_25MA)
	if ((stat & USE_USBIN_BIT) && usb_icl >= 0 && usb_icl <= USBIN_25MA)
		return IRQ_HANDLED;
		return IRQ_HANDLED;


	if (stat & USE_DCIN_BIT)
	if (stat & USE_DCIN_BIT)