Lines Matching full:role

30 static int cdns3_role_start(struct cdns3 *cdns, enum usb_role role)  in cdns3_role_start()  argument
34 if (WARN_ON(role > USB_ROLE_DEVICE)) in cdns3_role_start()
38 cdns->role = role; in cdns3_role_start()
41 if (!cdns->roles[role]) in cdns3_role_start()
44 if (cdns->roles[role]->state == CDNS3_ROLE_STATE_ACTIVE) in cdns3_role_start()
48 ret = cdns->roles[role]->start(cdns); in cdns3_role_start()
50 cdns->roles[role]->state = CDNS3_ROLE_STATE_ACTIVE; in cdns3_role_start()
58 enum usb_role role = cdns->role; in cdns3_role_stop() local
60 if (WARN_ON(role > USB_ROLE_DEVICE)) in cdns3_role_stop()
63 if (cdns->roles[role]->state == CDNS3_ROLE_STATE_INACTIVE) in cdns3_role_stop()
67 cdns->roles[role]->stop(cdns); in cdns3_role_stop()
68 cdns->roles[role]->state = CDNS3_ROLE_STATE_INACTIVE; in cdns3_role_stop()
79 * cdns3_core_init_role - initialize role of operation
92 cdns->role = USB_ROLE_NONE; in cdns3_core_init_role()
154 /* Initialize idle role to start with */ in cdns3_core_init_role()
187 * cdns3_hw_role_state_machine - role switch state machine based on hw events.
190 * Returns next role to be entered based on hw events.
194 enum usb_role role = USB_ROLE_NONE; in cdns3_hw_role_state_machine() local
199 role = USB_ROLE_HOST; in cdns3_hw_role_state_machine()
201 role = USB_ROLE_DEVICE; in cdns3_hw_role_state_machine()
203 return role; in cdns3_hw_role_state_machine()
210 * Role change state machine in cdns3_hw_role_state_machine()
212 * Previous state: cdns->role in cdns3_hw_role_state_machine()
213 * Next state: role in cdns3_hw_role_state_machine()
215 role = cdns->role; in cdns3_hw_role_state_machine()
217 switch (role) { in cdns3_hw_role_state_machine()
224 role = USB_ROLE_HOST; in cdns3_hw_role_state_machine()
226 role = USB_ROLE_DEVICE; in cdns3_hw_role_state_machine()
230 role = USB_ROLE_NONE; in cdns3_hw_role_state_machine()
234 role = USB_ROLE_NONE; in cdns3_hw_role_state_machine()
238 dev_dbg(cdns->dev, "role %d -> %d\n", cdns->role, role); in cdns3_hw_role_state_machine()
240 return role; in cdns3_hw_role_state_machine()
283 /* Depends on role switch class */ in cdns3_hw_role_switch()
289 current_role = cdns->role; in cdns3_hw_role_switch()
298 dev_dbg(cdns->dev, "Switching role %d -> %d", current_role, real_role); in cdns3_hw_role_switch()
302 /* Back to current role */ in cdns3_hw_role_switch()
316 * cdsn3_role_get - get current role of controller.
318 * @sw: pointer to USB role switch structure
320 * Returns role
326 return cdns->role; in cdns3_role_get()
330 * cdns3_role_set - set current role of controller.
332 * @sw: pointer to USB role switch structure
333 * @role: the previous role
335 * - Role switch for dual-role devices
338 static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role) in cdns3_role_set() argument
345 if (cdns->role == role) in cdns3_role_set()
349 switch (role) { in cdns3_role_set()
359 switch (role) { in cdns3_role_set()
369 ret = cdns3_role_start(cdns, role); in cdns3_role_set()
371 dev_err(cdns->dev, "set role %d has failed\n", role); in cdns3_role_set()
413 if ((cdns->role == USB_ROLE_HOST) && cdns->host_dev) in cdns3_wakeup_irq()
531 if (device_property_read_bool(dev, "usb-role-switch")) { in cdns3_probe()
543 dev_warn(dev, "Unable to register Role Switch\n"); in cdns3_probe()
674 if (cdns->roles[cdns->role]->resume && !PMSG_IS_AUTO(msg)) in cdns3_controller_resume()
675 cdns->roles[cdns->role]->resume(cdns, false); in cdns3_controller_resume()
707 if (cdns->roles[cdns->role]->suspend) { in cdns3_suspend()
709 cdns->roles[cdns->role]->suspend(cdns, false); in cdns3_suspend()