Lines Matching refs:dev
29 void pe_src_init(const struct device *dev) in pe_src_init() argument
31 struct usbc_port_data *data = dev->data; in pe_src_init()
35 pe_set_data_role(dev, TC_ROLE_DFP); in pe_src_init()
45 pe_set_state(dev, PE_SRC_STARTUP); in pe_src_init()
51 bool source_dpm_requests(const struct device *dev) in source_dpm_requests() argument
53 struct usbc_port_data *data = dev->data; in source_dpm_requests()
58 pe_set_state(dev, PE_GET_SINK_CAP); in source_dpm_requests()
62 pe_set_state(dev, PE_SRC_TRANSITION_SUPPLY); in source_dpm_requests()
74 const struct device *dev = pe->dev; in send_src_caps() local
75 struct usbc_port_data *data = dev->data; in send_src_caps()
85 data->policy_cb_get_src_caps(dev, &pdos, &num_pdos); in send_src_caps()
89 pe_send_data_msg(dev, PD_PACKET_SOP, PD_DATA_SOURCE_CAP); in send_src_caps()
98 const struct device *dev = pe->dev; in pe_src_startup_entry() local
106 prl_reset(dev); in pe_src_startup_entry()
114 policy_notify(dev, NOT_PD_CONNECTED); in pe_src_startup_entry()
120 const struct device *dev = pe->dev; in pe_src_startup_run() local
126 if (prl_is_running(dev)) { in pe_src_startup_run()
127 pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); in pe_src_startup_run()
150 const struct device *dev = pe->dev; in pe_src_discovery_run() local
159 pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); in pe_src_discovery_run()
161 pe_set_state(dev, PE_SRC_DISABLED); in pe_src_discovery_run()
193 const struct device *dev = pe->dev; in pe_src_send_capabilities_run() local
194 struct usbc_port_data *data = dev->data; in pe_src_send_capabilities_run()
221 pe_set_state(dev, PE_SRC_DISCOVERY); in pe_src_send_capabilities_run()
232 if (received_data_message(dev, header, PD_DATA_REQUEST)) { in pe_src_send_capabilities_run()
234 prl_set_rev(dev, PD_PACKET_SOP, in pe_src_send_capabilities_run()
236 pe_set_state(dev, PE_SRC_NEGOTIATE_CAPABILITY); in pe_src_send_capabilities_run()
245 pe_set_state(dev, PE_SRC_HARD_RESET); in pe_src_send_capabilities_run()
257 const struct device *dev = pe->dev; in pe_src_negotiate_capability_entry() local
258 struct usbc_port_data *data = dev->data; in pe_src_negotiate_capability_entry()
271 policy_check_sink_request(dev, pe->snk_request); in pe_src_negotiate_capability_entry()
279 pe_set_state(dev, PE_SRC_TRANSITION_SUPPLY); in pe_src_negotiate_capability_entry()
288 pe_set_state(dev, PE_SRC_CAPABILITY_RESPONSE); in pe_src_negotiate_capability_entry()
298 const struct device *dev = pe->dev; in pe_src_transition_supply_entry() local
309 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_ACCEPT); in pe_src_transition_supply_entry()
310 policy_notify(dev, TRANSITION_PS); in pe_src_transition_supply_entry()
317 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_GOTO_MIN); in pe_src_transition_supply_entry()
324 const struct device *dev = pe->dev; in pe_src_transition_supply_run() local
332 if (policy_is_ps_ready(dev)) { in pe_src_transition_supply_run()
333 pe_set_state(dev, PE_SRC_READY); in pe_src_transition_supply_run()
342 pe_set_state(dev, PE_SRC_HARD_RESET); in pe_src_transition_supply_run()
349 const struct device *dev = pe->dev; in pe_src_transition_supply_exit() local
356 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_PS_RDY); in pe_src_transition_supply_exit()
370 const struct device *dev = pe->dev; in pe_src_ready_entry() local
385 pe_dpm_end_ams(dev); in pe_src_ready_entry()
392 const struct device *dev = pe->dev; in pe_src_ready_run() local
393 struct usbc_port_data *data = dev->data; in pe_src_ready_run()
404 extended_message_not_supported(dev); in pe_src_ready_run()
412 pe_set_state(dev, PE_SRC_NEGOTIATE_CAPABILITY); in pe_src_ready_run()
419 if (prl_get_rev(dev, PD_PACKET_SOP) > PD_REV20) { in pe_src_ready_run()
420 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_src_ready_run()
424 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_src_ready_run()
437 policy_notify(dev, MSG_NOT_SUPPORTED_RECEIVED); in pe_src_ready_run()
443 pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); in pe_src_ready_run()
446 pe_set_state(dev, PE_DRS_EVALUATE_SWAP); in pe_src_ready_run()
457 pe_send_soft_reset(dev, prl_rx->emsg.type); in pe_src_ready_run()
465 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_src_ready_run()
471 source_dpm_requests(dev); in pe_src_ready_run()
478 const struct device *dev = pe->dev; in pe_src_ready_exit() local
484 if (pe_dpm_initiated_ams(dev)) { in pe_src_ready_exit()
485 prl_first_msg_notificaiton(dev); in pe_src_ready_exit()
508 const struct device *dev = pe->dev; in pe_src_transition_to_default_entry() local
522 policy_notify(dev, HARD_RESET_RECEIVED); in pe_src_transition_to_default_entry()
524 policy_notify(dev, DATA_ROLE_IS_DFP); in pe_src_transition_to_default_entry()
530 const struct device *dev = pe->dev; in pe_src_transition_to_default_run() local
538 if (policy_check(dev, CHECK_SRC_PS_AT_DEFAULT_LEVEL)) { in pe_src_transition_to_default_run()
539 pe_set_state(dev, PE_SRC_STARTUP); in pe_src_transition_to_default_run()
546 const struct device *dev = pe->dev; in pe_src_transition_to_default_exit() local
557 prl_hard_reset_complete(dev); in pe_src_transition_to_default_exit()
566 const struct device *dev = pe->dev; in pe_src_capability_response_entry() local
578 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_REJECT); in pe_src_capability_response_entry()
586 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_WAIT); in pe_src_capability_response_entry()
593 const struct device *dev = pe->dev; in pe_src_capability_response_run() local
609 policy_present_contract_is_valid(dev, pe->present_contract)) || in pe_src_capability_response_run()
611 pe_set_state(dev, PE_SRC_READY); in pe_src_capability_response_run()
621 policy_present_contract_is_valid(dev, pe->present_contract) == false) { in pe_src_capability_response_run()
622 pe_set_state(dev, PE_SRC_HARD_RESET); in pe_src_capability_response_run()
643 if (policy_change_src_caps(dev)) { in pe_src_capability_response_run()
645 pe_set_state(dev, PE_SRC_SEND_CAPABILITIES); in pe_src_capability_response_run()
651 pe_set_state(dev, PE_SUSPEND); in pe_src_capability_response_run()
666 const struct device *dev = pe->dev; in pe_src_hard_reset_parent_run() local
689 pe_set_state(dev, PE_SRC_TRANSITION_TO_DEFAULT); in pe_src_hard_reset_parent_run()
709 const struct device *dev = pe->dev; in pe_src_hard_reset_entry() local
720 prl_execute_hard_reset(dev); in pe_src_hard_reset_entry()