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: 28494 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8BC96206A6 for ; Wed, 16 Apr 2014 15:18:01 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id j5sf23966442qga.6 for ; Wed, 16 Apr 2014 08:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=gcnvKUMLTtE1dVm7w763u2l+S8QP8C9IFjfFM2y9Ngw=; b=O65PMvTzjnBEaIhx/JLVDHiTC1y5Px7MdCGOitg9dftspVNepJmfPAZcXQ5a0ChUnw kRRqL/tO0URjDRooWXjHkeIktInm4R8XqXqUrpLk9eYCPQXGyctjFz3TPa5KB7YiybKH gAeo3unyE4SAE0kO1BiDZubEDP4WweqvSfDAItHMIquBl1Bxyv9eFNOziK38Rn//PsQZ EDMsSBRzWPVtM0oYv4CIzJLnu6GhyBclgjd0spRT70xcUM8pdX88A3nqTUgjjy8Fs5bH AZtPXtGzNHUDRh5koxXmud3b7OFxwtqHuv8m1TaUygDoq3quRIRO31uUi1teb+sYMKCN B9VQ== X-Gm-Message-State: ALoCoQlBZuBk7OD3SneJ17AJJJk5b87S+tqf5TooRA140176E+yrYsi32LHJKv7q7k2PhVEq1uZG X-Received: by 10.52.146.45 with SMTP id sz13mr1921231vdb.6.1397661481264; Wed, 16 Apr 2014 08:18:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.85 with SMTP id a79ls705346qge.72.gmail; Wed, 16 Apr 2014 08:18:01 -0700 (PDT) X-Received: by 10.221.58.144 with SMTP id wk16mr2530409vcb.23.1397661481172; Wed, 16 Apr 2014 08:18:01 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id xt10si3924693veb.58.2014.04.16.08.18.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 08:18:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so10705258veb.23 for ; Wed, 16 Apr 2014 08:18:01 -0700 (PDT) X-Received: by 10.220.12.66 with SMTP id w2mr2477919vcw.15.1397661480961; Wed, 16 Apr 2014 08:18:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp320331vcb; Wed, 16 Apr 2014 08:18:00 -0700 (PDT) X-Received: by 10.68.178.162 with SMTP id cz2mr9004363pbc.51.1397661480187; Wed, 16 Apr 2014 08:18:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id td10si12908214pac.99.2014.04.16.08.17.59; Wed, 16 Apr 2014 08:17:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422646AbaDPPRr (ORCPT + 26 others); Wed, 16 Apr 2014 11:17:47 -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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);