Skip to contentSkip to conversation

usb: dwc2: detect power supplies to reduce spam

PATCH New Ioan-Adrian Ratiu 1 participant 1 message Mar 4, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: detect power supplies to reduce spam

By statically hardcoding at compile time the number of supplies ("#define DWC2_NUM_SUPPLIES ARRAY_SIZE(dwc2_hsotg_supply_names)"), the driver assumed that every controller uses supplies and issued a warning if none were detected via the device tree [1], even though the vast majority of devices (with 1 exception from Samsung) don't need nor use them.

So to return to normality and stop warning everyone unconditionally, detect if there are any supplies and no-op just like the dummy regulator which got loudly auto-asigned does.

This issue has been previously discussed based on an alternative fix at [2] a year back but nothing came out of it then.

[1]
dwc2 3f980000.usb: 3f980000.usb supply vusb_d not found, using dummy regulator dwc2 3f980000.usb: 3f980000.usb supply vusb_a not found, using dummy regulator

[2]
https://www.spinics.net/lists/linux-usb/msg153010.html

---
 drivers/usb/dwc2/core.h     |  5 +++--
 drivers/usb/dwc2/platform.c | 46 +++++++++++++++++++++++++++++++--------------
 2 files changed, 35 insertions(+), 16 deletions(-)
drivers/usb/dwc2/core.h +3 -2
index cd77af3b1565..c50b9fc4a162 100644
@@ -128,7 +128,7 @@ static const char * const dwc2_hsotg_supply_names[] = {
 	"vusb_a",               /* analog USB supply, 1.1V */
 };
 
-#define DWC2_NUM_SUPPLIES ARRAY_SIZE(dwc2_hsotg_supply_names)
+#define DWC2_MAX_SUPPLIES ARRAY_SIZE(dwc2_hsotg_supply_names)
 
 /*
  * EP0_MPS_LIMIT
@@ -921,7 +921,8 @@ struct dwc2_hsotg {
 	struct phy *phy;
 	struct usb_phy *uphy;
 	struct dwc2_hsotg_plat *plat;
-	struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES];
+	struct regulator_bulk_data supplies[DWC2_MAX_SUPPLIES];
+	u8 num_supplies;
 	u32 phyif;
 
 	spinlock_t lock;
drivers/usb/dwc2/platform.c +32 -14

72 lines not on this page · raw message

Signature · 1 line
2.16.2