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