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

Commit ed97270b authored by Jack Pham's avatar Jack Pham
Browse files

usb: pd: Set PD_IN_HARD_RESET as soon as hard reset received



Move setting of PD_IN_HARD_RESET to the phy_sig_received()
callback in order to inform the charger to ignore the upcoming
VBUS toggle as soon as possible. This will help decrease the
possibility of racing to set the appropriate HW bits while
VBUS turns off and leads to the charger indicating disconnect.

Change-Id: I42cc2969defa48c9987fa4bea64780866861d868
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 95d46e9e
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -596,6 +596,8 @@ static void kick_sm(struct usbpd *pd, int ms)

static void phy_sig_received(struct usbpd *pd, enum pd_sig_type type)
{
	union power_supply_propval val = {1};

	if (type != HARD_RESET_SIG) {
		usbpd_err(&pd->dev, "invalid signal (%d) received\n", type);
		return;
@@ -606,6 +608,9 @@ static void phy_sig_received(struct usbpd *pd, enum pd_sig_type type)
	/* Force CC logic to source/sink to keep Rp/Rd unchanged */
	set_power_role(pd, pd->current_pr);
	pd->hard_reset_recvd = true;
	power_supply_set_property(pd->usb_psy,
			POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val);

	kick_sm(pd, 0);
}

@@ -1629,10 +1634,6 @@ static void usbpd_sm(struct work_struct *w)
	if (pd->hard_reset_recvd) {
		pd->hard_reset_recvd = false;

		val.intval = 1;
		power_supply_set_property(pd->usb_psy,
				POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val);

		if (pd->requested_current) {
			val.intval = pd->requested_current = 0;
			power_supply_set_property(pd->usb_psy,