|
@@ -277,11 +277,12 @@ static enum policy_engine_state pe_sink_ready(void)
|
277
|
277
|
/* Wait for an event */
|
278
|
278
|
if (min_power) {
|
279
|
279
|
evt = chEvtWaitAnyTimeout(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET
|
280
|
|
- | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_GET_SOURCE_CAP,
|
281
|
|
- PD_T_SINK_REQUEST);
|
|
280
|
+ | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_GET_SOURCE_CAP
|
|
281
|
+ | PDB_EVT_PE_NEW_POWER, PD_T_SINK_REQUEST);
|
282
|
282
|
} else {
|
283
|
283
|
evt = chEvtWaitAny(PDB_EVT_PE_MSG_RX | PDB_EVT_PE_RESET
|
284
|
|
- | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_GET_SOURCE_CAP);
|
|
284
|
+ | PDB_EVT_PE_I_OVRTEMP | PDB_EVT_PE_GET_SOURCE_CAP
|
|
285
|
+ | PDB_EVT_PE_NEW_POWER);
|
285
|
286
|
}
|
286
|
287
|
|
287
|
288
|
/* If we got reset signaling, transition to default */
|
|
@@ -299,6 +300,19 @@ static enum policy_engine_state pe_sink_ready(void)
|
299
|
300
|
return PESinkGetSourceCap;
|
300
|
301
|
}
|
301
|
302
|
|
|
303
|
+ /* If the DPM wants new power, let it figure out what power it wants
|
|
304
|
+ * exactly. This isn't exactly the transition from the spec (that would be
|
|
305
|
+ * SelectCap, not EvalCap), but this works better with the particular
|
|
306
|
+ * design of this firmware. */
|
|
307
|
+ if (evt & PDB_EVT_PE_NEW_POWER) {
|
|
308
|
+ /* Make sure we're evaluating NULL capabilities to use the old ones */
|
|
309
|
+ if (policy_engine_message != NULL) {
|
|
310
|
+ chPoolFree(&pdb_msg_pool, policy_engine_message);
|
|
311
|
+ policy_engine_message = NULL;
|
|
312
|
+ }
|
|
313
|
+ return PESinkEvalCap;
|
|
314
|
+ }
|
|
315
|
+
|
302
|
316
|
/* If no event was received, the timer ran out. */
|
303
|
317
|
if (evt == 0) {
|
304
|
318
|
/* Repeat our Request message */
|