On 05/01/2010, at 12:01 AM, Eirik Aanonsen wrote: > Adding vbus_pin_inverted so that the usb detect pin can be active high or low. > This because depending on HW implementation it is better to have active low. > Also replaced the pio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc); > > Signed-off-by: Eirik Aanonsen <eaa@xxxxxxxxxxxxxx> > --- > drivers/usb/gadget/atmel_usba_udc.c | 16 +++++++++++++--- > drivers/usb/gadget/atmel_usba_udc.h | 1 + > include/linux/usb/atmel_usba_udc.h | 1 + > 3 files changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c > index 4e970cf..1c469d4 100644 > --- a/drivers/usb/gadget/atmel_usba_udc.c > +++ b/drivers/usb/gadget/atmel_usba_udc.c > @@ -320,8 +320,17 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc) > static int vbus_is_present(struct usba_udc *udc) > { > if (gpio_is_valid(udc->vbus_pin)) > - return gpio_get_value(udc->vbus_pin); > - > + { > + if(udc->vbus_pin_inverted) > + { > + if( gpio_get_value(udc->vbus_pin) == 1) > + return 0; > + else > + return 1; > + } > + else > + return gpio_get_value(udc->vbus_pin); > + } return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted --Ben. -- 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