Skip to contentSkip to conversation

Incorrect SDP default current?

DISCUSSION Johan Korsnes 1 participant 1 message Oct 16, 2025 USB

lore
Share & tools
lore
#0 lore raw

I have a USB device (gadget). On a USB attach event, I will perform negotiation to determine the maximum charging current. The flow and order of precedence is as follows:

1. Check for Type-C 3A or 1.5A
2. Check for BC1.2 DCP or CDP
3. usb_phy_get_charger_current();
4. Use always safe 100mA

The purpose of step three is to see if we can bump to 500mA (USB2) in case we are enumerated (USB_STATE_CONFIGURED). My problem though, is that the usbphy sets 500mA as default for SDP:

#define DEFAULT_SDP_CUR_MAX 500

Hence, when I f.ex. connect to a USB hub with no upstream host port, I still end up drawing 500mA, even though my device is only in the USB_STATE_POWERED (non-enumerated). My understanding is that in this case the device is only allowed to draw 100mA.

Have I misunderstood the USB standard? Or am I abusing the usbphy API by using usb_phy_get_charger_current() in this context?

This question relates to another email which I by mistake sent to the lkml instead of USB list:
https://lore.kernel.org/lkml/[email protected]/

Kind regards,
Johan