Lines Matching full:role
3 * drd.c - DesignWare USB2 DRD Controller Dual-role support
13 #include <linux/usb/role.h>
86 static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role) in dwc2_drd_role_sw_set() argument
93 if ((role == USB_ROLE_DEVICE && hsotg->dr_mode == USB_DR_MODE_HOST) || in dwc2_drd_role_sw_set()
94 (role == USB_ROLE_HOST && hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)) in dwc2_drd_role_sw_set()
100 if (role == USB_ROLE_NONE && hsotg->test_mode) { in dwc2_drd_role_sw_set()
109 * If role-switch set is called before the udc_start, we need to enable in dwc2_drd_role_sw_set()
122 if (role == USB_ROLE_NONE) { in dwc2_drd_role_sw_set()
123 /* default operation mode when usb role is USB_ROLE_NONE */ in dwc2_drd_role_sw_set()
125 role = USB_ROLE_HOST; in dwc2_drd_role_sw_set()
127 role = USB_ROLE_DEVICE; in dwc2_drd_role_sw_set()
139 if (role == USB_ROLE_HOST) { in dwc2_drd_role_sw_set()
141 } else if (role == USB_ROLE_DEVICE) { in dwc2_drd_role_sw_set()
161 dwc2_force_mode(hsotg, role == USB_ROLE_HOST); in dwc2_drd_role_sw_set()
167 role == USB_ROLE_NONE ? "No" : in dwc2_drd_role_sw_set()
168 role == USB_ROLE_HOST ? "A" : "B"); in dwc2_drd_role_sw_set()
179 if (!device_property_read_bool(hsotg->dev, "usb-role-switch")) in dwc2_drd_init()
192 "failed to register role switch: %d\n", ret); in dwc2_drd_init()
220 enum usb_role role; in dwc2_drd_resume() local
223 /* get last known role (as the get ops isn't implemented by this driver) */ in dwc2_drd_resume()
224 role = usb_role_switch_get_role(hsotg->role_sw); in dwc2_drd_resume()
226 if (role == USB_ROLE_NONE) { in dwc2_drd_resume()
228 role = USB_ROLE_HOST; in dwc2_drd_resume()
230 role = USB_ROLE_DEVICE; in dwc2_drd_resume()
233 /* restore last role that may have been lost */ in dwc2_drd_resume()
234 if (role == USB_ROLE_HOST) in dwc2_drd_resume()
236 else if (role == USB_ROLE_DEVICE) in dwc2_drd_resume()
239 dwc2_force_mode(hsotg, role == USB_ROLE_HOST); in dwc2_drd_resume()
242 role == USB_ROLE_NONE ? "No" : in dwc2_drd_resume()
243 role == USB_ROLE_HOST ? "A" : "B"); in dwc2_drd_resume()