Commit 35a0e0bf authored by Tatyana Brokhman's avatar Tatyana Brokhman Committed by Greg Kroah-Hartman

usb: gadget: add max_speed to usb_composite_driver

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: default avatarTatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9ea35331
...@@ -165,6 +165,7 @@ static struct usb_composite_driver audio_driver = { ...@@ -165,6 +165,7 @@ static struct usb_composite_driver audio_driver = {
.name = "g_audio", .name = "g_audio",
.dev = &device_desc, .dev = &device_desc,
.strings = audio_strings, .strings = audio_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(audio_unbind), .unbind = __exit_p(audio_unbind),
}; };
......
...@@ -244,6 +244,7 @@ static struct usb_composite_driver cdc_driver = { ...@@ -244,6 +244,7 @@ static struct usb_composite_driver cdc_driver = {
.name = "g_cdc", .name = "g_cdc",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(cdc_unbind), .unbind = __exit_p(cdc_unbind),
}; };
......
...@@ -1386,6 +1386,8 @@ int usb_composite_probe(struct usb_composite_driver *driver, ...@@ -1386,6 +1386,8 @@ int usb_composite_probe(struct usb_composite_driver *driver,
driver->iProduct = driver->name; driver->iProduct = driver->name;
composite_driver.function = (char *) driver->name; composite_driver.function = (char *) driver->name;
composite_driver.driver.name = driver->name; composite_driver.driver.name = driver->name;
composite_driver.speed = min((u8)composite_driver.speed,
(u8)driver->max_speed);
composite = driver; composite = driver;
composite_gadget_bind = bind; composite_gadget_bind = bind;
......
...@@ -401,6 +401,7 @@ static struct usb_composite_driver eth_driver = { ...@@ -401,6 +401,7 @@ static struct usb_composite_driver eth_driver = {
.name = "g_ether", .name = "g_ether",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(eth_unbind), .unbind = __exit_p(eth_unbind),
}; };
......
...@@ -162,6 +162,7 @@ static struct usb_composite_driver gfs_driver = { ...@@ -162,6 +162,7 @@ static struct usb_composite_driver gfs_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.dev = &gfs_dev_desc, .dev = &gfs_dev_desc,
.strings = gfs_dev_strings, .strings = gfs_dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = gfs_unbind, .unbind = gfs_unbind,
.iProduct = DRIVER_DESC, .iProduct = DRIVER_DESC,
}; };
......
...@@ -255,6 +255,7 @@ static struct usb_composite_driver hidg_driver = { ...@@ -255,6 +255,7 @@ static struct usb_composite_driver hidg_driver = {
.name = "g_hid", .name = "g_hid",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(hid_unbind), .unbind = __exit_p(hid_unbind),
}; };
......
...@@ -169,6 +169,7 @@ static struct usb_composite_driver msg_driver = { ...@@ -169,6 +169,7 @@ static struct usb_composite_driver msg_driver = {
.name = "g_mass_storage", .name = "g_mass_storage",
.dev = &msg_device_desc, .dev = &msg_device_desc,
.iProduct = DRIVER_DESC, .iProduct = DRIVER_DESC,
.max_speed = USB_SPEED_HIGH,
.needs_serial = 1, .needs_serial = 1,
}; };
......
...@@ -351,6 +351,7 @@ static struct usb_composite_driver multi_driver = { ...@@ -351,6 +351,7 @@ static struct usb_composite_driver multi_driver = {
.name = "g_multi", .name = "g_multi",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(multi_unbind), .unbind = __exit_p(multi_unbind),
.iProduct = DRIVER_DESC, .iProduct = DRIVER_DESC,
.needs_serial = 1, .needs_serial = 1,
......
...@@ -228,6 +228,7 @@ static struct usb_composite_driver ncm_driver = { ...@@ -228,6 +228,7 @@ static struct usb_composite_driver ncm_driver = {
.name = "g_ncm", .name = "g_ncm",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(gncm_unbind), .unbind = __exit_p(gncm_unbind),
}; };
......
...@@ -241,6 +241,7 @@ static struct usb_composite_driver nokia_driver = { ...@@ -241,6 +241,7 @@ static struct usb_composite_driver nokia_driver = {
.name = "g_nokia", .name = "g_nokia",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(nokia_unbind), .unbind = __exit_p(nokia_unbind),
}; };
......
...@@ -242,6 +242,7 @@ static struct usb_composite_driver gserial_driver = { ...@@ -242,6 +242,7 @@ static struct usb_composite_driver gserial_driver = {
.name = "g_serial", .name = "g_serial",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
}; };
static int __init init(void) static int __init init(void)
......
...@@ -373,6 +373,7 @@ static struct usb_composite_driver webcam_driver = { ...@@ -373,6 +373,7 @@ static struct usb_composite_driver webcam_driver = {
.name = "g_webcam", .name = "g_webcam",
.dev = &webcam_device_descriptor, .dev = &webcam_device_descriptor,
.strings = webcam_device_strings, .strings = webcam_device_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = webcam_unbind, .unbind = webcam_unbind,
}; };
......
...@@ -340,6 +340,7 @@ static struct usb_composite_driver zero_driver = { ...@@ -340,6 +340,7 @@ static struct usb_composite_driver zero_driver = {
.name = "zero", .name = "zero",
.dev = &device_desc, .dev = &device_desc,
.strings = dev_strings, .strings = dev_strings,
.max_speed = USB_SPEED_HIGH,
.unbind = zero_unbind, .unbind = zero_unbind,
.suspend = zero_suspend, .suspend = zero_suspend,
.resume = zero_resume, .resume = zero_resume,
......
...@@ -240,6 +240,7 @@ int usb_add_config(struct usb_composite_dev *, ...@@ -240,6 +240,7 @@ int usb_add_config(struct usb_composite_dev *,
* identifiers. * identifiers.
* @strings: tables of strings, keyed by identifiers assigned during bind() * @strings: tables of strings, keyed by identifiers assigned during bind()
* and language IDs provided in control requests * 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 * @needs_serial: set to 1 if the gadget needs userspace to provide
* a serial number. If one is not provided, warning will be printed. * a serial number. If one is not provided, warning will be printed.
* @unbind: Reverses bind; called as a side effect of unregistering * @unbind: Reverses bind; called as a side effect of unregistering
...@@ -267,6 +268,7 @@ struct usb_composite_driver { ...@@ -267,6 +268,7 @@ struct usb_composite_driver {
const char *iManufacturer; const char *iManufacturer;
const struct usb_device_descriptor *dev; const struct usb_device_descriptor *dev;
struct usb_gadget_strings **strings; struct usb_gadget_strings **strings;
enum usb_device_speed max_speed;
unsigned needs_serial:1; unsigned needs_serial:1;
int (*unbind)(struct usb_composite_dev *); int (*unbind)(struct usb_composite_dev *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment