Lines Matching defs:otg_sx

17 static inline struct ssusb_mtk *otg_sx_to_ssusb(struct otg_switch_mtk *otg_sx)
19 return container_of(otg_sx, struct ssusb_mtk, otg_switch);
102 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
104 struct ssusb_mtk *ssusb = otg_sx_to_ssusb(otg_sx);
105 struct regulator *vbus = otg_sx->vbus;
129 struct otg_switch_mtk *otg_sx =
131 struct ssusb_mtk *ssusb = otg_sx_to_ssusb(otg_sx);
133 enum usb_role desired_role = otg_sx->desired_role;
141 if (otg_sx->default_role == USB_ROLE_DEVICE)
157 ssusb_set_vbus(otg_sx, 1);
163 ssusb_set_vbus(otg_sx, 0);
174 static void ssusb_set_mode(struct otg_switch_mtk *otg_sx, enum usb_role role)
176 struct ssusb_mtk *ssusb = otg_sx_to_ssusb(otg_sx);
181 otg_sx->desired_role = role;
182 queue_work(system_freezable_wq, &otg_sx->dr_work);
188 struct otg_switch_mtk *otg_sx =
191 ssusb_set_mode(otg_sx, event ? USB_ROLE_HOST : USB_ROLE_DEVICE);
196 static int ssusb_extcon_register(struct otg_switch_mtk *otg_sx)
198 struct ssusb_mtk *ssusb = otg_sx_to_ssusb(otg_sx);
199 struct extcon_dev *edev = otg_sx->edev;
206 otg_sx->id_nb.notifier_call = ssusb_id_notifier;
208 &otg_sx->id_nb);
219 ssusb_set_mode(otg_sx, USB_ROLE_DEVICE);
232 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
234 ssusb_set_mode(otg_sx, to_host ? USB_ROLE_HOST : USB_ROLE_DEVICE);
263 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
265 ssusb_set_mode(otg_sx, role);
277 static int ssusb_role_sw_register(struct otg_switch_mtk *otg_sx)
280 struct ssusb_mtk *ssusb = otg_sx_to_ssusb(otg_sx);
284 if (!otg_sx->role_sw_used)
289 otg_sx->default_role = USB_ROLE_DEVICE;
291 otg_sx->default_role = USB_ROLE_HOST;
298 otg_sx->role_sw = usb_role_switch_register(dev, &role_sx_desc);
299 if (IS_ERR(otg_sx->role_sw))
300 return PTR_ERR(otg_sx->role_sw);
302 ssusb_set_mode(otg_sx, otg_sx->default_role);
309 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
312 INIT_WORK(&otg_sx->dr_work, ssusb_mode_sw_work);
314 if (otg_sx->manual_drd_enabled)
316 else if (otg_sx->role_sw_used)
317 ret = ssusb_role_sw_register(otg_sx);
319 ret = ssusb_extcon_register(otg_sx);
326 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
328 cancel_work_sync(&otg_sx->dr_work);
329 usb_role_switch_unregister(otg_sx->role_sw);