|
@@ -623,16 +623,15 @@ static enum policy_engine_state pe_sink_send_reject(struct pdb_config *cfg)
|
623
|
623
|
*/
|
624
|
624
|
static enum policy_engine_state pe_sink_source_unresponsive(struct pdb_config *cfg)
|
625
|
625
|
{
|
626
|
|
- static int old_tcc_match = -1;
|
627
|
626
|
int tcc_match = cfg->dpm.evaluate_typec_current(cfg, fusb_get_typec_current());
|
628
|
627
|
|
629
|
628
|
/* If the last two readings are the same, set the output */
|
630
|
|
- if (old_tcc_match == tcc_match) {
|
|
629
|
+ if (cfg->pe._old_tcc_match == tcc_match) {
|
631
|
630
|
cfg->dpm.transition_typec(cfg);
|
632
|
631
|
}
|
633
|
632
|
|
634
|
633
|
/* Remember whether or not the last measurement succeeded */
|
635
|
|
- old_tcc_match = tcc_match;
|
|
634
|
+ cfg->pe._old_tcc_match = tcc_match;
|
636
|
635
|
|
637
|
636
|
/* Wait tPDDebounce between measurements */
|
638
|
637
|
chThdSleep(PD_T_PD_DEBOUNCE);
|
|
@@ -649,6 +648,8 @@ static THD_FUNCTION(PolicyEngine, vcfg) {
|
649
|
648
|
|
650
|
649
|
/* Initialize the mailbox */
|
651
|
650
|
chMBObjectInit(&cfg->pe.mailbox, cfg->pe._mailbox_queue, PDB_MSG_POOL_SIZE);
|
|
651
|
+ /* Initialize the old_tcc_match */
|
|
652
|
+ cfg->pe._old_tcc_match = -1;
|
652
|
653
|
|
653
|
654
|
while (true) {
|
654
|
655
|
switch (state) {
|