summaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-twl4030-usb.c
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2013-03-17 19:23:22 +0100
committerFelipe Balbi <balbi@ti.com>2013-03-21 13:20:29 +0100
commitca4f70ce78de9a2fa09741f80cf7bda2f4256ecc (patch)
tree9f2f83a0ad8ca5d42f0ef7c659297d3ad03a63fd /drivers/usb/phy/phy-twl4030-usb.c
parentusb: phy: twl4030-usb: don't enable PHY during init (diff)
downloadlinux-ca4f70ce78de9a2fa09741f80cf7bda2f4256ecc.tar.xz
linux-ca4f70ce78de9a2fa09741f80cf7bda2f4256ecc.zip
usb: phy: twl4030-usb: ignore duplicate events
In some rare cases we may get multiple interrupts that will generate duplicate omap_musb_mailbox() calls. This is a problem because each VBUS/ID event generates runtime_pm call in OMAP glue code, causing unbalanced gets or puts and breaking PM. The same goes for initial state, glue already defaults to "no cable" state, so only bother it if we have VBUS or ID. Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to '')
-rw-r--r--drivers/usb/phy/phy-twl4030-usb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/usb/phy/phy-twl4030-usb.c
index 4ad234cc6c9e..7ff67ce373dc 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/usb/phy/phy-twl4030-usb.c
@@ -483,9 +483,10 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
{
struct twl4030_usb *twl = _twl;
enum omap_musb_vbus_id_status status;
+ enum omap_musb_vbus_id_status status_prev = twl->linkstat;
status = twl4030_usb_linkstat(twl);
- if (status > 0) {
+ if (status > 0 && status != status_prev) {
/* FIXME add a set_power() method so that B-devices can
* configure the charger appropriately. It's not always
* correct to consume VBUS power, and how much current to
@@ -523,7 +524,7 @@ static int twl4030_usb_phy_init(struct usb_phy *phy)
twl->asleep = 1;
status = twl4030_usb_linkstat(twl);
- if (status > 0)
+ if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID)
omap_musb_mailbox(twl->linkstat);
sysfs_notify(&twl->dev->kobj, NULL, "vbus");