On Wednesday 25 February 2009, Felipe Balbi wrote: > > > > With a 500mA configuration, the vbus draw would not switch > > > from 0 to 500, it would have one step in either 8mA or 100mA > > > depending whether gadget have otg enabled or not. > > > > I don't follow. This function is called right after a USB > > reset. No SET_CONFIGURATION has been done yet. It's just > > Exactly, which makes our device starts drawing 8mA (or 100mA if non-otg) > even though the gadget driver didn't ask it to. They're always allowed to draw that much current, except when they're suspended. > > returning to the default state; no bug that I see. Once > > the SET_CONFIGURATION is issued, it can use more current. > > what would happen in this case is that we would try to charge at 8mA and > a few jiffies later we would have to change our charging profile to > 500mA since we just got a high power configuration chosen. I'm still not getting it. You're complaining about the kernel doing the right thing. If there's a problem, this isn't its source. > What I mean with this patch is that musb shouldn't try to figure default > values for vbus_draw(); that should be the gadget driver's role to call > usb_gadget_vbus_draw(), right ? > > Moreover, I don't see any other gadget controller driver calling their > vbus_draw() function themselves. We're a bit shy on Linux boards actually using VBUS for battery charging. The H2 board does that only through its otg_transceiver driver ... but that's aware of USB-level resets in a way that doesn't necessarily work yet for MUSB. Maybe this is just missing one call reporting disconnect to the gadget driver... Plus, the MUSB driver still needs some sorting-out of transceiver support, in this area and others. For TUSB6010 it does OK, using VBUS to power the USB circuitry (call it 40 mA); the transceiver driver is part of MUSB, not unlike with DaVinci (but DaVinci boards I know about don't consume VBUS power). For most other boards it doesn't yet matter. Your issue is that the VBUS charging logic you're using has a few bugs that need to be fixed: it doesn't yet understand what's going on before the first SET_CONFIGURATION. (Or, I'm guessing, after setting config #0...) - Dave -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html