Lines Matching defs:otg_sx

122 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
125 container_of(otg_sx, struct ssusb_mtk, otg_switch);
126 struct regulator *vbus = otg_sx->vbus;
152 static void ssusb_set_mailbox(struct otg_switch_mtk *otg_sx,
156 container_of(otg_sx, struct ssusb_mtk, otg_switch);
165 ssusb_set_vbus(otg_sx, 1);
170 ssusb_set_vbus(otg_sx, 0);
189 struct otg_switch_mtk *otg_sx =
192 if (otg_sx->id_event)
193 ssusb_set_mailbox(otg_sx, MTU3_ID_GROUND);
195 ssusb_set_mailbox(otg_sx, MTU3_ID_FLOAT);
200 struct otg_switch_mtk *otg_sx =
203 if (otg_sx->vbus_event)
204 ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
206 ssusb_set_mailbox(otg_sx, MTU3_VBUS_OFF);
216 struct otg_switch_mtk *otg_sx =
219 otg_sx->id_event = event;
220 schedule_work(&otg_sx->id_work);
228 struct otg_switch_mtk *otg_sx =
231 otg_sx->vbus_event = event;
232 schedule_work(&otg_sx->vbus_work);
237 static int ssusb_extcon_register(struct otg_switch_mtk *otg_sx)
240 container_of(otg_sx, struct ssusb_mtk, otg_switch);
241 struct extcon_dev *edev = otg_sx->edev;
248 otg_sx->vbus_nb.notifier_call = ssusb_vbus_notifier;
250 &otg_sx->vbus_nb);
256 otg_sx->id_nb.notifier_call = ssusb_id_notifier;
258 &otg_sx->id_nb);
270 ssusb_set_mailbox(otg_sx, MTU3_ID_FLOAT);
272 ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
285 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
289 ssusb_set_mailbox(otg_sx, MTU3_VBUS_OFF);
290 ssusb_set_mailbox(otg_sx, MTU3_ID_GROUND);
293 ssusb_set_mailbox(otg_sx, MTU3_ID_FLOAT);
294 ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
345 static int ssusb_role_sw_register(struct otg_switch_mtk *otg_sx)
349 container_of(otg_sx, struct ssusb_mtk, otg_switch);
351 if (!otg_sx->role_sw_used)
358 otg_sx->role_sw = usb_role_switch_register(ssusb->dev, &role_sx_desc);
360 return PTR_ERR_OR_ZERO(otg_sx->role_sw);
365 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
368 INIT_WORK(&otg_sx->id_work, ssusb_id_work);
369 INIT_WORK(&otg_sx->vbus_work, ssusb_vbus_work);
371 if (otg_sx->manual_drd_enabled)
373 else if (otg_sx->role_sw_used)
374 ret = ssusb_role_sw_register(otg_sx);
376 ret = ssusb_extcon_register(otg_sx);
383 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
385 cancel_work_sync(&otg_sx->id_work);
386 cancel_work_sync(&otg_sx->vbus_work);
387 usb_role_switch_unregister(otg_sx->role_sw);