Message ID | 1362877681-8102-3-git-send-email-notasas@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On Sunday 10 March 2013 06:37 AM, Grazvydas Ignotas wrote: > 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. Did you actually observed multiple interrupts? Actually we thought debouncing should be handled in hardware. > > 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> Thanks Kishon -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Mar 12, 2013 at 3:32 PM, kishon <kishon@ti.com> wrote: > Hi, > > > On Sunday 10 March 2013 06:37 AM, Grazvydas Ignotas wrote: >> >> 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. > > > Did you actually observed multiple interrupts? Actually we thought > debouncing should be handled in hardware. I think I saw it a few times, although it might have been something else. In any case the software check is very cheap and there is no reason not to have it, IMO. > >> >> 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> > > Thanks > Kishon
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index 1515c0b..0ea576a 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c @@ -491,9 +491,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 @@ -530,7 +531,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl) 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");
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> --- drivers/usb/otg/twl4030-usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)