17010f5b9SLukasz Majewski /* 27010f5b9SLukasz Majewski * composite.h -- framework for usb gadgets which are composite devices 37010f5b9SLukasz Majewski * 47010f5b9SLukasz Majewski * Copyright (C) 2006-2008 David Brownell 57010f5b9SLukasz Majewski * 67010f5b9SLukasz Majewski * This program is free software; you can redistribute it and/or modify 77010f5b9SLukasz Majewski * it under the terms of the GNU General Public License as published by 87010f5b9SLukasz Majewski * the Free Software Foundation; either version 2 of the License, or 97010f5b9SLukasz Majewski * (at your option) any later version. 107010f5b9SLukasz Majewski * 117010f5b9SLukasz Majewski * This program is distributed in the hope that it will be useful, 127010f5b9SLukasz Majewski * but WITHOUT ANY WARRANTY; without even the implied warranty of 137010f5b9SLukasz Majewski * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 147010f5b9SLukasz Majewski * GNU General Public License for more details. 157010f5b9SLukasz Majewski * 167010f5b9SLukasz Majewski * You should have received a copy of the GNU General Public License 177010f5b9SLukasz Majewski * along with this program; if not, write to the Free Software 187010f5b9SLukasz Majewski * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 197010f5b9SLukasz Majewski */ 207010f5b9SLukasz Majewski 217010f5b9SLukasz Majewski #ifndef __LINUX_USB_COMPOSITE_H 227010f5b9SLukasz Majewski #define __LINUX_USB_COMPOSITE_H 237010f5b9SLukasz Majewski 247010f5b9SLukasz Majewski /* 257010f5b9SLukasz Majewski * This framework is an optional layer on top of the USB Gadget interface, 267010f5b9SLukasz Majewski * making it easier to build (a) Composite devices, supporting multiple 277010f5b9SLukasz Majewski * functions within any single configuration, and (b) Multi-configuration 287010f5b9SLukasz Majewski * devices, also supporting multiple functions but without necessarily 297010f5b9SLukasz Majewski * having more than one function per configuration. 307010f5b9SLukasz Majewski * 317010f5b9SLukasz Majewski * Example: a device with a single configuration supporting both network 327010f5b9SLukasz Majewski * link and mass storage functions is a composite device. Those functions 337010f5b9SLukasz Majewski * might alternatively be packaged in individual configurations, but in 347010f5b9SLukasz Majewski * the composite model the host can use both functions at the same time. 357010f5b9SLukasz Majewski */ 367010f5b9SLukasz Majewski 377010f5b9SLukasz Majewski #include <common.h> 387010f5b9SLukasz Majewski #include <linux/usb/ch9.h> 397010f5b9SLukasz Majewski #include <linux/usb/gadget.h> 407010f5b9SLukasz Majewski #include <usb/lin_gadget_compat.h> 417010f5b9SLukasz Majewski 427010f5b9SLukasz Majewski struct usb_configuration; 437010f5b9SLukasz Majewski 447010f5b9SLukasz Majewski /** 457010f5b9SLukasz Majewski * struct usb_function - describes one function of a configuration 467010f5b9SLukasz Majewski * @name: For diagnostics, identifies the function. 477010f5b9SLukasz Majewski * @strings: tables of strings, keyed by identifiers assigned during bind() 487010f5b9SLukasz Majewski * and by language IDs provided in control requests 497010f5b9SLukasz Majewski * @descriptors: Table of full (or low) speed descriptors, using interface and 507010f5b9SLukasz Majewski * string identifiers assigned during @bind(). If this pointer is null, 517010f5b9SLukasz Majewski * the function will not be available at full speed (or at low speed). 527010f5b9SLukasz Majewski * @hs_descriptors: Table of high speed descriptors, using interface and 537010f5b9SLukasz Majewski * string identifiers assigned during @bind(). If this pointer is null, 547010f5b9SLukasz Majewski * the function will not be available at high speed. 557010f5b9SLukasz Majewski * @config: assigned when @usb_add_function() is called; this is the 567010f5b9SLukasz Majewski * configuration with which this function is associated. 577010f5b9SLukasz Majewski * @bind: Before the gadget can register, all of its functions bind() to the 587010f5b9SLukasz Majewski * available resources including string and interface identifiers used 597010f5b9SLukasz Majewski * in interface or class descriptors; endpoints; I/O buffers; and so on. 607010f5b9SLukasz Majewski * @unbind: Reverses @bind; called as a side effect of unregistering the 617010f5b9SLukasz Majewski * driver which added this function. 627010f5b9SLukasz Majewski * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may 637010f5b9SLukasz Majewski * initialize usb_ep.driver data at this time (when it is used). 647010f5b9SLukasz Majewski * Note that setting an interface to its current altsetting resets 657010f5b9SLukasz Majewski * interface state, and that all interfaces have a disabled state. 667010f5b9SLukasz Majewski * @get_alt: Returns the active altsetting. If this is not provided, 677010f5b9SLukasz Majewski * then only altsetting zero is supported. 687010f5b9SLukasz Majewski * @disable: (REQUIRED) Indicates the function should be disabled. Reasons 697010f5b9SLukasz Majewski * include host resetting or reconfiguring the gadget, and disconnection. 707010f5b9SLukasz Majewski * @setup: Used for interface-specific control requests. 717010f5b9SLukasz Majewski * @suspend: Notifies functions when the host stops sending USB traffic. 727010f5b9SLukasz Majewski * @resume: Notifies functions when the host restarts USB traffic. 737010f5b9SLukasz Majewski * 747010f5b9SLukasz Majewski * A single USB function uses one or more interfaces, and should in most 757010f5b9SLukasz Majewski * cases support operation at both full and high speeds. Each function is 767010f5b9SLukasz Majewski * associated by @usb_add_function() with a one configuration; that function 777010f5b9SLukasz Majewski * causes @bind() to be called so resources can be allocated as part of 787010f5b9SLukasz Majewski * setting up a gadget driver. Those resources include endpoints, which 797010f5b9SLukasz Majewski * should be allocated using @usb_ep_autoconfig(). 807010f5b9SLukasz Majewski * 817010f5b9SLukasz Majewski * To support dual speed operation, a function driver provides descriptors 827010f5b9SLukasz Majewski * for both high and full speed operation. Except in rare cases that don't 837010f5b9SLukasz Majewski * involve bulk endpoints, each speed needs different endpoint descriptors. 847010f5b9SLukasz Majewski * 857010f5b9SLukasz Majewski * Function drivers choose their own strategies for managing instance data. 867010f5b9SLukasz Majewski * The simplest strategy just declares it "static', which means the function 877010f5b9SLukasz Majewski * can only be activated once. If the function needs to be exposed in more 887010f5b9SLukasz Majewski * than one configuration at a given speed, it needs to support multiple 897010f5b9SLukasz Majewski * usb_function structures (one for each configuration). 907010f5b9SLukasz Majewski * 917010f5b9SLukasz Majewski * A more complex strategy might encapsulate a @usb_function structure inside 927010f5b9SLukasz Majewski * a driver-specific instance structure to allows multiple activations. An 937010f5b9SLukasz Majewski * example of multiple activations might be a CDC ACM function that supports 947010f5b9SLukasz Majewski * two or more distinct instances within the same configuration, providing 957010f5b9SLukasz Majewski * several independent logical data links to a USB host. 967010f5b9SLukasz Majewski */ 977010f5b9SLukasz Majewski struct usb_function { 987010f5b9SLukasz Majewski const char *name; 997010f5b9SLukasz Majewski struct usb_gadget_strings **strings; 1007010f5b9SLukasz Majewski struct usb_descriptor_header **descriptors; 1017010f5b9SLukasz Majewski struct usb_descriptor_header **hs_descriptors; 1027010f5b9SLukasz Majewski 1037010f5b9SLukasz Majewski struct usb_configuration *config; 1047010f5b9SLukasz Majewski 1057010f5b9SLukasz Majewski /* REVISIT: bind() functions can be marked __init, which 1067010f5b9SLukasz Majewski * makes trouble for section mismatch analysis. See if 1077010f5b9SLukasz Majewski * we can't restructure things to avoid mismatching. 1087010f5b9SLukasz Majewski * Related: unbind() may kfree() but bind() won't... 1097010f5b9SLukasz Majewski */ 1107010f5b9SLukasz Majewski 1117010f5b9SLukasz Majewski /* configuration management: bind/unbind */ 1127010f5b9SLukasz Majewski int (*bind)(struct usb_configuration *, 1137010f5b9SLukasz Majewski struct usb_function *); 1147010f5b9SLukasz Majewski void (*unbind)(struct usb_configuration *, 1157010f5b9SLukasz Majewski struct usb_function *); 1167010f5b9SLukasz Majewski 1177010f5b9SLukasz Majewski /* runtime state management */ 1187010f5b9SLukasz Majewski int (*set_alt)(struct usb_function *, 1197010f5b9SLukasz Majewski unsigned interface, unsigned alt); 1207010f5b9SLukasz Majewski int (*get_alt)(struct usb_function *, 1217010f5b9SLukasz Majewski unsigned interface); 1227010f5b9SLukasz Majewski void (*disable)(struct usb_function *); 1237010f5b9SLukasz Majewski int (*setup)(struct usb_function *, 1247010f5b9SLukasz Majewski const struct usb_ctrlrequest *); 1257010f5b9SLukasz Majewski void (*suspend)(struct usb_function *); 1267010f5b9SLukasz Majewski void (*resume)(struct usb_function *); 1277010f5b9SLukasz Majewski 1287010f5b9SLukasz Majewski /* private: */ 1297010f5b9SLukasz Majewski /* internals */ 1307010f5b9SLukasz Majewski struct list_head list; 1317010f5b9SLukasz Majewski DECLARE_BITMAP(endpoints, 32); 1327010f5b9SLukasz Majewski }; 1337010f5b9SLukasz Majewski 1347010f5b9SLukasz Majewski int usb_add_function(struct usb_configuration *, struct usb_function *); 1357010f5b9SLukasz Majewski 1367010f5b9SLukasz Majewski int usb_function_deactivate(struct usb_function *); 1377010f5b9SLukasz Majewski int usb_function_activate(struct usb_function *); 1387010f5b9SLukasz Majewski 1397010f5b9SLukasz Majewski int usb_interface_id(struct usb_configuration *, struct usb_function *); 1407010f5b9SLukasz Majewski 1417010f5b9SLukasz Majewski /** 1427010f5b9SLukasz Majewski * ep_choose - select descriptor endpoint at current device speed 1437010f5b9SLukasz Majewski * @g: gadget, connected and running at some speed 1447010f5b9SLukasz Majewski * @hs: descriptor to use for high speed operation 1457010f5b9SLukasz Majewski * @fs: descriptor to use for full or low speed operation 1467010f5b9SLukasz Majewski */ 1477010f5b9SLukasz Majewski static inline struct usb_endpoint_descriptor * 1487010f5b9SLukasz Majewski ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, 1497010f5b9SLukasz Majewski struct usb_endpoint_descriptor *fs) 1507010f5b9SLukasz Majewski { 1517010f5b9SLukasz Majewski if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) 1527010f5b9SLukasz Majewski return hs; 1537010f5b9SLukasz Majewski return fs; 1547010f5b9SLukasz Majewski } 1557010f5b9SLukasz Majewski 1567010f5b9SLukasz Majewski #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ 1577010f5b9SLukasz Majewski 1587010f5b9SLukasz Majewski /** 1597010f5b9SLukasz Majewski * struct usb_configuration - represents one gadget configuration 1607010f5b9SLukasz Majewski * @label: For diagnostics, describes the configuration. 1617010f5b9SLukasz Majewski * @strings: Tables of strings, keyed by identifiers assigned during @bind() 1627010f5b9SLukasz Majewski * and by language IDs provided in control requests. 1637010f5b9SLukasz Majewski * @descriptors: Table of descriptors preceding all function descriptors. 1647010f5b9SLukasz Majewski * Examples include OTG and vendor-specific descriptors. 1657010f5b9SLukasz Majewski * @bind: Called from @usb_add_config() to allocate resources unique to this 1667010f5b9SLukasz Majewski * configuration and to call @usb_add_function() for each function used. 1677010f5b9SLukasz Majewski * @unbind: Reverses @bind; called as a side effect of unregistering the 1687010f5b9SLukasz Majewski * driver which added this configuration. 1697010f5b9SLukasz Majewski * @setup: Used to delegate control requests that aren't handled by standard 1707010f5b9SLukasz Majewski * device infrastructure or directed at a specific interface. 1717010f5b9SLukasz Majewski * @bConfigurationValue: Copied into configuration descriptor. 1727010f5b9SLukasz Majewski * @iConfiguration: Copied into configuration descriptor. 1737010f5b9SLukasz Majewski * @bmAttributes: Copied into configuration descriptor. 1747010f5b9SLukasz Majewski * @bMaxPower: Copied into configuration descriptor. 1757010f5b9SLukasz Majewski * @cdev: assigned by @usb_add_config() before calling @bind(); this is 1767010f5b9SLukasz Majewski * the device associated with this configuration. 1777010f5b9SLukasz Majewski * 1787010f5b9SLukasz Majewski * Configurations are building blocks for gadget drivers structured around 1797010f5b9SLukasz Majewski * function drivers. Simple USB gadgets require only one function and one 1807010f5b9SLukasz Majewski * configuration, and handle dual-speed hardware by always providing the same 1817010f5b9SLukasz Majewski * functionality. Slightly more complex gadgets may have more than one 1827010f5b9SLukasz Majewski * single-function configuration at a given speed; or have configurations 1837010f5b9SLukasz Majewski * that only work at one speed. 1847010f5b9SLukasz Majewski * 1857010f5b9SLukasz Majewski * Composite devices are, by definition, ones with configurations which 1867010f5b9SLukasz Majewski * include more than one function. 1877010f5b9SLukasz Majewski * 1887010f5b9SLukasz Majewski * The lifecycle of a usb_configuration includes allocation, initialization 1897010f5b9SLukasz Majewski * of the fields described above, and calling @usb_add_config() to set up 1907010f5b9SLukasz Majewski * internal data and bind it to a specific device. The configuration's 1917010f5b9SLukasz Majewski * @bind() method is then used to initialize all the functions and then 1927010f5b9SLukasz Majewski * call @usb_add_function() for them. 1937010f5b9SLukasz Majewski * 1947010f5b9SLukasz Majewski * Those functions would normally be independant of each other, but that's 1957010f5b9SLukasz Majewski * not mandatory. CDC WMC devices are an example where functions often 1967010f5b9SLukasz Majewski * depend on other functions, with some functions subsidiary to others. 1977010f5b9SLukasz Majewski * Such interdependency may be managed in any way, so long as all of the 1987010f5b9SLukasz Majewski * descriptors complete by the time the composite driver returns from 1997010f5b9SLukasz Majewski * its bind() routine. 2007010f5b9SLukasz Majewski */ 2017010f5b9SLukasz Majewski struct usb_configuration { 2027010f5b9SLukasz Majewski const char *label; 2037010f5b9SLukasz Majewski struct usb_gadget_strings **strings; 2047010f5b9SLukasz Majewski const struct usb_descriptor_header **descriptors; 2057010f5b9SLukasz Majewski 2067010f5b9SLukasz Majewski /* REVISIT: bind() functions can be marked __init, which 2077010f5b9SLukasz Majewski * makes trouble for section mismatch analysis. See if 2087010f5b9SLukasz Majewski * we can't restructure things to avoid mismatching... 2097010f5b9SLukasz Majewski */ 2107010f5b9SLukasz Majewski 2117010f5b9SLukasz Majewski /* configuration management: bind/unbind */ 2127010f5b9SLukasz Majewski int (*bind)(struct usb_configuration *); 2137010f5b9SLukasz Majewski void (*unbind)(struct usb_configuration *); 2147010f5b9SLukasz Majewski int (*setup)(struct usb_configuration *, 2157010f5b9SLukasz Majewski const struct usb_ctrlrequest *); 2167010f5b9SLukasz Majewski 2177010f5b9SLukasz Majewski /* fields in the config descriptor */ 2187010f5b9SLukasz Majewski u8 bConfigurationValue; 2197010f5b9SLukasz Majewski u8 iConfiguration; 2207010f5b9SLukasz Majewski u8 bmAttributes; 2217010f5b9SLukasz Majewski u8 bMaxPower; 2227010f5b9SLukasz Majewski 2237010f5b9SLukasz Majewski struct usb_composite_dev *cdev; 2247010f5b9SLukasz Majewski 2257010f5b9SLukasz Majewski /* private: */ 2267010f5b9SLukasz Majewski /* internals */ 2277010f5b9SLukasz Majewski struct list_head list; 2287010f5b9SLukasz Majewski struct list_head functions; 2297010f5b9SLukasz Majewski u8 next_interface_id; 2307010f5b9SLukasz Majewski unsigned highspeed:1; 2317010f5b9SLukasz Majewski unsigned fullspeed:1; 2327010f5b9SLukasz Majewski struct usb_function *interface[MAX_CONFIG_INTERFACES]; 2337010f5b9SLukasz Majewski }; 2347010f5b9SLukasz Majewski 2357010f5b9SLukasz Majewski int usb_add_config(struct usb_composite_dev *, 2367010f5b9SLukasz Majewski struct usb_configuration *); 2377010f5b9SLukasz Majewski 2387010f5b9SLukasz Majewski /** 2397010f5b9SLukasz Majewski * struct usb_composite_driver - groups configurations into a gadget 2407010f5b9SLukasz Majewski * @name: For diagnostics, identifies the driver. 2417010f5b9SLukasz Majewski * @dev: Template descriptor for the device, including default device 2427010f5b9SLukasz Majewski * identifiers. 2437010f5b9SLukasz Majewski * @strings: tables of strings, keyed by identifiers assigned during bind() 2447010f5b9SLukasz Majewski * and language IDs provided in control requests 2457010f5b9SLukasz Majewski * @bind: (REQUIRED) Used to allocate resources that are shared across the 2467010f5b9SLukasz Majewski * whole device, such as string IDs, and add its configurations using 2477010f5b9SLukasz Majewski * @usb_add_config(). This may fail by returning a negative errno 2487010f5b9SLukasz Majewski * value; it should return zero on successful initialization. 2497010f5b9SLukasz Majewski * @unbind: Reverses @bind(); called as a side effect of unregistering 2507010f5b9SLukasz Majewski * this driver. 2517010f5b9SLukasz Majewski * @disconnect: optional driver disconnect method 2527010f5b9SLukasz Majewski * @suspend: Notifies when the host stops sending USB traffic, 2537010f5b9SLukasz Majewski * after function notifications 2547010f5b9SLukasz Majewski * @resume: Notifies configuration when the host restarts USB traffic, 2557010f5b9SLukasz Majewski * before function notifications 2567010f5b9SLukasz Majewski * 2577010f5b9SLukasz Majewski * Devices default to reporting self powered operation. Devices which rely 2587010f5b9SLukasz Majewski * on bus powered operation should report this in their @bind() method. 2597010f5b9SLukasz Majewski * 2607010f5b9SLukasz Majewski * Before returning from @bind, various fields in the template descriptor 2617010f5b9SLukasz Majewski * may be overridden. These include the idVendor/idProduct/bcdDevice values 2627010f5b9SLukasz Majewski * normally to bind the appropriate host side driver, and the three strings 2637010f5b9SLukasz Majewski * (iManufacturer, iProduct, iSerialNumber) normally used to provide user 2647010f5b9SLukasz Majewski * meaningful device identifiers. (The strings will not be defined unless 2657010f5b9SLukasz Majewski * they are defined in @dev and @strings.) The correct ep0 maxpacket size 2667010f5b9SLukasz Majewski * is also reported, as defined by the underlying controller driver. 2677010f5b9SLukasz Majewski */ 2687010f5b9SLukasz Majewski struct usb_composite_driver { 2697010f5b9SLukasz Majewski const char *name; 2707010f5b9SLukasz Majewski const struct usb_device_descriptor *dev; 2717010f5b9SLukasz Majewski struct usb_gadget_strings **strings; 2727010f5b9SLukasz Majewski 2737010f5b9SLukasz Majewski /* REVISIT: bind() functions can be marked __init, which 2747010f5b9SLukasz Majewski * makes trouble for section mismatch analysis. See if 2757010f5b9SLukasz Majewski * we can't restructure things to avoid mismatching... 2767010f5b9SLukasz Majewski */ 2777010f5b9SLukasz Majewski 2787010f5b9SLukasz Majewski int (*bind)(struct usb_composite_dev *); 2797010f5b9SLukasz Majewski int (*unbind)(struct usb_composite_dev *); 2807010f5b9SLukasz Majewski 2817010f5b9SLukasz Majewski void (*disconnect)(struct usb_composite_dev *); 2827010f5b9SLukasz Majewski 2837010f5b9SLukasz Majewski /* global suspend hooks */ 2847010f5b9SLukasz Majewski void (*suspend)(struct usb_composite_dev *); 2857010f5b9SLukasz Majewski void (*resume)(struct usb_composite_dev *); 2867010f5b9SLukasz Majewski }; 2877010f5b9SLukasz Majewski 2887010f5b9SLukasz Majewski extern int usb_composite_register(struct usb_composite_driver *); 2897010f5b9SLukasz Majewski extern void usb_composite_unregister(struct usb_composite_driver *); 2907010f5b9SLukasz Majewski 2917010f5b9SLukasz Majewski 2927010f5b9SLukasz Majewski /** 2937010f5b9SLukasz Majewski * struct usb_composite_device - represents one composite usb gadget 2947010f5b9SLukasz Majewski * @gadget: read-only, abstracts the gadget's usb peripheral controller 2957010f5b9SLukasz Majewski * @req: used for control responses; buffer is pre-allocated 2967010f5b9SLukasz Majewski * @bufsiz: size of buffer pre-allocated in @req 2977010f5b9SLukasz Majewski * @config: the currently active configuration 2987010f5b9SLukasz Majewski * 2997010f5b9SLukasz Majewski * One of these devices is allocated and initialized before the 3007010f5b9SLukasz Majewski * associated device driver's bind() is called. 3017010f5b9SLukasz Majewski * 3027010f5b9SLukasz Majewski * OPEN ISSUE: it appears that some WUSB devices will need to be 3037010f5b9SLukasz Majewski * built by combining a normal (wired) gadget with a wireless one. 3047010f5b9SLukasz Majewski * This revision of the gadget framework should probably try to make 3057010f5b9SLukasz Majewski * sure doing that won't hurt too much. 3067010f5b9SLukasz Majewski * 3077010f5b9SLukasz Majewski * One notion for how to handle Wireless USB devices involves: 3087010f5b9SLukasz Majewski * (a) a second gadget here, discovery mechanism TBD, but likely 3097010f5b9SLukasz Majewski * needing separate "register/unregister WUSB gadget" calls; 3107010f5b9SLukasz Majewski * (b) updates to usb_gadget to include flags "is it wireless", 3117010f5b9SLukasz Majewski * "is it wired", plus (presumably in a wrapper structure) 3127010f5b9SLukasz Majewski * bandgroup and PHY info; 3137010f5b9SLukasz Majewski * (c) presumably a wireless_ep wrapping a usb_ep, and reporting 3147010f5b9SLukasz Majewski * wireless-specific parameters like maxburst and maxsequence; 3157010f5b9SLukasz Majewski * (d) configurations that are specific to wireless links; 3167010f5b9SLukasz Majewski * (e) function drivers that understand wireless configs and will 3177010f5b9SLukasz Majewski * support wireless for (additional) function instances; 3187010f5b9SLukasz Majewski * (f) a function to support association setup (like CBAF), not 3197010f5b9SLukasz Majewski * necessarily requiring a wireless adapter; 3207010f5b9SLukasz Majewski * (g) composite device setup that can create one or more wireless 3217010f5b9SLukasz Majewski * configs, including appropriate association setup support; 3227010f5b9SLukasz Majewski * (h) more, TBD. 3237010f5b9SLukasz Majewski */ 3247010f5b9SLukasz Majewski struct usb_composite_dev { 3257010f5b9SLukasz Majewski struct usb_gadget *gadget; 3267010f5b9SLukasz Majewski struct usb_request *req; 3277010f5b9SLukasz Majewski unsigned bufsiz; 3287010f5b9SLukasz Majewski 3297010f5b9SLukasz Majewski struct usb_configuration *config; 3307010f5b9SLukasz Majewski 3317010f5b9SLukasz Majewski /* private: */ 3327010f5b9SLukasz Majewski /* internals */ 3337010f5b9SLukasz Majewski unsigned int suspended:1; 334*b37c4a2bSHeiko Schocher struct usb_device_descriptor __aligned(CONFIG_SYS_CACHELINE_SIZE) desc; 3357010f5b9SLukasz Majewski struct list_head configs; 3367010f5b9SLukasz Majewski struct usb_composite_driver *driver; 3377010f5b9SLukasz Majewski u8 next_string_id; 3387010f5b9SLukasz Majewski 3397010f5b9SLukasz Majewski /* the gadget driver won't enable the data pullup 3407010f5b9SLukasz Majewski * while the deactivation count is nonzero. 3417010f5b9SLukasz Majewski */ 3427010f5b9SLukasz Majewski unsigned deactivations; 3437010f5b9SLukasz Majewski }; 3447010f5b9SLukasz Majewski 3457010f5b9SLukasz Majewski extern int usb_string_id(struct usb_composite_dev *c); 3467010f5b9SLukasz Majewski extern int usb_string_ids_tab(struct usb_composite_dev *c, 3477010f5b9SLukasz Majewski struct usb_string *str); 3487010f5b9SLukasz Majewski extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 3497010f5b9SLukasz Majewski 3507010f5b9SLukasz Majewski #endif /* __LINUX_USB_COMPOSITE_H */ 351