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

Commit 9a2bd8b7 authored by Jack Pham's avatar Jack Pham
Browse files

usb: pd: Only request current amount for explicit contract



The policy engine should only request for a specific current
amount when establishing an explicit contract. When performing
a hard reset, suspend this by requesting 0 and only if it
was non-zero before, otherwise requesting the maximum may
invalidate the default current for non-PD cases.

Change-Id: Icbef00d61f8705429105f241161362ad9f1f9d30
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent cf9e05be
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -849,10 +849,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
				POWER_SUPPLY_PROP_VOLTAGE_MAX, &val);
		pd->current_voltage = pd->requested_voltage;

		val.intval = pd->requested_current * 1000; /* mA->uA */
		power_supply_set_property(pd->usb_psy,
				POWER_SUPPLY_PROP_CURRENT_MAX, &val);

		/* recursive call; go back to beginning state */
		usbpd_set_state(pd, PE_SNK_STARTUP);
		break;
@@ -1615,7 +1611,12 @@ static void usbpd_sm(struct work_struct *w)
				POWER_SUPPLY_PROP_PD_ACTIVE, &val);

		pd->requested_voltage = 5000000;
		pd->requested_current = max_sink_current;

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

		val.intval = pd->requested_voltage;
		power_supply_set_property(pd->usb_psy,