[PATCH 10/12] musb_hdrc: Make vbus sysfs entry report current Vbus status

Tony Lindgren
2007-10-11T17:05:23Z

From: Felipe Balbi <felipe.lima@indt.org.br>

Getting the current status of Vbus is useful when running
USB Compliance Tests.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 3d35a4e..dc934dc 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1718,12 +1718,15 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
struct musb *musb = dev_to_musb(dev);
unsigned long flags;
unsigned long val;
+ int vbus;

spin_lock_irqsave(&musb->lock, flags);
val = musb->a_wait_bcon;
+ vbus = musb_platform_get_vbus_status(musb);
spin_unlock_irqrestore(&musb->lock, flags);

- return sprintf(buf, "%lu\n", val);
+ return sprintf(buf, "Vbus %s, timeout %lu\n",
+ vbus ? "on" : "off", val);
}
static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store);

--
1.5.2.5