/linux/include/linux/usb/ |
H A D | gadget.h | 315 int (*func_wakeup)(struct usb_gadget *gadget, int intf_id); 329 void (*udc_set_ssp_rate)(struct usb_gadget *gadget, 331 void (*udc_async_callbacks)(struct usb_gadget *gadget, bool enable); 335 int (*check_config)(struct usb_gadget *gadget); 462 static inline void set_gadget_data(struct usb_gadget *gadget, void *data) in set_gadget_data() argument 463 { dev_set_drvdata(&gadget->dev, data); } in set_gadget_data() 464 static inline void *get_gadget_data(struct usb_gadget *gadget) in get_gadget_data() argument 465 { return dev_get_drvdata(&gadget->dev); } in get_gadget_data() 470 static inline struct usb_gadget *usb_get_gadget(struct usb_gadget *gadget) in usb_get_gadget() argument 472 get_device(&gadget->dev); in usb_get_gadget() [all …]
|
H A D | composite.h | 463 struct usb_gadget *gadget; member 518 extern void composite_disconnect(struct usb_gadget *gadget); 519 extern void composite_reset(struct usb_gadget *gadget); 521 extern int composite_setup(struct usb_gadget *gadget, 523 extern void composite_suspend(struct usb_gadget *gadget); 524 extern void composite_resume(struct usb_gadget *gadget); 628 dev_dbg(&(d)->gadget->dev , fmt , ## args) 630 dev_vdbg(&(d)->gadget->dev , fmt , ## args) 632 dev_err(&(d)->gadget->dev , fmt , ## args) 634 dev_warn(&(d)->gadget->dev , fmt , ## args) [all …]
|
/linux/Documentation/ABI/testing/ |
H A D | configfs-usb-gadget | 1 What: /config/usb-gadget 8 What: /config/usb-gadget/gadget 13 The attributes of a gadget: 16 UDC bind a gadget to UDC/unbind a gadget; 18 to bind a gadget, empty string "" to unbind. 34 What: /config/usb-gadget/gadget/configs 38 This group contains a USB gadget's configurations 40 What: /config/usb-gadget/gadget/configs/config 51 What: /config/usb-gadget/gadget/configs/config/strings 58 What: /config/usb-gadget/gadget/configs/config/strings/language [all …]
|
H A D | sysfs-devices-platform-_UDC_-gadget | 1 What: /sys/devices/platform/_UDC_/gadget/suspended 5 Show the suspend state of an USB composite gadget. 12 What: /sys/devices/platform/_UDC_/gadget/gadget-lunX/nofua 17 the SCSI WRITE(10,12) commands when a gadget in USB Mass
|
/linux/drivers/usb/gadget/ |
H A D | epautoconf.c | 64 struct usb_gadget *gadget, in usb_ep_autoconfig_ss() argument 71 if (gadget->ops->match_ep) { in usb_ep_autoconfig_ss() 72 ep = gadget->ops->match_ep(gadget, desc, ep_comp); in usb_ep_autoconfig_ss() 78 list_for_each_entry (ep, &gadget->ep_list, ep_list) { in usb_ep_autoconfig_ss() 79 if (usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp)) in usb_ep_autoconfig_ss() 100 if (++gadget->in_epnum > 15) in usb_ep_autoconfig_ss() 102 desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum; in usb_ep_autoconfig_ss() 104 if (++gadget->out_epnum > 15) in usb_ep_autoconfig_ss() 106 desc->bEndpointAddress |= gadget->out_epnum; in usb_ep_autoconfig_ss() 150 struct usb_gadget *gadget, in usb_ep_autoconfig() argument [all …]
|
H A D | composite.c | 407 status = usb_gadget_deactivate(cdev->gadget); in usb_function_deactivate() 442 status = usb_gadget_activate(cdev->gadget); in usb_function_activate() 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() 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() [all …]
|
/linux/drivers/usb/gadget/udc/bdc/ |
H A D | bdc_udc.c | 86 bdc->gadget.ep0->maxpacket = EP0_MAX_PKT_SIZE; in bdc_uspc_connected() 87 bdc->gadget.speed = USB_SPEED_SUPER; in bdc_uspc_connected() 98 bdc->gadget.ep0->maxpacket = 64; in bdc_uspc_connected() 99 bdc->gadget.speed = USB_SPEED_HIGH; in bdc_uspc_connected() 104 bdc->gadget.ep0->maxpacket = 64; in bdc_uspc_connected() 105 bdc->gadget.speed = USB_SPEED_FULL; in bdc_uspc_connected() 110 bdc->gadget.ep0->maxpacket = 8; in bdc_uspc_connected() 111 bdc->gadget.speed = USB_SPEED_LOW; in bdc_uspc_connected() 125 usb_gadget_set_state(&bdc->gadget, USB_STATE_DEFAULT); in bdc_uspc_connected() 145 bdc->gadget_driver->disconnect(&bdc->gadget); in bdc_uspc_disconnected() [all …]
|
/linux/drivers/usb/gadget/legacy/ |
H A D | dbgp.c | 27 struct usb_gadget *gadget; member 124 dev_dbg(&dbgp.gadget->dev, in dbgp_complete() 162 dev_dbg(&dbgp.gadget->dev, in dbgp_enable_ep_req() 204 dev_dbg(&dbgp.gadget->dev, "enable ep: failure (%d:%d)\n", stp, err); in dbgp_enable_ep() 209 static void dbgp_disconnect(struct usb_gadget *gadget) in dbgp_disconnect() argument 218 static void dbgp_unbind(struct usb_gadget *gadget) in dbgp_unbind() argument 226 usb_ep_free_request(gadget->ep0, dbgp.req); in dbgp_unbind() 235 static int dbgp_configure_endpoints(struct usb_gadget *gadget) in dbgp_configure_endpoints() argument 239 usb_ep_autoconfig_reset(gadget); in dbgp_configure_endpoints() 241 dbgp.i_ep = usb_ep_autoconfig(gadget, &i_desc); in dbgp_configure_endpoints() [all …]
|
H A D | ether.c | 214 if (gadget_is_otg(c->cdev->gadget)) { in rndis_do_config() 256 if (gadget_is_otg(c->cdev->gadget)) { in eth_do_config() 271 } else if (can_support_ecm(c->cdev->gadget)) { in eth_do_config() 306 struct usb_gadget *gadget = cdev->gadget; in eth_bind() local 327 } else if (can_support_ecm(gadget)) { in eth_bind() 367 gether_set_gadget(net, cdev->gadget); in eth_bind() 374 else if (can_support_ecm(gadget)) in eth_bind() 402 if (gadget_is_otg(gadget) && !otg_desc[0]) { in eth_bind() 405 usb_desc = usb_otg_descriptor_alloc(gadget); in eth_bind() 410 usb_otg_descriptor_init(gadget, usb_desc); in eth_bind() [all …]
|
H A D | cdc2.c | 93 if (gadget_is_otg(c->cdev->gadget)) { in cdc_do_config() 140 struct usb_gadget *gadget = cdev->gadget; in cdc_bind() local 144 if (!can_support_ecm(cdev->gadget)) { in cdc_bind() 145 dev_err(&gadget->dev, "controller '%s' not usable\n", in cdc_bind() 146 gadget->name); in cdc_bind() 178 if (gadget_is_otg(gadget) && !otg_desc[0]) { in cdc_bind() 181 usb_desc = usb_otg_descriptor_alloc(gadget); in cdc_bind() 186 usb_otg_descriptor_init(gadget, usb_desc); in cdc_bind() 197 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n", in cdc_bind()
|
H A D | inode.c | 3 * inode.c -- user mode filesystem api for usb gadget controllers 34 #include <linux/usb/gadget.h> 56 * - First, dev_config() is called when /dev/gadget/$CHIP is configured 62 * called when each /dev/gadget/ep* file is configured (by writing 90 /* /dev/gadget/$CHIP represents ep0 and the whole device */ 95 /* Only one open() of /dev/gadget/$CHIP; only one file tracks 148 struct usb_gadget *gadget; 190 /* other /dev/gadget/$ENDPOINT files represent endpoints */ 243 /* NOTE: don't use dev_printk calls before binding to the gadget 247 /* too wordy: dev_printk(level , &(d)->gadget 147 struct usb_gadget *gadget; global() member 1255 struct usb_gadget *gadget = dev->gadget; gadget_dev_ioctl() local 1334 gadgetfs_setup(struct usb_gadget * gadget,const struct usb_ctrlrequest * ctrl) gadgetfs_setup() argument 1649 gadgetfs_unbind(struct usb_gadget * gadget) gadgetfs_unbind() argument 1677 gadgetfs_bind(struct usb_gadget * gadget,struct usb_gadget_driver * driver) gadgetfs_bind() argument 1717 gadgetfs_disconnect(struct usb_gadget * gadget) gadgetfs_disconnect() argument 1735 gadgetfs_suspend(struct usb_gadget * gadget) gadgetfs_suspend() argument [all...] |
H A D | printer.c | 116 struct usb_gadget *gadget = c->cdev->gadget; in printer_do_config() local 119 usb_ep_autoconfig_reset(gadget); in printer_do_config() 121 usb_gadget_set_selfpowered(gadget); in printer_do_config() 123 if (gadget_is_otg(gadget)) { in printer_do_config() 174 if (gadget_is_otg(cdev->gadget) && !otg_desc[0]) { in printer_bind() 177 usb_desc = usb_otg_descriptor_alloc(cdev->gadget); in printer_bind() 182 usb_otg_descriptor_init(cdev->gadget, usb_desc); in printer_bind()
|
H A D | ncm.c | 99 if (gadget_is_otg(c->cdev->gadget)) { in ncm_do_config() 129 struct usb_gadget *gadget = cdev->gadget; in gncm_bind() local 155 if (gadget_is_otg(gadget) && !otg_desc[0]) { in gncm_bind() 158 usb_desc = usb_otg_descriptor_alloc(gadget); in gncm_bind() 163 usb_otg_descriptor_init(gadget, usb_desc); in gncm_bind() 174 dev_info(&gadget->dev, "%s\n", DRIVER_DESC); in gncm_bind()
|
H A D | multi.c | 138 if (gadget_is_otg(c->cdev->gadget)) { in rndis_do_config() 220 if (gadget_is_otg(c->cdev->gadget)) { in cdc_do_config() 296 struct usb_gadget *gadget = cdev->gadget; in multi_bind() local 307 if (!can_support_ecm(cdev->gadget)) { in multi_bind() 308 dev_err(&gadget->dev, "controller '%s' not usable\n", in multi_bind() 309 gadget->name); in multi_bind() 350 gether_set_gadget(ecm_opts->net, cdev->gadget); in multi_bind() 398 if (gadget_is_otg(gadget) && !otg_desc[0]) { in multi_bind() 401 usb_desc = usb_otg_descriptor_alloc(gadget); in multi_bind() 406 usb_otg_descriptor_init(gadget, usb_desc); in multi_bind() [all …]
|
/linux/drivers/usb/gadget/udc/aspeed-vhub/ |
H A D | dev.c | 60 if (d->gadget.speed == USB_SPEED_HIGH) in ast_vhub_dev_enable() 104 d->gadget.speed = USB_SPEED_UNKNOWN; in ast_vhub_dev_disable() 173 st0 = d->gadget.is_selfpowered << USB_DEVICE_SELF_POWERED; in ast_vhub_dev_status() 238 if (d->gadget.speed == USB_SPEED_UNKNOWN) { in ast_vhub_std_dev_request() 239 d->gadget.speed = ep->vhub->speed; in ast_vhub_std_dev_request() 240 if (d->gadget.speed > d->driver->max_speed) in ast_vhub_std_dev_request() 241 d->gadget.speed = d->driver->max_speed; in ast_vhub_std_dev_request() 243 d->gadget.speed); in ast_vhub_std_dev_request() 276 static int ast_vhub_udc_wakeup(struct usb_gadget* gadget) in ast_vhub_udc_wakeup() argument 278 struct ast_vhub_dev *d = to_ast_dev(gadget); in ast_vhub_udc_wakeup() [all …]
|
/linux/Documentation/usb/ |
H A D | gadget_serial.rst | 27 This document and the gadget serial driver itself are 36 Versions of the gadget serial driver are available for the 38 version 2.3 or later of the gadget serial driver in a 2.6 45 gadget and usb drivers as modules. 56 The gadget serial driver is a Linux USB gadget driver, a USB device 61 The gadget serial driver talks over USB to either a CDC ACM driver 84 On the device-side Linux system, the gadget serial driver looks 87 On the host-side system, the gadget serial device looks like a 98 With the gadget serial driver and the host side ACM or generic 100 the host and the gadget side systems as if they were connected by a [all …]
|
H A D | gadget_configfs.rst | 2 Linux USB gadget configured through configfs 18 A gadget is seen by its host as a set of configurations, each of which contains 19 a number of interfaces which, from the gadget's perspective, are known as 24 Creating a gadget means deciding what configurations there will be 31 It also describes how configfs integration into gadget is designed. 62 For each gadget to be created its corresponding directory must be created:: 64 $ mkdir $CONFIGFS_HOME/usb_gadget/<gadget name> 76 Each gadget needs to have its vendor id <VID> and product id <PID> specified:: 81 A gadget also needs its serial number, manufacturer and product strings. 106 Each gadget will consist of a number of configurations, their corresponding [all …]
|
H A D | gadget_multi.rst | 8 The Multifunction Composite Gadget (or g_multi) is a composite gadget 10 a... multifunction gadget. 17 and RNDIS can be turned off. If they are both enabled the gadget will 26 To make use of the gadget one needs to make it work on host side -- 27 without that there's no hope of achieving anything with the gadget. 33 Since the gadget uses standard composite framework and appears as such 45 For the gadget to work under Windows two conditions have to be met: 47 Detecting as composite gadget 50 First of all, Windows need to detect the gadget as an USB composite 51 gadget which on its own have some conditions[4]. If they are met, [all …]
|
H A D | raw-gadget.rst | 5 USB Raw Gadget is a gadget driver that gives userspace low-level control over 6 the gadget's communication process. 8 Like any other gadget driver, Raw Gadget implements USB devices via the 9 USB gadget API. Unlike most gadget drivers, Raw Gadget does not implement 21 USB gadget layer for userspace. The key differences are: 26 its own and never forward them to the gadget layer. 46 The user can interact with Raw Gadget by opening ``/dev/raw-gadget`` and 53 1. Create a Raw Gadget instance by opening ``/dev/raw-gadget``. 57 Raw Gadget and react to those depending on what kind of USB gadget must 66 endpoints for the gadget and assign addresses in the endpoint descriptors [all …]
|
/linux/drivers/usb/isp1760/ |
H A D | isp1760-udc.c | 35 static inline struct isp1760_udc *gadget_to_udc(struct usb_gadget *gadget) in gadget_to_udc() argument 37 return container_of(gadget, struct isp1760_udc, gadget); in gadget_to_udc() 566 if (udc->gadget.state != USB_STATE_DEFAULT && in isp1760_udc_set_address() 567 udc->gadget.state != USB_STATE_ADDRESS) { in isp1760_udc_set_address() 569 udc->gadget.state); in isp1760_udc_set_address() 573 usb_gadget_set_state(&udc->gadget, addr ? USB_STATE_ADDRESS : in isp1760_udc_set_address() 684 if (udc->gadget.state != USB_STATE_ADDRESS && in isp1760_ep0_setup_standard() 685 udc->gadget.state != USB_STATE_CONFIGURED) in isp1760_ep0_setup_standard() 688 stall = udc->driver->setup(&udc->gadget, req) < 0; in isp1760_ep0_setup_standard() 692 usb_gadget_set_state(&udc->gadget, req->wValue ? in isp1760_ep0_setup_standard() [all …]
|
/linux/drivers/usb/renesas_usbhs/ |
H A D | mod_gadget.c | 40 struct usb_gadget gadget; member 88 container_of(g, struct usbhsg_gpriv, gadget) 107 #define usbhsg_is_not_connected(gp) ((gp)->gadget.speed == USB_SPEED_UNKNOWN) 462 gpriv->gadget.speed = usbhs_bus_get_speed(priv); in usbhsg_irq_dev_state() 464 dev_dbg(dev, "state = %x : speed : %d\n", state, gpriv->gadget.speed); in usbhsg_irq_dev_state() 466 if (gpriv->gadget.speed != USB_SPEED_UNKNOWN && in usbhsg_irq_dev_state() 469 gpriv->driver->suspend(&gpriv->gadget); in usbhsg_irq_dev_state() 470 usb_gadget_set_state(&gpriv->gadget, USB_STATE_SUSPENDED); in usbhsg_irq_dev_state() 543 ret = gpriv->driver->setup(&gpriv->gadget, &ctrl); in usbhsg_irq_ctrl_stage() 906 gpriv->gadget.speed = USB_SPEED_UNKNOWN; in usbhsg_try_stop() [all …]
|
/linux/drivers/usb/cdns3/ |
H A D | cdnsp-ep0.c | 47 ret = pdev->gadget_driver->setup(&pdev->gadget, ctrl); in cdnsp_ep0_delegate_req() 56 enum usb_device_state state = pdev->gadget.state; in cdnsp_ep0_set_config() 79 usb_gadget_set_state(&pdev->gadget, USB_STATE_ADDRESS); in cdnsp_ep0_set_config() 87 enum usb_device_state state = pdev->gadget.state; in cdnsp_ep0_set_address() 120 usb_gadget_set_state(&pdev->gadget, USB_STATE_ADDRESS); in cdnsp_ep0_set_address() 122 usb_gadget_set_state(&pdev->gadget, USB_STATE_DEFAULT); in cdnsp_ep0_set_address() 157 status = pdev->gadget.is_selfpowered; in cdnsp_ep0_handle_status() 160 if (pdev->gadget.speed >= USB_SPEED_SUPER) { in cdnsp_ep0_handle_status() 210 state = pdev->gadget.state; in cdnsp_ep0_handle_feature_device() 211 speed = pdev->gadget.speed; in cdnsp_ep0_handle_feature_device() [all …]
|
/linux/drivers/usb/gadget/function/ |
H A D | f_obex.c | 198 dev_dbg(&cdev->gadget->dev, in obex_set_alt() 206 dev_dbg(&cdev->gadget->dev, in obex_set_alt() 212 dev_dbg(&cdev->gadget->dev, in obex_set_alt() 214 if (config_ep_by_speed(cdev->gadget, f, in obex_set_alt() 216 config_ep_by_speed(cdev->gadget, f, in obex_set_alt() 225 dev_dbg(&cdev->gadget->dev, in obex_set_alt() 253 dev_dbg(&cdev->gadget->dev, "obex ttyGS%d disable\n", obex->port_num); in obex_disable() 267 dev_dbg(&cdev->gadget->dev, in obex_connect() 280 dev_dbg(&cdev->gadget->dev, in obex_disconnect() 295 if (!gadget_is_altset_supported(c->cdev->gadget)) in can_support_obex() [all …]
|
/linux/drivers/usb/chipidea/ |
H A D | debug.c | 27 struct usb_gadget *gadget = &ci->gadget; in ci_device_show() local 29 seq_printf(s, "speed = %d\n", gadget->speed); in ci_device_show() 30 seq_printf(s, "max_speed = %d\n", gadget->max_speed); in ci_device_show() 31 seq_printf(s, "is_otg = %d\n", gadget->is_otg); in ci_device_show() 32 seq_printf(s, "is_a_peripheral = %d\n", gadget->is_a_peripheral); in ci_device_show() 33 seq_printf(s, "b_hnp_enable = %d\n", gadget->b_hnp_enable); in ci_device_show() 34 seq_printf(s, "a_hnp_support = %d\n", gadget->a_hnp_support); in ci_device_show() 35 seq_printf(s, "a_alt_hnp_support = %d\n", gadget->a_alt_hnp_support); in ci_device_show() 37 (gadget->name ? gadget->name : "")); in ci_device_show()
|
/linux/drivers/usb/gadget/udc/ |
H A D | max3420_udc.c | 168 struct usb_gadget gadget; member 187 #define to_udc(g) container_of((g), struct max3420_udc, gadget) 505 usb_udc_vbus_handler(&udc->gadget, udc->vbus_active); in max3420_vbus_handler() 506 usb_gadget_set_state(&udc->gadget, udc->vbus_active in max3420_vbus_handler() 543 status = udc->gadget.is_selfpowered << USB_DEVICE_SELF_POWERED; in max3420_getstatus() 547 if (udc->driver->setup(&udc->gadget, &udc->setup) < 0) in max3420_getstatus() 659 if (udc->driver->setup(&udc->gadget, &setup) < 0) { in max3420_handle_setup() 1080 static int max3420_wakeup(struct usb_gadget *gadget) in max3420_wakeup() argument 1082 struct max3420_udc *udc = to_udc(gadget); in max3420_wakeup() 1101 static int max3420_udc_start(struct usb_gadget *gadget, in max3420_udc_start() argument [all …]
|