}
static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store);
-static ssize_t
-musb_cable_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct musb *musb = dev_to_musb(dev);
- char *v1= "", *v2 = "?";
- unsigned long flags;
- int vbus;
-
- spin_lock_irqsave(&musb->lock, flags);
-#if defined(CONFIG_USB_TUSB6010) && !defined(CONFIG_USB_MUSB_OTG)
- /* REVISIT: connect-A != connect-B ... */
- vbus = musb_platform_get_vbus_status(musb);
- if (vbus)
- v2 = "connected";
- else
- v2 = "disconnected";
-#else
- /* NOTE: board-specific issues, like too-big capacitors keeping
- * VBUS high for a long time after power has been removed, can
- * cause temporary false indications of a connection.
- */
- vbus = musb_readb(musb->mregs, MUSB_DEVCTL);
- if (vbus & 0x10) {
- /* REVISIT retest on real OTG hardware */
- switch (musb->board_mode) {
- case MUSB_HOST:
- v2 = "A";
- break;
- case MUSB_PERIPHERAL:
- v2 = "B";
- break;
- case MUSB_OTG:
- v1 = "Mini-";
- v2 = (vbus & MUSB_DEVCTL_BDEVICE) ? "B" : "A";
- break;
- }
- } else /* VBUS level below A-Valid */
- v2 = "disconnected";
-#endif
- musb_platform_try_idle(musb, 0);
- spin_unlock_irqrestore(&musb->lock, flags);
-
- return sprintf(buf, "%s%s\n", v1, v2);
-}
-static DEVICE_ATTR(cable, S_IRUGO, musb_cable_show, NULL);
-
static ssize_t
musb_vbus_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t n)
if (musb->xceiv.state != old_state) {
old_state = musb->xceiv.state;
- sysfs_notify(&musb->controller->kobj, NULL, "cable");
sysfs_notify(&musb->controller->kobj, NULL, "mode");
}
}
#ifdef CONFIG_SYSFS
device_remove_file(musb->controller, &dev_attr_mode);
- device_remove_file(musb->controller, &dev_attr_cable);
device_remove_file(musb->controller, &dev_attr_vbus);
#ifdef CONFIG_USB_MUSB_OTG
device_remove_file(musb->controller, &dev_attr_srp);
#ifdef CONFIG_SYSFS
status = device_create_file(dev, &dev_attr_mode);
- status = device_create_file(dev, &dev_attr_cable);
status = device_create_file(dev, &dev_attr_vbus);
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
status = device_create_file(dev, &dev_attr_srp);