Lines Matching refs:dev
21 void pe_snk_init(const struct device *dev) in pe_snk_init() argument
23 struct usbc_port_data *data = dev->data; in pe_snk_init()
27 pe_set_data_role(dev, TC_ROLE_UFP); in pe_snk_init()
35 pe_set_state(dev, PE_SNK_STARTUP); in pe_snk_init()
41 void sink_dpm_requests(const struct device *dev) in sink_dpm_requests() argument
43 struct usbc_port_data *data = dev->data; in sink_dpm_requests()
49 if (common_dpm_requests(dev)) { in sink_dpm_requests()
60 pe_set_state(dev, PE_SNK_GET_SOURCE_CAP); in sink_dpm_requests()
71 const struct device *dev = pe->dev; in pe_snk_startup_entry() local
76 prl_reset(dev); in pe_snk_startup_entry()
84 policy_notify(dev, NOT_PD_CONNECTED); in pe_snk_startup_entry()
93 const struct device *dev = pe->dev; in pe_snk_startup_run() local
99 if (prl_is_running(dev)) { in pe_snk_startup_run()
100 pe_set_state(dev, PE_SNK_DISCOVERY); in pe_snk_startup_run()
118 const struct device *dev = pe->dev; in pe_snk_discovery_run() local
119 struct usbc_port_data *data = dev->data; in pe_snk_discovery_run()
127 pe_set_state(dev, PE_SNK_WAIT_FOR_CAPABILITIES); in pe_snk_discovery_run()
150 const struct device *dev = pe->dev; in pe_snk_wait_for_capabilities_run() local
151 struct usbc_port_data *data = dev->data; in pe_snk_wait_for_capabilities_run()
161 if (received_data_message(dev, header, PD_DATA_SOURCE_CAP)) { in pe_snk_wait_for_capabilities_run()
162 pe_set_state(dev, PE_SNK_EVALUATE_CAPABILITY); in pe_snk_wait_for_capabilities_run()
170 pe_set_state(dev, PE_SNK_HARD_RESET); in pe_snk_wait_for_capabilities_run()
191 const struct device *dev = pe->dev; in pe_snk_evaluate_capability_entry() local
192 struct usbc_port_data *data = dev->data; in pe_snk_evaluate_capability_entry()
201 policy_notify(dev, SOURCE_CAPABILITIES_RECEIVED); in pe_snk_evaluate_capability_entry()
209 prl_set_rev(dev, PD_PACKET_SOP, MIN(PD_REV30, header.specification_revision)); in pe_snk_evaluate_capability_entry()
212 policy_set_src_cap(dev, pdos, num_pdo_objs); in pe_snk_evaluate_capability_entry()
215 pe_set_state(dev, PE_SNK_SELECT_CAPABILITY); in pe_snk_evaluate_capability_entry()
224 const struct device *dev = pe->dev; in pe_snk_select_capability_entry() local
230 rdo = policy_get_request_data_object(dev); in pe_snk_select_capability_entry()
233 pe_send_request_msg(dev, rdo); in pe_snk_select_capability_entry()
235 policy_notify(dev, PD_CONNECTED); in pe_snk_select_capability_entry()
245 const struct device *dev = pe->dev; in pe_snk_select_capability_run() local
246 struct usbc_port_data *data = dev->data; in pe_snk_select_capability_run()
258 if (pe_get_last_state(dev) == PE_SNK_EVALUATE_CAPABILITY) { in pe_snk_select_capability_run()
259 pe_send_soft_reset(dev, PD_PACKET_SOP); in pe_snk_select_capability_run()
261 pe_set_state(dev, PE_SNK_READY); in pe_snk_select_capability_run()
286 if (received_control_message(dev, header, PD_CTRL_ACCEPT)) { in pe_snk_select_capability_run()
289 pe_set_state(dev, PE_SNK_TRANSITION_SINK); in pe_snk_select_capability_run()
290 } else if (received_control_message(dev, header, PD_CTRL_REJECT) || in pe_snk_select_capability_run()
291 received_control_message(dev, header, PD_CTRL_WAIT)) { in pe_snk_select_capability_run()
297 if (received_control_message(dev, header, PD_CTRL_WAIT)) { in pe_snk_select_capability_run()
302 if (policy_wait_notify(dev, WAIT_SINK_REQUEST)) { in pe_snk_select_capability_run()
309 pe_set_state(dev, PE_SNK_READY); in pe_snk_select_capability_run()
315 pe_set_state(dev, PE_SNK_WAIT_FOR_CAPABILITIES); in pe_snk_select_capability_run()
318 pe_send_soft_reset(dev, prl_rx->emsg.type); in pe_snk_select_capability_run()
343 const struct device *dev = pe->dev; in pe_snk_transition_sink_run() local
344 struct usbc_port_data *data = dev->data; in pe_snk_transition_sink_run()
361 if (received_control_message(dev, header, PD_CTRL_PS_RDY)) { in pe_snk_transition_sink_run()
366 policy_notify(dev, TRANSITION_PS); in pe_snk_transition_sink_run()
367 pe_set_state(dev, PE_SNK_READY); in pe_snk_transition_sink_run()
370 pe_set_state(dev, PE_SNK_HARD_RESET); in pe_snk_transition_sink_run()
379 pe_set_state(dev, PE_SNK_HARD_RESET); in pe_snk_transition_sink_run()
414 const struct device *dev = pe->dev; in pe_snk_ready_run() local
415 struct usbc_port_data *data = dev->data; in pe_snk_ready_run()
427 extended_message_not_supported(dev); in pe_snk_ready_run()
433 pe_set_state(dev, PE_SNK_EVALUATE_CAPABILITY); in pe_snk_ready_run()
440 if (prl_get_rev(dev, PD_PACKET_SOP) > PD_REV20) { in pe_snk_ready_run()
441 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_snk_ready_run()
445 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_snk_ready_run()
458 pe_set_state(dev, PE_SNK_GIVE_SINK_CAP); in pe_snk_ready_run()
461 pe_set_state(dev, PE_DRS_EVALUATE_SWAP); in pe_snk_ready_run()
475 pe_send_soft_reset(dev, prl_rx->emsg.type); in pe_snk_ready_run()
482 pe_set_state(dev, PE_SEND_NOT_SUPPORTED); in pe_snk_ready_run()
493 pe_set_state(dev, PE_SNK_SELECT_CAPABILITY); in pe_snk_ready_run()
496 pe_set_state(dev, PE_DRS_SEND_SWAP); in pe_snk_ready_run()
504 sink_dpm_requests(dev); in pe_snk_ready_run()
510 const struct device *dev = pe->dev; in pe_snk_ready_exit() local
516 if (pe_dpm_initiated_ams(dev)) { in pe_snk_ready_exit()
517 prl_first_msg_notificaiton(dev); in pe_snk_ready_exit()
527 const struct device *dev = pe->dev; in pe_snk_hard_reset_entry() local
528 struct usbc_port_data *data = dev->data; in pe_snk_hard_reset_entry()
540 policy_notify(dev, PORT_PARTNER_NOT_RESPONSIVE); in pe_snk_hard_reset_entry()
553 prl_execute_hard_reset(dev); in pe_snk_hard_reset_entry()
564 const struct device *dev = pe->dev; in pe_snk_hard_reset_run() local
574 pe_set_state(dev, PE_SNK_TRANSITION_TO_DEFAULT); in pe_snk_hard_reset_run()
583 const struct device *dev = pe->dev; in pe_snk_transition_to_default_entry() local
595 policy_notify(dev, SNK_TRANSITION_TO_DEFAULT); in pe_snk_transition_to_default_entry()
600 policy_notify(dev, DATA_ROLE_IS_UFP); in pe_snk_transition_to_default_entry()
609 const struct device *dev = pe->dev; in pe_snk_transition_to_default_run() local
615 if (policy_is_snk_at_default(dev)) { in pe_snk_transition_to_default_run()
617 prl_hard_reset_complete(dev); in pe_snk_transition_to_default_run()
618 pe_set_state(dev, PE_SNK_STARTUP); in pe_snk_transition_to_default_run()
629 const struct device *dev = pe->dev; in pe_snk_get_source_cap_entry() local
639 pe_send_ctrl_msg(dev, PD_PACKET_SOP, PD_CTRL_GET_SOURCE_CAP); in pe_snk_get_source_cap_entry()
649 const struct device *dev = pe->dev; in pe_snk_get_source_cap_run() local
650 struct usbc_port_data *data = dev->data; in pe_snk_get_source_cap_run()
664 if (received_control_message(dev, header, PD_DATA_SOURCE_CAP)) { in pe_snk_get_source_cap_run()
665 pe_set_state(dev, PE_SNK_EVALUATE_CAPABILITY); in pe_snk_get_source_cap_run()
676 const struct device *dev = pe->dev; in pe_snk_give_sink_cap_entry() local
677 struct usbc_port_data *data = dev->data; in pe_snk_give_sink_cap_entry()
684 policy_get_snk_cap(dev, &pdos, &num_pdos); in pe_snk_give_sink_cap_entry()
688 pe_send_data_msg(dev, PD_PACKET_SOP, PD_DATA_SINK_CAP); in pe_snk_give_sink_cap_entry()
697 const struct device *dev = pe->dev; in pe_snk_give_sink_cap_run() local
698 struct usbc_port_data *data = dev->data; in pe_snk_give_sink_cap_run()
703 pe_set_state(dev, PE_SNK_READY); in pe_snk_give_sink_cap_run()
705 pe_send_soft_reset(dev, prl_rx->emsg.type); in pe_snk_give_sink_cap_run()