Lines Matching full:pe

24 	struct policy_engine *pe = data->pe;  in pe_snk_init()  local
30 usbc_timer_init(&pe->pd_t_typec_sink_wait_cap, PD_T_TYPEC_SINK_WAIT_CAP_MAX_MS); in pe_snk_init()
31 usbc_timer_init(&pe->pd_t_ps_transition, PD_T_SPR_PS_TRANSITION_NOM_MS); in pe_snk_init()
32 usbc_timer_init(&pe->pd_t_wait_to_resend, PD_T_SINK_REQUEST_MIN_MS); in pe_snk_init()
44 struct policy_engine *pe = data->pe; in sink_dpm_requests() local
56 if (pe->dpm_request > REQUEST_TC_END) { in sink_dpm_requests()
57 atomic_set_bit(pe->flags, PE_FLAGS_DPM_INITIATED_AMS); in sink_dpm_requests()
59 if (pe->dpm_request == REQUEST_PE_GET_SRC_CAPS) { in sink_dpm_requests()
70 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_startup_entry() local
71 const struct device *dev = pe->dev; in pe_snk_startup_entry()
79 pe->power_role = TC_ROLE_SINK; in pe_snk_startup_entry()
82 atomic_clear_bit(pe->flags, PE_FLAGS_EXPLICIT_CONTRACT); in pe_snk_startup_entry()
92 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_startup_run() local
93 const struct device *dev = pe->dev; in pe_snk_startup_run()
117 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_discovery_run() local
118 const struct device *dev = pe->dev; in pe_snk_discovery_run()
136 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_wait_for_capabilities_entry() local
141 usbc_timer_start(&pe->pd_t_typec_sink_wait_cap); in pe_snk_wait_for_capabilities_entry()
149 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_wait_for_capabilities_run() local
150 const struct device *dev = pe->dev; in pe_snk_wait_for_capabilities_run()
159 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) { in pe_snk_wait_for_capabilities_run()
168 if (usbc_timer_expired(&pe->pd_t_typec_sink_wait_cap)) { in pe_snk_wait_for_capabilities_run()
169 atomic_set_bit(pe->flags, PE_FLAGS_SNK_WAIT_CAP_TIMEOUT); in pe_snk_wait_for_capabilities_run()
179 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_wait_for_capabilities_exit() local
182 usbc_timer_stop(&pe->pd_t_typec_sink_wait_cap); in pe_snk_wait_for_capabilities_exit()
190 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_evaluate_capability_entry() local
191 const struct device *dev = pe->dev; in pe_snk_evaluate_capability_entry()
206 pe->hard_reset_counter = 0; in pe_snk_evaluate_capability_entry()
223 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_select_capability_entry() local
224 const struct device *dev = pe->dev; in pe_snk_select_capability_entry()
244 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_select_capability_run() local
245 const struct device *dev = pe->dev; in pe_snk_select_capability_run()
250 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_DISCARDED)) { in pe_snk_select_capability_run()
265 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) { in pe_snk_select_capability_run()
288 atomic_set_bit(pe->flags, PE_FLAGS_EXPLICIT_CONTRACT); in pe_snk_select_capability_run()
296 if (atomic_test_bit(pe->flags, PE_FLAGS_EXPLICIT_CONTRACT)) { in pe_snk_select_capability_run()
303 atomic_set_bit(pe->flags, in pe_snk_select_capability_run()
305 usbc_timer_start(&pe->pd_t_wait_to_resend); in pe_snk_select_capability_run()
329 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_transition_sink_entry() local
334 usbc_timer_start(&pe->pd_t_ps_transition); in pe_snk_transition_sink_entry()
342 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_transition_sink_run() local
343 const struct device *dev = pe->dev; in pe_snk_transition_sink_run()
355 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) { in pe_snk_transition_sink_run()
378 if (usbc_timer_expired(&pe->pd_t_ps_transition)) { in pe_snk_transition_sink_run()
388 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_transition_sink_exit() local
391 usbc_timer_stop(&pe->pd_t_ps_transition); in pe_snk_transition_sink_exit()
399 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_ready_entry() local
404 atomic_clear_bit(pe->flags, PE_FLAGS_INTERRUPTIBLE_AMS); in pe_snk_ready_entry()
405 atomic_clear_bit(pe->flags, PE_FLAGS_DPM_INITIATED_AMS); in pe_snk_ready_entry()
413 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_ready_run() local
414 const struct device *dev = pe->dev; in pe_snk_ready_run()
422 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) { in pe_snk_ready_run()
491 if (usbc_timer_expired(&pe->pd_t_wait_to_resend)) { in pe_snk_ready_run()
492 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_WAIT_SINK_REQUEST)) { in pe_snk_ready_run()
495 } else if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_WAIT_DATA_ROLE_SWAP)) { in pe_snk_ready_run()
509 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_ready_exit() local
510 const struct device *dev = pe->dev; in pe_snk_ready_exit()
526 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_hard_reset_entry() local
527 const struct device *dev = pe->dev; in pe_snk_hard_reset_entry()
537 if (atomic_test_bit(pe->flags, PE_FLAGS_SNK_WAIT_CAP_TIMEOUT) && in pe_snk_hard_reset_entry()
538 pe->hard_reset_counter > PD_N_HARD_RESET_COUNT) { in pe_snk_hard_reset_entry()
548 atomic_set_bit(pe->flags, PE_FLAGS_HARD_RESET_PENDING); in pe_snk_hard_reset_entry()
550 atomic_clear_bit(pe->flags, PE_FLAGS_SNK_WAIT_CAP_TIMEOUT); in pe_snk_hard_reset_entry()
555 pe->hard_reset_counter++; in pe_snk_hard_reset_entry()
563 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_hard_reset_run() local
564 const struct device *dev = pe->dev; in pe_snk_hard_reset_run()
570 if (atomic_test_bit(pe->flags, PE_FLAGS_HARD_RESET_PENDING)) { in pe_snk_hard_reset_run()
582 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_transition_to_default_entry() local
583 const struct device *dev = pe->dev; in pe_snk_transition_to_default_entry()
588 atomic_clear(pe->flags); in pe_snk_transition_to_default_entry()
589 pe->data_role = TC_ROLE_UFP; in pe_snk_transition_to_default_entry()
608 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_transition_to_default_run() local
609 const struct device *dev = pe->dev; in pe_snk_transition_to_default_run()
628 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_get_source_cap_entry() local
629 const struct device *dev = pe->dev; in pe_snk_get_source_cap_entry()
648 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_get_source_cap_run() local
649 const struct device *dev = pe->dev; in pe_snk_get_source_cap_run()
655 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) { in pe_snk_get_source_cap_run()
675 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_give_sink_cap_entry() local
676 const struct device *dev = pe->dev; in pe_snk_give_sink_cap_entry()
696 struct policy_engine *pe = (struct policy_engine *)obj; in pe_snk_give_sink_cap_run() local
697 const struct device *dev = pe->dev; in pe_snk_give_sink_cap_run()
702 if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_TX_COMPLETE)) { in pe_snk_give_sink_cap_run()
704 } else if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_DISCARDED)) { in pe_snk_give_sink_cap_run()