From patchwork Wed Apr 16 15:14:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 4002381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BA98F9F2BA for ; Wed, 16 Apr 2014 15:19:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC59620374 for ; Wed, 16 Apr 2014 15:19:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13A4720364 for ; Wed, 16 Apr 2014 15:19:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaRau-0004R8-CC; Wed, 16 Apr 2014 15:17:48 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaRar-0004Lb-0O; Wed, 16 Apr 2014 15:17:45 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3GFHENR032624; Wed, 16 Apr 2014 10:17:14 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3GFHEaL009313; Wed, 16 Apr 2014 10:17:14 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 16 Apr 2014 10:17:14 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3GFHDTa008830; Wed, 16 Apr 2014 10:17:14 -0500 From: Felipe Balbi To: , Subject: [PATCH] power: twl4030_charger: clear IRQs after handling them Date: Wed, 16 Apr 2014 10:14:59 -0500 Message-ID: <1397661299-31342-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.1.286.g5172cb3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140416_081745_129830_D6465586 X-CRM114-Status: UNSURE ( 8.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) Cc: Felipe Balbi , Linux OMAP Mailing List , Russell King , Linux Kernel Mailing List , Linux ARM Kernel Mailing List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP TRM says we *must* write 1 to each bit we're handling in order to clear the IRQ status and bring IRQ line low. This patch implements that. Signed-off-by: Felipe Balbi --- Russell, I don't have HW to test, but this should solve the problem you saw when not using battery with Zoom board. Let me know if it doesn't. cheers drivers/power/twl4030_charger.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c index f141088..b090842 100644 --- a/drivers/power/twl4030_charger.c +++ b/drivers/power/twl4030_charger.c @@ -301,12 +301,24 @@ static irqreturn_t twl4030_bci_interrupt(int irq, void *arg) ret = twl_i2c_read_u8(TWL4030_MODULE_INTERRUPTS, &irqs1, TWL4030_INTERRUPTS_BCIISR1A); if (ret < 0) - return IRQ_HANDLED; + return IRQ_NONE; + + /* clear IRQs early */ + ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, irqs1, + TWL4030_INTERRUPTS_BCIISR1A); + if (ret < 0) + return IRQ_NONE; ret = twl_i2c_read_u8(TWL4030_MODULE_INTERRUPTS, &irqs2, TWL4030_INTERRUPTS_BCIISR2A); if (ret < 0) - return IRQ_HANDLED; + return IRQ_NONE; + + /* clear IRQs early */ + ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, irqs2, + TWL4030_INTERRUPTS_BCIISR2A); + if (ret < 0) + return IRQ_NONE; dev_dbg(bci->dev, "BCI irq %02x %02x\n", irqs2, irqs1);