Lines Matching full:gadget
27 * struct usb_os_string - represents OS String to be reported by a gadget
43 * The code in this file is utility code, used to build a gadget driver
69 * NOTE: we try to help gadget drivers which might not be setting in function_descriptors()
94 * if we can't find any descriptors at all, then this gadget deserves to in function_descriptors()
134 * according to gadget speed.
135 * @g: pointer to the gadget
143 * endpoint according to gadget speed and saves it in the
272 * according to gadget speed.
273 * @g: pointer to the gadget
280 * endpoint according to gadget speed and saves it in the
300 * Context: single threaded during gadget setup
379 * usb_function_deactivate - prevent function and gadget enumeration
382 * Blocks response of the gadget driver to host enumeration by
407 status = usb_gadget_deactivate(cdev->gadget); in usb_function_deactivate()
419 * usb_function_activate - allow function and gadget enumeration
423 * are delaying their activation, the gadget driver will respond to
442 status = usb_gadget_activate(cdev->gadget); in usb_function_activate()
456 * Context: single threaded during gadget setup
505 struct usb_gadget *gadget = func->config->cdev->gadget; in usb_func_wakeup() local
508 if (!gadget->ops->func_wakeup) in usb_func_wakeup()
525 return gadget->ops->func_wakeup(gadget, id); in usb_func_wakeup()
554 /* Reset the rw bit if gadget is not capable of it */ in check_remote_wakeup_config()
616 struct usb_gadget *gadget = cdev->gadget; in config_desc() local
622 if (gadget->speed >= USB_SPEED_SUPER) in config_desc()
623 speed = gadget->speed; in config_desc()
624 else if (gadget_is_dualspeed(gadget)) { in config_desc()
626 if (gadget->speed == USB_SPEED_HIGH) in config_desc()
679 struct usb_gadget *gadget = cdev->gadget; in count_configs() local
686 if (gadget_is_dualspeed(gadget)) { in count_configs()
687 if (gadget->speed == USB_SPEED_HIGH) in count_configs()
689 if (gadget->speed == USB_SPEED_SUPER) in count_configs()
691 if (gadget->speed == USB_SPEED_SUPER_PLUS) in count_configs()
739 if (cdev->gadget->ops->get_config_params) { in bos_desc()
740 cdev->gadget->ops->get_config_params(cdev->gadget, in bos_desc()
765 if (cdev->gadget->lpm_capable) { in bos_desc()
780 if (gadget_is_superspeed(cdev->gadget)) { in bos_desc()
800 if (gadget_is_superspeed_plus(cdev->gadget)) { in bos_desc()
806 if (cdev->gadget->max_ssp_rate == USB_SSP_GEN_2x2) in bos_desc()
835 * Use 1 SSID if the gadget supports up to gen2x1 or not in bos_desc()
839 * Use 1 SSID if the gadget supports up to gen1x2: in bos_desc()
842 * Use 2 SSIDs if the gadget supports up to gen2x2: in bos_desc()
853 if (cdev->gadget->max_ssp_rate == USB_SSP_GEN_2x1 || in bos_desc()
854 cdev->gadget->max_ssp_rate == USB_SSP_GEN_UNKNOWN) in bos_desc()
921 qual->bMaxPacketSize0 = cdev->gadget->ep0->maxpacket; in device_qual()
950 struct usb_gadget *gadget = cdev->gadget; in set_config() local
953 unsigned power = gadget_is_otg(gadget) ? 8 : 100; in set_config()
980 usb_speed_string(gadget->speed), in set_config()
986 usb_gadget_set_state(gadget, USB_STATE_CONFIGURED); in set_config()
1003 descriptors = function_descriptors(f, gadget->speed); in set_config()
1043 if (gadget->speed < USB_SPEED_SUPER) in set_config()
1049 usb_gadget_set_remote_wakeup(gadget, 1); in set_config()
1051 usb_gadget_set_remote_wakeup(gadget, 0); in set_config()
1054 usb_gadget_set_selfpowered(gadget); in set_config()
1056 usb_gadget_clear_selfpowered(gadget); in set_config()
1058 usb_gadget_vbus_draw(gadget, power); in set_config()
1091 * @cdev: wraps the USB gadget
1094 * Context: single threaded during gadget setup
1124 status = usb_gadget_check_config(cdev->gadget); in usb_add_config()
1151 ? (gadget_is_dualspeed(cdev->gadget) in usb_add_config()
1167 usb_ep_autoconfig_reset(cdev->gadget); in usb_add_config()
1198 * @cdev: wraps the USB gadget
1372 * Context: single threaded during gadget setup
1400 * Context: single threaded during gadget setup
1480 * usb_gstrings_attach() - attach gadget strings to a cdev and assign ids
1545 * Context: single threaded during gadget setup
1606 ret = usb_ep_queue(cdev->gadget->ep0, req, gfp_flags); in composite_ep0_queue()
1773 * housekeeping for the gadget function we're implementing. Most of
1777 composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) in composite_setup() argument
1779 struct usb_composite_dev *cdev = get_gadget_data(gadget); in composite_setup()
1804 * gadget might need to intercept e.g. a control-OUT completion in composite_setup()
1811 gadget->ep0->driver_data = cdev; in composite_setup()
1832 cdev->gadget->ep0->maxpacket; in composite_setup()
1833 if (gadget_is_superspeed(gadget)) { in composite_setup()
1834 if (gadget->speed >= USB_SPEED_SUPER) { in composite_setup()
1841 if (gadget->lpm_capable || cdev->use_webusb) in composite_setup()
1851 if (!gadget_is_dualspeed(gadget) || in composite_setup()
1852 gadget->speed >= USB_SPEED_SUPER) in composite_setup()
1859 if (!gadget_is_dualspeed(gadget) || in composite_setup()
1860 gadget->speed >= USB_SPEED_SUPER) in composite_setup()
1875 if (gadget_is_superspeed(gadget) || in composite_setup()
1876 gadget->lpm_capable || cdev->use_webusb) { in composite_setup()
1882 if (gadget_is_otg(gadget)) { in composite_setup()
1895 if (gadget->otg_caps && in composite_setup()
1896 (gadget->otg_caps->otg_rev >= 0x0200)) in composite_setup()
1914 if (gadget_is_otg(gadget)) { in composite_setup()
1915 if (gadget->a_hnp_support) in composite_setup()
1917 else if (gadget->a_alt_hnp_support) in composite_setup()
1982 if (gadget_is_otg(gadget) && gadget->hnp_polling_support && in composite_setup()
1987 *((u8 *)req->buf) = gadget->host_request_flag; in composite_setup()
1999 if (!gadget_is_superspeed(gadget)) in composite_setup()
2033 if (!gadget_is_superspeed(gadget)) in composite_setup()
2284 composite_setup_complete(gadget->ep0, req); in composite_setup()
2297 static void __composite_disconnect(struct usb_gadget *gadget) in __composite_disconnect() argument
2299 struct usb_composite_dev *cdev = get_gadget_data(gadget); in __composite_disconnect()
2314 void composite_disconnect(struct usb_gadget *gadget) in composite_disconnect() argument
2316 usb_gadget_vbus_draw(gadget, 0); in composite_disconnect()
2317 __composite_disconnect(gadget); in composite_disconnect()
2320 void composite_reset(struct usb_gadget *gadget) in composite_reset() argument
2327 usb_gadget_vbus_draw(gadget, 100); in composite_reset()
2328 __composite_disconnect(gadget); in composite_reset()
2336 struct usb_gadget *gadget = dev_to_usb_gadget(dev); in suspended_show() local
2337 struct usb_composite_dev *cdev = get_gadget_data(gadget); in suspended_show()
2343 static void __composite_unbind(struct usb_gadget *gadget, bool unbind_driver) in __composite_unbind() argument
2345 struct usb_composite_dev *cdev = get_gadget_data(gadget); in __composite_unbind()
2372 set_gadget_data(gadget, NULL); in __composite_unbind()
2375 static void composite_unbind(struct usb_gadget *gadget) in composite_unbind() argument
2377 __composite_unbind(gadget, true); in composite_unbind()
2421 struct usb_gadget *gadget = cdev->gadget; in composite_dev_prepare() local
2425 cdev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); in composite_dev_prepare()
2433 ret = device_create_file(&gadget->dev, &dev_attr_suspended); in composite_dev_prepare()
2439 gadget->ep0->driver_data = cdev; in composite_dev_prepare()
2449 usb_gadget_set_selfpowered(gadget); in composite_dev_prepare()
2455 usb_ep_autoconfig_reset(gadget); in composite_dev_prepare()
2460 usb_ep_free_request(gadget->ep0, cdev->req); in composite_dev_prepare()
2500 usb_ep_dequeue(cdev->gadget->ep0, cdev->os_desc_req); in composite_dev_cleanup()
2504 usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req); in composite_dev_cleanup()
2509 usb_ep_dequeue(cdev->gadget->ep0, cdev->req); in composite_dev_cleanup()
2513 usb_ep_free_request(cdev->gadget->ep0, cdev->req); in composite_dev_cleanup()
2517 device_remove_file(&cdev->gadget->dev, &dev_attr_suspended); in composite_dev_cleanup()
2529 &cdev->gadget->ep_list, ep_list) { in composite_dev_cleanup()
2535 static int composite_bind(struct usb_gadget *gadget, in composite_bind() argument
2547 cdev->gadget = gadget; in composite_bind()
2548 set_gadget_data(gadget, cdev); in composite_bind()
2556 /* composite gadget needs to assign strings for whole device (like in composite_bind()
2565 status = composite_os_desc_req_prepare(cdev, gadget->ep0); in composite_bind()
2580 __composite_unbind(gadget, false); in composite_bind()
2586 void composite_suspend(struct usb_gadget *gadget) in composite_suspend() argument
2588 struct usb_composite_dev *cdev = get_gadget_data(gadget); in composite_suspend()
2606 usb_gadget_set_selfpowered(gadget); in composite_suspend()
2607 usb_gadget_vbus_draw(gadget, 2); in composite_suspend()
2610 void composite_resume(struct usb_gadget *gadget) in composite_resume() argument
2612 struct usb_composite_dev *cdev = get_gadget_data(gadget); in composite_resume()
2635 if (gadget->speed < USB_SPEED_SUPER) in composite_resume()
2641 usb_gadget_clear_selfpowered(gadget); in composite_resume()
2643 usb_gadget_vbus_draw(gadget, maxpower); in composite_resume()
2647 usb_gadget_vbus_draw(gadget, maxpower); in composite_resume()
2675 * Context: single threaded during gadget setup
2682 * On successful return, the gadget is ready to respond to requests from
2751 composite_setup_complete(cdev->gadget->ep0, req); in usb_composite_setup_continue()
2759 static char *composite_default_mfr(struct usb_gadget *gadget) in composite_default_mfr() argument
2762 init_utsname()->release, gadget->name); in composite_default_mfr()
2791 cdev->def_manufacturer = composite_default_mfr(cdev->gadget); in usb_composite_overwrite_options()