diff options
author | Eirik Aanonsen <EAA@wprmedical.com> | 2010-02-05 03:49:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:54:57 -0500 |
commit | 640e95abdfae9fef5949084c92e80c8f2f8b5ec5 (patch) | |
tree | f8cb60315b5b362b53777c0e11650e681c9c3b65 /drivers/usb/gadget | |
parent | 90f7976880bbbf9968629500972f8e2f80401217 (diff) |
USB: atmel uaba: Adding invert vbus_pin
Adding vbus_pin_inverted so that the usb detect pin can be active high
or low depending on HW implementation also replaced the
gpio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc); This
allows the driver to be loaded and save about 0,15W on the consumption.
Signed-off-by: Eirik Aanonsen <eaa@wprmedical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 5 | ||||
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 976822f50c70..f79bdfe4bed9 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -320,7 +320,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc) | |||
320 | static int vbus_is_present(struct usba_udc *udc) | 320 | static int vbus_is_present(struct usba_udc *udc) |
321 | { | 321 | { |
322 | if (gpio_is_valid(udc->vbus_pin)) | 322 | if (gpio_is_valid(udc->vbus_pin)) |
323 | return gpio_get_value(udc->vbus_pin); | 323 | return gpio_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted; |
324 | 324 | ||
325 | /* No Vbus detection: Assume always present */ | 325 | /* No Vbus detection: Assume always present */ |
326 | return 1; | 326 | return 1; |
@@ -1763,7 +1763,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid) | |||
1763 | if (!udc->driver) | 1763 | if (!udc->driver) |
1764 | goto out; | 1764 | goto out; |
1765 | 1765 | ||
1766 | vbus = gpio_get_value(udc->vbus_pin); | 1766 | vbus = vbus_is_present(udc); |
1767 | if (vbus != udc->vbus_prev) { | 1767 | if (vbus != udc->vbus_prev) { |
1768 | if (vbus) { | 1768 | if (vbus) { |
1769 | toggle_bias(1); | 1769 | toggle_bias(1); |
@@ -2000,6 +2000,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2000 | if (gpio_is_valid(pdata->vbus_pin)) { | 2000 | if (gpio_is_valid(pdata->vbus_pin)) { |
2001 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { | 2001 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { |
2002 | udc->vbus_pin = pdata->vbus_pin; | 2002 | udc->vbus_pin = pdata->vbus_pin; |
2003 | udc->vbus_pin_inverted = pdata->vbus_pin_inverted; | ||
2003 | 2004 | ||
2004 | ret = request_irq(gpio_to_irq(udc->vbus_pin), | 2005 | ret = request_irq(gpio_to_irq(udc->vbus_pin), |
2005 | usba_vbus_irq, 0, | 2006 | usba_vbus_irq, 0, |
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h index f7baea307f0d..88a2e07a11a8 100644 --- a/drivers/usb/gadget/atmel_usba_udc.h +++ b/drivers/usb/gadget/atmel_usba_udc.h | |||
@@ -323,6 +323,7 @@ struct usba_udc { | |||
323 | struct platform_device *pdev; | 323 | struct platform_device *pdev; |
324 | int irq; | 324 | int irq; |
325 | int vbus_pin; | 325 | int vbus_pin; |
326 | int vbus_pin_inverted; | ||
326 | struct clk *pclk; | 327 | struct clk *pclk; |
327 | struct clk *hclk; | 328 | struct clk *hclk; |
328 | 329 | ||