Commit 40e89ff
usb: gadget: Set self-powered based on MaxPower and bmAttributes
Currently the USB gadget will be set as bus-powered based solely
on whether its bMaxPower is greater than 100mA, but this may miss
devices that may legitimately draw less than 100mA but still want
to report as bus-powered. Similarly during suspend & resume, USB
gadget is incorrectly marked as bus/self powered without checking
the bmAttributes field. Fix these by configuring the USB gadget
as self or bus powered based on bmAttributes, and explicitly set
it as bus-powered if it draws more than 100mA.
Cc: stable <stable@kernel.org>
Fixes: 5e5caf4 ("usb: gadget: composite: Inform controller driver of self-powered")
Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250217120328.2446639-1-prashanth.k@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 17c2c87 commit 40e89ff
1 file changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1050 | 1050 | | |
1051 | 1051 | | |
1052 | 1052 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
| 1053 | + | |
| 1054 | + | |
1056 | 1055 | | |
| 1056 | + | |
| 1057 | + | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | 1060 | | |
| |||
2615 | 2616 | | |
2616 | 2617 | | |
2617 | 2618 | | |
2618 | | - | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
2619 | 2622 | | |
2620 | 2623 | | |
2621 | 2624 | | |
| |||
2649 | 2652 | | |
2650 | 2653 | | |
2651 | 2654 | | |
2652 | | - | |
| 2655 | + | |
| 2656 | + | |
2653 | 2657 | | |
| 2658 | + | |
| 2659 | + | |
2654 | 2660 | | |
2655 | 2661 | | |
2656 | 2662 | | |
| |||
0 commit comments