usb: gadget: add max_speed to usb_composite_driver
authorTatyana Brokhman <tlinder@codeaurora.org>
Wed, 29 Jun 2011 13:41:49 +0000 (16:41 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Jul 2011 21:27:05 +0000 (14:27 -0700)
This field is used by the Gadget drivers to specify
the maximum speed they support, meaning: the maximum
speed they can provide descriptors for.

The driver speed will be set in consideration of this
value.

[ balbi@ti.com : dropped the ifdeffery ]

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 files changed:
drivers/usb/gadget/audio.c
drivers/usb/gadget/cdc2.c
drivers/usb/gadget/composite.c
drivers/usb/gadget/ether.c
drivers/usb/gadget/g_ffs.c
drivers/usb/gadget/hid.c
drivers/usb/gadget/mass_storage.c
drivers/usb/gadget/multi.c
drivers/usb/gadget/ncm.c
drivers/usb/gadget/nokia.c
drivers/usb/gadget/serial.c
drivers/usb/gadget/webcam.c
drivers/usb/gadget/zero.c
include/linux/usb/composite.h

index 93b999e49ef39559e1dab1bb3d3abfe2e2b33b59..9d89ae4765a92c867410601cd3d89c445c96175e 100644 (file)
@@ -165,6 +165,7 @@ static struct usb_composite_driver audio_driver = {
        .name           = "g_audio",
        .dev            = &device_desc,
        .strings        = audio_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(audio_unbind),
 };
 
index 2720ab07ef1a4da3fd1ca2c45ebe61d677aee788..b1c1afbb8750538bb28129a0b22701b7600350bb 100644 (file)
@@ -244,6 +244,7 @@ static struct usb_composite_driver cdc_driver = {
        .name           = "g_cdc",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(cdc_unbind),
 };
 
index ed8a70f271f4f59d68cceb0ed2211384f08301ff..897e4f57422f66befc0ccf2df8193eb6061d53d4 100644 (file)
@@ -1386,6 +1386,8 @@ int usb_composite_probe(struct usb_composite_driver *driver,
                driver->iProduct = driver->name;
        composite_driver.function =  (char *) driver->name;
        composite_driver.driver.name = driver->name;
+       composite_driver.speed = min((u8)composite_driver.speed,
+                                    (u8)driver->max_speed);
        composite = driver;
        composite_gadget_bind = bind;
 
index 1690c9d68256c167cba61a5f5fb1c796e279e1b1..ac41858800a5376c21b39341ba01f3df0b79d654 100644 (file)
@@ -401,6 +401,7 @@ static struct usb_composite_driver eth_driver = {
        .name           = "g_ether",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(eth_unbind),
 };
 
index ebf6970a10bfab256aee796cf052edd15b2b73a1..704c2800ac003ca8ecd4f372e0b534c7273398c0 100644 (file)
@@ -162,6 +162,7 @@ static struct usb_composite_driver gfs_driver = {
        .name           = DRIVER_NAME,
        .dev            = &gfs_dev_desc,
        .strings        = gfs_dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = gfs_unbind,
        .iProduct       = DRIVER_DESC,
 };
index 2523e54097bd3529dce275c9a8ef1f0cebff57c9..9fb575034a0e82e1659553bdde7abf89889f61ce 100644 (file)
@@ -255,6 +255,7 @@ static struct usb_composite_driver hidg_driver = {
        .name           = "g_hid",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(hid_unbind),
 };
 
index 01822422c3e89b4e786524aa696c66135b205396..d3eb27427c5813590012cfabc180ace15b7025cb 100644 (file)
@@ -169,6 +169,7 @@ static struct usb_composite_driver msg_driver = {
        .name           = "g_mass_storage",
        .dev            = &msg_device_desc,
        .iProduct       = DRIVER_DESC,
+       .max_speed      = USB_SPEED_HIGH,
        .needs_serial   = 1,
 };
 
index d9feced348e3a2a74c508452257e12870dcf3762..8c7b74717d851295b44ed3e5f46ac5f510630461 100644 (file)
@@ -351,6 +351,7 @@ static struct usb_composite_driver multi_driver = {
        .name           = "g_multi",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(multi_unbind),
        .iProduct       = DRIVER_DESC,
        .needs_serial   = 1,
index 99c179ad729daa0892d51b35f842adb5b0f815e3..62ee5087dcac5dde17b4d0b67c2db009eb55e460 100644 (file)
@@ -228,6 +228,7 @@ static struct usb_composite_driver ncm_driver = {
        .name           = "g_ncm",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(gncm_unbind),
 };
 
index 55ca63ad350630b6506cef326f7b734d8cb4717a..c7fb7723c014e8491841a531f48c705de21b14ea 100644 (file)
@@ -241,6 +241,7 @@ static struct usb_composite_driver nokia_driver = {
        .name           = "g_nokia",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = __exit_p(nokia_unbind),
 };
 
index 1ac57a973aa9f5a339fc73ee7536dbaf2611aaab..ed1b816e58d86291ecd81e6163f9c7bf5a3409d0 100644 (file)
@@ -242,6 +242,7 @@ static struct usb_composite_driver gserial_driver = {
        .name           = "g_serial",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
 };
 
 static int __init init(void)
index a5a0fdb808c7d9ab15f336ca92537416f267183c..df6882de50bf394e8eaa0fdd68cddbb6aee8ce38 100644 (file)
@@ -373,6 +373,7 @@ static struct usb_composite_driver webcam_driver = {
        .name           = "g_webcam",
        .dev            = &webcam_device_descriptor,
        .strings        = webcam_device_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = webcam_unbind,
 };
 
index 6d16db9d9d2dd078a589adacabb04696dd938db4..af7e7c3818d8b8588ce2909ec58d28b2c647fb98 100644 (file)
@@ -340,6 +340,7 @@ static struct usb_composite_driver zero_driver = {
        .name           = "zero",
        .dev            = &device_desc,
        .strings        = dev_strings,
+       .max_speed      = USB_SPEED_HIGH,
        .unbind         = zero_unbind,
        .suspend        = zero_suspend,
        .resume         = zero_resume,
index 99830d63d8f1d2f06d82f2cbdbb8a6a2fa7af66f..a3e72dfa69961be39d1ce70bccd6d458c1d984c6 100644 (file)
@@ -240,6 +240,7 @@ int usb_add_config(struct usb_composite_dev *,
  *     identifiers.
  * @strings: tables of strings, keyed by identifiers assigned during bind()
  *     and language IDs provided in control requests
+ * @max_speed: Highest speed the driver supports.
  * @needs_serial: set to 1 if the gadget needs userspace to provide
  *     a serial number.  If one is not provided, warning will be printed.
  * @unbind: Reverses bind; called as a side effect of unregistering
@@ -267,6 +268,7 @@ struct usb_composite_driver {
        const char                              *iManufacturer;
        const struct usb_device_descriptor      *dev;
        struct usb_gadget_strings               **strings;
+       enum usb_device_speed                   max_speed;
        unsigned                needs_serial:1;
 
        int                     (*unbind)(struct usb_composite_dev *);