diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-12-03 14:07:05 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-10 05:38:52 -0500 |
commit | 8f900a9a6e2691441ad763952d640ac44220e5dc (patch) | |
tree | 5f00b9cba299d1dfa035bf3dc13cb1029e39381a /include/linux/usb/composite.h | |
parent | 98f3a1b90795d7216de0d56157868d174317f91a (diff) |
usb: gadget: consider link speed for bMaxPower
The USB 2.0 specification says that bMaxPower is the maximum power
consumption expressed in 2 mA units and the USB 3.0 specification says
that it is expressed in 8 mA units.
This patch renames bMaxPower to MaxPower and the various /2 and *2 are
removed. Before reporting the config descriptor, the proper value is
computer based on the speed, all in-tree users are updated. MaxPower is
also increased to u16 so we can store the nokia gadget value which is
larger than the max value allowed for u8.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb/composite.h')
-rw-r--r-- | include/linux/usb/composite.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b09c37e04a91..dc512c9432d7 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -184,7 +184,8 @@ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, | |||
184 | * @bConfigurationValue: Copied into configuration descriptor. | 184 | * @bConfigurationValue: Copied into configuration descriptor. |
185 | * @iConfiguration: Copied into configuration descriptor. | 185 | * @iConfiguration: Copied into configuration descriptor. |
186 | * @bmAttributes: Copied into configuration descriptor. | 186 | * @bmAttributes: Copied into configuration descriptor. |
187 | * @bMaxPower: Copied into configuration descriptor. | 187 | * @MaxPower: Power consumtion in mA. Used to compute bMaxPower in the |
188 | * configuration descriptor after considering the bus speed. | ||
188 | * @cdev: assigned by @usb_add_config() before calling @bind(); this is | 189 | * @cdev: assigned by @usb_add_config() before calling @bind(); this is |
189 | * the device associated with this configuration. | 190 | * the device associated with this configuration. |
190 | * | 191 | * |
@@ -230,7 +231,7 @@ struct usb_configuration { | |||
230 | u8 bConfigurationValue; | 231 | u8 bConfigurationValue; |
231 | u8 iConfiguration; | 232 | u8 iConfiguration; |
232 | u8 bmAttributes; | 233 | u8 bmAttributes; |
233 | u8 bMaxPower; | 234 | u16 MaxPower; |
234 | 235 | ||
235 | struct usb_composite_dev *cdev; | 236 | struct usb_composite_dev *cdev; |
236 | 237 | ||