]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus
authorJack Pham <jackp@codeaurora.org>
Fri, 31 Jan 2020 03:10:35 +0000 (19:10 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 7 Apr 2020 08:50:42 +0000 (10:50 +0200)
commit12cc0a2684c28acf221a69c7f39b81ee14cdb005
tree462b7834d5e6f85f26dacc245f5910e65e7f30e6
parentd126df20efc0d67edf6a72fbd2c03c8882aeb7c1
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus

BugLink: https://bugs.launchpad.net/bugs/1867837
commit c724417baf162bd3e035659e22cdf990cfb0d917 upstream.

SuperSpeedPlus peripherals must report their bMaxPower of the
configuration descriptor in units of 8mA as per the USB 3.2
specification. The current switch statement in encode_bMaxPower()
only checks for USB_SPEED_SUPER but not USB_SPEED_SUPER_PLUS so
the latter falls back to USB 2.0 encoding which uses 2mA units.
Replace the switch with a simple if/else.

Fixes: eae5820b852f ("usb: gadget: composite: Write SuperSpeedPlus config descriptors")
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/gadget/composite.c