|
@@ -43,6 +43,7 @@ enum policy_engine_state {
|
43
|
43
|
PESinkSendSoftReset,
|
44
|
44
|
PESinkSendNotSupported,
|
45
|
45
|
PESinkChunkReceived,
|
|
46
|
+ PESinkNotSupportedReceived,
|
46
|
47
|
PESinkSourceUnresponsive
|
47
|
48
|
};
|
48
|
49
|
|
|
@@ -414,6 +415,13 @@ static enum policy_engine_state pe_sink_ready(struct pdb_config *cfg)
|
414
|
415
|
chPoolFree(&pdb_msg_pool, cfg->pe._message);
|
415
|
416
|
cfg->pe._message = NULL;
|
416
|
417
|
return PESinkChunkReceived;
|
|
418
|
+ /* Tell the DPM a message we sent got a response of
|
|
419
|
+ * Not_Supported. */
|
|
420
|
+ } else if (PD_MSGTYPE_GET(cfg->pe._message) == PD_MSGTYPE_NOT_SUPPORTED
|
|
421
|
+ && PD_NUMOBJ_GET(cfg->pe._message) == 0) {
|
|
422
|
+ chPoolFree(&pdb_msg_pool, cfg->pe._message);
|
|
423
|
+ cfg->pe._message = NULL;
|
|
424
|
+ return PESinkNotSupportedReceived;
|
417
|
425
|
/* If we got an unknown message, send a soft reset */
|
418
|
426
|
} else {
|
419
|
427
|
chPoolFree(&pdb_msg_pool, cfg->pe._message);
|
|
@@ -666,6 +674,17 @@ static enum policy_engine_state pe_sink_chunk_received(struct pdb_config *cfg)
|
666
|
674
|
return PESinkSendNotSupported;
|
667
|
675
|
}
|
668
|
676
|
|
|
677
|
+static enum policy_engine_state pe_sink_not_supported_received(struct pdb_config *cfg)
|
|
678
|
+{
|
|
679
|
+ /* Inform the Device Policy Manager that we received a Not_Supported
|
|
680
|
+ * message. */
|
|
681
|
+ if (cfg->dpm.not_supported_received != NULL) {
|
|
682
|
+ cfg->dpm.not_supported_received(cfg);
|
|
683
|
+ }
|
|
684
|
+
|
|
685
|
+ return PESinkReady;
|
|
686
|
+}
|
|
687
|
+
|
669
|
688
|
/*
|
670
|
689
|
* When Power Delivery is unresponsive, fall back to Type-C Current
|
671
|
690
|
*/
|
|
@@ -756,6 +775,9 @@ static THD_FUNCTION(PolicyEngine, vcfg) {
|
756
|
775
|
case PESinkSourceUnresponsive:
|
757
|
776
|
state = pe_sink_source_unresponsive(cfg);
|
758
|
777
|
break;
|
|
778
|
+ case PESinkNotSupportedReceived:
|
|
779
|
+ state = pe_sink_not_supported_received(cfg);
|
|
780
|
+ break;
|
759
|
781
|
default:
|
760
|
782
|
/* This is an error. It really shouldn't happen. We might
|
761
|
783
|
* want to handle it anyway, though. */
|