linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: felipe.balbi@nokia.com
To: Greg KH <greg@kroah.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Linux USB Mailing List <linux-usb@vger.kernel.org>,
	David Brownell <david-b@pacbell.net>,
	Felipe Balbi <felipe.balbi@nokia.com>
Subject: [PATCH] usb: otg: twl4030: fix wrong assumption of starting state
Date: Wed, 11 Aug 2010 13:02:32 +0300	[thread overview]
Message-ID: <1281520952-27981-1-git-send-email-felipe.balbi@nokia.com> (raw)

From: Felipe Balbi <felipe.balbi@nokia.com>

The reset state of twl4030-usb is not sleeping, it starts
up awaken and we need to disable it if we have booted
with a disconnected cable to avoid over consumption on
the default state.

To avoid problems later, we read the current state of the
transceiver from the PHY_PWR_CTRL register. The bootloader
can, anyways, put the device to sleep before us.

Tested on a custom OMAP board.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---

Greg,

this is a bugfix but it's not a huge one, so if want
to wait until next merge window, it's fine by me.

This patch saves about 2mA for the case when we boot
with the USB cable disconnected.

 drivers/usb/otg/twl4030-usb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 0e88885..05aaac1 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -550,6 +550,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	struct twl4030_usb_data *pdata = pdev->dev.platform_data;
 	struct twl4030_usb	*twl;
 	int			status, err;
+	u8			pwr;
 
 	if (!pdata) {
 		dev_dbg(&pdev->dev, "platform_data not available\n");
@@ -568,7 +569,10 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	twl->otg.set_peripheral	= twl4030_set_peripheral;
 	twl->otg.set_suspend	= twl4030_set_suspend;
 	twl->usb_mode		= pdata->usb_mode;
-	twl->asleep		= 1;
+
+	pwr = twl4030_usb_read(twl, PHY_PWR_CTRL);
+
+	twl->asleep		= (pwr & PHY_PWR_PHYPWD);
 
 	/* init spinlock for workqueue */
 	spin_lock_init(&twl->lock);
-- 
1.7.2.1.6.g61bf12


                 reply	other threads:[~2010-08-11 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1281520952-27981-1-git-send-email-felipe.balbi@nokia.com \
    --to=felipe.balbi@nokia.com \
    --cc=david-b@pacbell.net \
    --cc=greg@kroah.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).