usb: make usb descriptor power options configurable
Add two new kconfig options USB_SELF_POWERED and USB_MAX_POWER. These can be set by the user to change the USB configuration descriptor. USB_MAX_POWER can be set to any value between 0 and 250, but practically should be 50 or 250. These values are half the ammount of mA that the device will tell the host that it needs. USB_SELF_POWERED sets the 7th bit in bmAttributes of the USB config descriptor. Should be set to y if the device has its own power source other than USB. Signed-off-by: Barry Solomon <barry.solomon@dexcom.com>
This commit is contained in:
parent
86dc23a15d
commit
6118ca2785
4 changed files with 24 additions and 11 deletions
|
@ -86,11 +86,6 @@
|
|||
#define BCDDEVICE_RELNUM (BCD(KERNEL_VERSION_MAJOR) << 8 | \
|
||||
BCD(KERNEL_VERSION_MINOR))
|
||||
|
||||
/* 100mA max power, per 2mA units */
|
||||
/* USB 1.1 spec indicates 100mA(max) per unit load, up to 5 loads */
|
||||
#define MAX_LOW_POWER 0x32
|
||||
#define MAX_HIGH_POWER 0xFA
|
||||
|
||||
/* Highest value of Frame Number in SOF packets. */
|
||||
#define USB_SOF_MAX 2047
|
||||
|
||||
|
@ -100,10 +95,13 @@
|
|||
* D5:Remote Wakeup -> 0,
|
||||
* D4...0:Reserved -> 0
|
||||
*/
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP 0x20
|
||||
#define USB_CONFIGURATION_ATTRIBUTES 0xC0 \
|
||||
| (COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, \
|
||||
(USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP), (0)))
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP BIT(5)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES_SELF_POWERED BIT(6)
|
||||
#define USB_CONFIGURATION_ATTRIBUTES BIT(7) \
|
||||
| ((COND_CODE_1(CONFIG_USB_SELF_POWERED, \
|
||||
(USB_CONFIGURATION_ATTRIBUTES_SELF_POWERED), (0))) \
|
||||
| (COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, \
|
||||
(USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP), (0))))
|
||||
|
||||
/* Classes */
|
||||
#define COMMUNICATION_DEVICE_CLASS 0x02
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue