public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 3/12] musb_hdrc: Remove old sysfs entry cable, use mode instead
Date: Thu, 11 Oct 2007 10:05:16 -0700	[thread overview]
Message-ID: <11921223283749-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <11921223272557-git-send-email-tony@atomide.com>

Cable was used earlier before OTG support for peripherals, however
it does not really work for OTG. Sysfs entry mode shows the right
OTG mode and should be used instead.

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 f7dc22c..82bf57a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1660,52 +1660,6 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
 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)
 {
@@ -1780,7 +1734,6 @@ static void musb_irq_work(struct work_struct *data)
 
 	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");
 	}
 }
@@ -1846,7 +1799,6 @@ static void musb_free(struct musb *musb)
 
 #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);
@@ -2082,7 +2034,6 @@ fail:
 
 #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);
-- 
1.5.2.5

  reply	other threads:[~2007-10-11 17:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11 17:05 [PATCH 0/12] musb_hdrc: Host and OTG updates Tony Lindgren
2007-10-11 17:05 ` [PATCH 1/12] musb_hdrc: Allow tusb3.0 and greater to use multichannel DMA Tony Lindgren
2007-10-11 17:05   ` [PATCH 2/12] musb_hdrc: Add more sysfs notify events Tony Lindgren
2007-10-11 17:05     ` Tony Lindgren [this message]
2007-10-11 17:05       ` [PATCH 4/12] musb_hdrc: Remove non-debug otg_state_string Tony Lindgren
2007-10-11 17:05         ` [PATCH 5/12] musb_hdrc: Fix host suspend handling, remove earlier hacks Tony Lindgren
2007-10-11 17:05           ` [PATCH 6/12] musb_hdrc: Improve tusb host state handling for a_idle Tony Lindgren
2007-10-11 17:05             ` [PATCH 7/12] musb_hdrc: Don't idle as host if VBUS timeout is 0 Tony Lindgren
2007-10-11 17:05               ` [PATCH 8/12] musb_hdrc: Add timer for returning to host mode from HNP Tony Lindgren
2007-10-11 17:05                 ` [PATCH 9/12] musb_hdrc: Make HNP more reliable Tony Lindgren
2007-10-11 17:05                   ` [PATCH 10/12] musb_hdrc: Make vbus sysfs entry report current Vbus status Tony Lindgren
2007-10-11 17:05                     ` [PATCH 11/12] musb_hdrc: Allow suspend if host is already suspended Tony Lindgren
2007-10-11 17:05                       ` musb_hdrc: Fix compile if CONFIG_ARCH_OMAP_OTG is not set Tony Lindgren
2007-10-11 20:07                       ` [PATCH 11/12] musb_hdrc: Allow suspend if host is already suspended Felipe Balbi
2007-10-11 20:21                         ` David Brownell
2007-10-11 20:38                           ` Felipe Balbi
2007-10-12  0:56       ` [PATCH 3/12] musb_hdrc: Remove old sysfs entry cable, use mode instead David Brownell
2007-10-12 20:32 ` [PATCH 0/12] musb_hdrc: Host and OTG updates Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11921223283749-git-send-email-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap-open-source@linux.omap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox