Lines Matching refs:gadget

41 	struct usb_gadget		*gadget;  member
470 int usb_gadget_frame_number(struct usb_gadget *gadget) in usb_gadget_frame_number() argument
474 ret = gadget->ops->get_frame(gadget); in usb_gadget_frame_number()
476 trace_usb_gadget_frame_number(gadget, ret); in usb_gadget_frame_number()
495 int usb_gadget_wakeup(struct usb_gadget *gadget) in usb_gadget_wakeup() argument
499 if (!gadget->ops->wakeup) { in usb_gadget_wakeup()
504 ret = gadget->ops->wakeup(gadget); in usb_gadget_wakeup()
507 trace_usb_gadget_wakeup(gadget, ret); in usb_gadget_wakeup()
522 int usb_gadget_set_selfpowered(struct usb_gadget *gadget) in usb_gadget_set_selfpowered() argument
526 if (!gadget->ops->set_selfpowered) { in usb_gadget_set_selfpowered()
531 ret = gadget->ops->set_selfpowered(gadget, 1); in usb_gadget_set_selfpowered()
534 trace_usb_gadget_set_selfpowered(gadget, ret); in usb_gadget_set_selfpowered()
550 int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) in usb_gadget_clear_selfpowered() argument
554 if (!gadget->ops->set_selfpowered) { in usb_gadget_clear_selfpowered()
559 ret = gadget->ops->set_selfpowered(gadget, 0); in usb_gadget_clear_selfpowered()
562 trace_usb_gadget_clear_selfpowered(gadget, ret); in usb_gadget_clear_selfpowered()
581 int usb_gadget_vbus_connect(struct usb_gadget *gadget) in usb_gadget_vbus_connect() argument
585 if (!gadget->ops->vbus_session) { in usb_gadget_vbus_connect()
590 ret = gadget->ops->vbus_session(gadget, 1); in usb_gadget_vbus_connect()
593 trace_usb_gadget_vbus_connect(gadget, ret); in usb_gadget_vbus_connect()
611 int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) in usb_gadget_vbus_draw() argument
615 if (!gadget->ops->vbus_draw) { in usb_gadget_vbus_draw()
620 ret = gadget->ops->vbus_draw(gadget, mA); in usb_gadget_vbus_draw()
622 gadget->mA = mA; in usb_gadget_vbus_draw()
625 trace_usb_gadget_vbus_draw(gadget, ret); in usb_gadget_vbus_draw()
642 int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) in usb_gadget_vbus_disconnect() argument
646 if (!gadget->ops->vbus_session) { in usb_gadget_vbus_disconnect()
651 ret = gadget->ops->vbus_session(gadget, 0); in usb_gadget_vbus_disconnect()
654 trace_usb_gadget_vbus_disconnect(gadget, ret); in usb_gadget_vbus_disconnect()
670 int usb_gadget_connect(struct usb_gadget *gadget) in usb_gadget_connect() argument
674 if (!gadget->ops->pullup) { in usb_gadget_connect()
679 if (gadget->deactivated) { in usb_gadget_connect()
684 gadget->connected = true; in usb_gadget_connect()
688 ret = gadget->ops->pullup(gadget, 1); in usb_gadget_connect()
690 gadget->connected = 1; in usb_gadget_connect()
693 trace_usb_gadget_connect(gadget, ret); in usb_gadget_connect()
712 int usb_gadget_disconnect(struct usb_gadget *gadget) in usb_gadget_disconnect() argument
716 if (!gadget->ops->pullup) { in usb_gadget_disconnect()
721 if (!gadget->connected) in usb_gadget_disconnect()
724 if (gadget->deactivated) { in usb_gadget_disconnect()
729 gadget->connected = false; in usb_gadget_disconnect()
733 ret = gadget->ops->pullup(gadget, 0); in usb_gadget_disconnect()
735 gadget->connected = 0; in usb_gadget_disconnect()
736 gadget->udc->driver->disconnect(gadget); in usb_gadget_disconnect()
740 trace_usb_gadget_disconnect(gadget, ret); in usb_gadget_disconnect()
757 int usb_gadget_deactivate(struct usb_gadget *gadget) in usb_gadget_deactivate() argument
761 if (gadget->deactivated) in usb_gadget_deactivate()
764 if (gadget->connected) { in usb_gadget_deactivate()
765 ret = usb_gadget_disconnect(gadget); in usb_gadget_deactivate()
773 gadget->connected = true; in usb_gadget_deactivate()
775 gadget->deactivated = true; in usb_gadget_deactivate()
778 trace_usb_gadget_deactivate(gadget, ret); in usb_gadget_deactivate()
793 int usb_gadget_activate(struct usb_gadget *gadget) in usb_gadget_activate() argument
797 if (!gadget->deactivated) in usb_gadget_activate()
800 gadget->deactivated = false; in usb_gadget_activate()
806 if (gadget->connected) in usb_gadget_activate()
807 ret = usb_gadget_connect(gadget); in usb_gadget_activate()
810 trace_usb_gadget_activate(gadget, ret); in usb_gadget_activate()
861 int usb_gadget_map_request(struct usb_gadget *gadget, in usb_gadget_map_request() argument
864 return usb_gadget_map_request_by_dev(gadget->dev.parent, req, is_in); in usb_gadget_map_request()
887 void usb_gadget_unmap_request(struct usb_gadget *gadget, in usb_gadget_unmap_request() argument
890 usb_gadget_unmap_request_by_dev(gadget->dev.parent, req, is_in); in usb_gadget_unmap_request()
941 int usb_gadget_ep_match_desc(struct usb_gadget *gadget, in usb_gadget_ep_match_desc() argument
965 if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp_mult(desc) > 1) in usb_gadget_ep_match_desc()
976 if (!gadget_is_dualspeed(gadget) && max > 1023) in usb_gadget_ep_match_desc()
982 if (ep_comp && gadget_is_superspeed(gadget)) { in usb_gadget_ep_match_desc()
999 if (!gadget_is_dualspeed(gadget) && max > 64) in usb_gadget_ep_match_desc()
1019 int usb_gadget_check_config(struct usb_gadget *gadget) in usb_gadget_check_config() argument
1021 if (gadget->ops->check_config) in usb_gadget_check_config()
1022 return gadget->ops->check_config(gadget); in usb_gadget_check_config()
1031 struct usb_gadget *gadget = work_to_gadget(work); in usb_gadget_state_work() local
1032 struct usb_udc *udc = gadget->udc; in usb_gadget_state_work()
1038 void usb_gadget_set_state(struct usb_gadget *gadget, in usb_gadget_set_state() argument
1041 gadget->state = state; in usb_gadget_set_state()
1042 schedule_work(&gadget->work); in usb_gadget_set_state()
1051 usb_gadget_connect(udc->gadget); in usb_udc_connect_control()
1053 usb_gadget_disconnect(udc->gadget); in usb_udc_connect_control()
1065 void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status) in usb_udc_vbus_handler() argument
1067 struct usb_udc *udc = gadget->udc; in usb_udc_vbus_handler()
1085 void usb_gadget_udc_reset(struct usb_gadget *gadget, in usb_gadget_udc_reset() argument
1088 driver->reset(gadget); in usb_gadget_udc_reset()
1089 usb_gadget_set_state(gadget, USB_STATE_DEFAULT); in usb_gadget_udc_reset()
1115 ret = udc->gadget->ops->udc_start(udc->gadget, udc->driver); in usb_gadget_udc_start()
1140 udc->gadget->ops->udc_stop(udc->gadget); in usb_gadget_udc_stop()
1157 struct usb_gadget *gadget = udc->gadget; in usb_gadget_udc_set_speed() local
1161 s = gadget->max_speed; in usb_gadget_udc_set_speed()
1163 s = min(speed, gadget->max_speed); in usb_gadget_udc_set_speed()
1165 if (s == USB_SPEED_SUPER_PLUS && gadget->ops->udc_set_ssp_rate) in usb_gadget_udc_set_speed()
1166 gadget->ops->udc_set_ssp_rate(gadget, gadget->max_ssp_rate); in usb_gadget_udc_set_speed()
1167 else if (gadget->ops->udc_set_speed) in usb_gadget_udc_set_speed()
1168 gadget->ops->udc_set_speed(gadget, s); in usb_gadget_udc_set_speed()
1183 struct usb_gadget *gadget = udc->gadget; in usb_gadget_enable_async_callbacks() local
1185 if (gadget->ops->udc_async_callbacks) in usb_gadget_enable_async_callbacks()
1186 gadget->ops->udc_async_callbacks(gadget, true); in usb_gadget_enable_async_callbacks()
1212 struct usb_gadget *gadget = udc->gadget; in usb_gadget_disable_async_callbacks() local
1214 if (gadget->ops->udc_async_callbacks) in usb_gadget_disable_async_callbacks()
1215 gadget->ops->udc_async_callbacks(gadget, false); in usb_gadget_disable_async_callbacks()
1269 void usb_initialize_gadget(struct device *parent, struct usb_gadget *gadget, in usb_initialize_gadget() argument
1272 dev_set_name(&gadget->dev, "gadget"); in usb_initialize_gadget()
1273 INIT_WORK(&gadget->work, usb_gadget_state_work); in usb_initialize_gadget()
1274 gadget->dev.parent = parent; in usb_initialize_gadget()
1277 gadget->dev.release = release; in usb_initialize_gadget()
1279 gadget->dev.release = usb_udc_nop_release; in usb_initialize_gadget()
1281 device_initialize(&gadget->dev); in usb_initialize_gadget()
1292 int usb_add_gadget(struct usb_gadget *gadget) in usb_add_gadget() argument
1305 udc->dev.parent = gadget->dev.parent; in usb_add_gadget()
1307 kobject_name(&gadget->dev.parent->kobj)); in usb_add_gadget()
1311 ret = device_add(&gadget->dev); in usb_add_gadget()
1315 udc->gadget = gadget; in usb_add_gadget()
1316 gadget->udc = udc; in usb_add_gadget()
1327 usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED); in usb_add_gadget()
1340 flush_work(&gadget->work); in usb_add_gadget()
1347 device_del(&gadget->dev); in usb_add_gadget()
1367 int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, in usb_add_gadget_udc_release() argument
1372 usb_initialize_gadget(parent, gadget, release); in usb_add_gadget_udc_release()
1373 ret = usb_add_gadget(gadget); in usb_add_gadget_udc_release()
1375 usb_put_gadget(gadget); in usb_add_gadget_udc_release()
1401 name = kstrdup(udc->gadget->name, GFP_KERNEL); in usb_get_gadget_udc_name()
1418 int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget) in usb_add_gadget_udc() argument
1420 return usb_add_gadget_udc_release(parent, gadget, NULL); in usb_add_gadget_udc()
1431 usb_gadget_disconnect(udc->gadget); in usb_gadget_remove_driver()
1433 if (udc->gadget->irq) in usb_gadget_remove_driver()
1434 synchronize_irq(udc->gadget->irq); in usb_gadget_remove_driver()
1435 udc->driver->unbind(udc->gadget); in usb_gadget_remove_driver()
1440 udc->gadget->dev.driver = NULL; in usb_gadget_remove_driver()
1451 void usb_del_gadget(struct usb_gadget *gadget) in usb_del_gadget() argument
1453 struct usb_udc *udc = gadget->udc; in usb_del_gadget()
1458 dev_vdbg(gadget->dev.parent, "unregistering gadget\n"); in usb_del_gadget()
1472 flush_work(&gadget->work); in usb_del_gadget()
1474 device_del(&gadget->dev); in usb_del_gadget()
1484 void usb_del_gadget_udc(struct usb_gadget *gadget) in usb_del_gadget_udc() argument
1486 usb_del_gadget(gadget); in usb_del_gadget_udc()
1487 usb_put_gadget(gadget); in usb_del_gadget_udc()
1502 udc->gadget->dev.driver = &driver->driver; in udc_bind_to_driver()
1506 ret = driver->bind(udc->gadget, driver); in udc_bind_to_driver()
1511 driver->unbind(udc->gadget); in udc_bind_to_driver()
1525 udc->gadget->dev.driver = NULL; in udc_bind_to_driver()
1588 usb_gadget_set_state(udc->gadget, in usb_gadget_unregister_driver()
1619 usb_gadget_wakeup(udc->gadget); in srp_store()
1640 usb_gadget_connect(udc->gadget); in soft_connect_store()
1642 usb_gadget_disconnect(udc->gadget); in soft_connect_store()
1661 struct usb_gadget *gadget = udc->gadget; in state_show() local
1663 return sprintf(buf, "%s\n", usb_state_string(gadget->state)); in state_show()
1685 usb_speed_string(udc->gadget->param)); \
1697 struct usb_gadget *gadget = udc->gadget; \
1699 return scnprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \
1741 ret = add_uevent_var(env, "USB_UDC_NAME=%s", udc->gadget->name); in usb_udc_uevent()