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: 4002371 Return-Path: X-Original-To: patchwork-linux-omap@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 E1DF19F2BA for ; Wed, 16 Apr 2014 15:18:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 208B020364 for ; Wed, 16 Apr 2014 15:18:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 10F6E2035D for ; Wed, 16 Apr 2014 15:18:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161645AbaDPPRq (ORCPT ); Wed, 16 Apr 2014 11:17:46 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:34536 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161613AbaDPPRq (ORCPT ); Wed, 16 Apr 2014 11:17:46 -0400 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: , CC: Linux OMAP Mailing List , Linux ARM Kernel Mailing List , Linux Kernel Mailing List , Russell King , Felipe Balbi 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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);