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, Alan Stern wrote:

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

After more thought, if the vbus_is_on flag is going to be controlled 
by the gadget driver rather than the UDC driver, then it really belongs 
in the gadget driver's private data structure and not in struct 
usb_gadget.  Also, a better name for the flag would be "is_connected".

> 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

This logic can be compressed a little:

	if (!is_connected || any functions are deactivated)
		turn off the pullup
	else
		turn on the pullup

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