Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Aug 2014, Peter Chen wrote:

> > DWC3 doesn't really have a pullup bit. It's got a RUN/STOP bit. Sure, it
> > controls the pullups but it also kills the internal DMA and quite a bit
> > of other internal blocks.
> 
> It is the same with chipidea, it has RUN/STOP bit at usbcmd, and its
> function is most like dwc3's.
> 
> If the RUN/STOP bit is cleared at usb_gadget_driver.disconnect when
> the cable is disconnected, when we set it again after cable is connected?
> The UDC drivers who has vbus handler can set run/stop bit at .vbus_session,
> but if the UDC drivers do not have vbus handler, where we can set it?

Okay, so we need to add a "vbus_is_on" flag to the usb_gadget
structure.  The gadget driver will set this flag in its connect
callback and clear the flag in its disconnect callback.  If the UDC
driver doesn't have a Vbus handler, it will invoke the connect callback
just once during startup, and it will invoke the disconnect callback
just once during removal.

The gadget driver should include an adjust_pullup() routine.  It should
get called whenever a function is activated or deactivated, and also by
the connect and disconnect callbacks.  The logic is simple:

	If (any functions are deactivated)
		turn off the pullup
	else if (gadget->vbus_is_on)
		turn on the pullup
	else
		turn off the pullup

How does that sound?

Alan Stern

--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux