From patchwork Sun Mar 10 01:07:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grazvydas Ignotas X-Patchwork-Id: 2242801 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 707EF3FCF2 for ; Sun, 10 Mar 2013 01:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760Ab3CJBIX (ORCPT ); Sat, 9 Mar 2013 20:08:23 -0500 Received: from mail-ea0-f180.google.com ([209.85.215.180]:41379 "EHLO mail-ea0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356Ab3CJBIP (ORCPT ); Sat, 9 Mar 2013 20:08:15 -0500 Received: by mail-ea0-f180.google.com with SMTP id j14so658873eak.39 for ; Sat, 09 Mar 2013 17:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ONyS8yKn/JW3sZmSrf/yzwqkBmIaTbr9lnhwHHNKdSA=; b=ZHXsciOrKShT+bQcIZ1OOCiP0nwgSJQbjYs7G8fiNvDosMjLQzCTvY62TZilGjPw7d 9NSRP3h7njmQYY1GX28WipxIp7KaLnJ7pk0KjAXiRV9TJHoODIb9s0lWAYzCqFYW8roy 9aiHHdLCz6h6H0XCrq5o9JIsyF9KKAJg8JY4QnhhNT7rDBVsJwNLuY6W5jAwo5r301Ay Z8tjSVIQgtEp6SujJ/fZmNSPxOBXj+LrEob1acILL8+vonUd5JyX2iVFt96i9kiWP27m uNqEkU+o+aOUxYLzgVAgl5oduL1zYACsYjDNRa02dhJL1ILMbcM3nFL8NUge/ofoAy1A YLpQ== X-Received: by 10.14.179.5 with SMTP id g5mr20959821eem.41.1362877694250; Sat, 09 Mar 2013 17:08:14 -0800 (PST) Received: from localhost.localdomain (ip-88-119-226-136.static.b4net.lt. [88.119.226.136]) by mx.google.com with ESMTPS id ca4sm12081493eeb.15.2013.03.09.17.08.12 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 17:08:13 -0800 (PST) From: Grazvydas Ignotas To: linux-usb@vger.kernel.org Cc: linux-omap@vger.kernel.org, Felipe Balbi , NeilBrown , Grazvydas Ignotas Subject: [PATCH 2/7] usb: otg: twl4030-usb: ignore duplicate events Date: Sun, 10 Mar 2013 03:07:56 +0200 Message-Id: <1362877681-8102-3-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362877681-8102-1-git-send-email-notasas@gmail.com> References: <1362877681-8102-1-git-send-email-notasas@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 Reviewed-by: Kishon Vijay Abraham I --- drivers/usb/otg/twl4030-usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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");