summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Pham <jackp@codeaurora.org>2016-08-10 11:14:08 -0700
committerJack Pham <jackp@codeaurora.org>2016-08-10 11:21:22 -0700
commit9a2bd8b7b87e96c6346e683ea3079604addf2932 (patch)
treea6ac7dd7a8faf8639e216cff6373baf4d2966249
parentcf9e05be9aba20837be2a7cf1bf0e72e86699318 (diff)
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: Jack Pham <jackp@codeaurora.org>
-rw-r--r--drivers/usb/pd/policy_engine.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c
index f29c275c490b..7bc6b5340dd7 100644
--- a/drivers/usb/pd/policy_engine.c
+++ b/drivers/usb/pd/policy_engine.c
@@ -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,