From patchwork Tue May 30 12:38:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Gunda X-Patchwork-Id: 9754551 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC8FA602B9 for ; Tue, 30 May 2017 12:42:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECF12846A for ; Tue, 30 May 2017 12:42:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3A7D2847A; Tue, 30 May 2017 12:42:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7336A2846A for ; Tue, 30 May 2017 12:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750952AbdE3Mke (ORCPT ); Tue, 30 May 2017 08:40:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57608 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751723AbdE3Mk3 (ORCPT ); Tue, 30 May 2017 08:40:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D574A607EE; Tue, 30 May 2017 12:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148023; bh=UQwpmVYCAl7ywb9BWAj4k7bfHzz04IcMWPgXoZVy4+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNfS4QOLa3egJlyZeRXUpMc2Mr3mi/jHNgq3BYGZnptwNaoxRN/MigrW/EW3gA81i nJZs96PnyYSuV7SKiIgrW4iahT8IMPiVTR3etgslQBCaiZZ0h6F9Ak/AObGbgSD1Qg p45Z8vpU8oGQdH0k/Tp3v0FGneZxjry3MYUtsB/k= Received: from kgunda-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kgunda@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 84305607E4; Tue, 30 May 2017 12:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148023; bh=UQwpmVYCAl7ywb9BWAj4k7bfHzz04IcMWPgXoZVy4+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNfS4QOLa3egJlyZeRXUpMc2Mr3mi/jHNgq3BYGZnptwNaoxRN/MigrW/EW3gA81i nJZs96PnyYSuV7SKiIgrW4iahT8IMPiVTR3etgslQBCaiZZ0h6F9Ak/AObGbgSD1Qg p45Z8vpU8oGQdH0k/Tp3v0FGneZxjry3MYUtsB/k= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 84305607E4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kgunda@codeaurora.org From: Kiran Gunda To: Kiran Gunda , Abhijeet Dharmapurikar , David Collins , Subbaraman Narayanamurthy , Christophe JAILLET , linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, adharmap@quicinc.com, aghayal@qti.qualcomm.com, sboyd@codeaurora.org Subject: [PATCH V1 09/15] spmi: pmic-arb: check apid enabled before calling the handler Date: Tue, 30 May 2017 18:08:57 +0530 Message-Id: <1496147943-25822-10-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496147943-25822-1-git-send-email-kgunda@codeaurora.org> References: <1496147943-25822-1-git-send-email-kgunda@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Abhijeet Dharmapurikar The driver currently invokes the apid handler (periph_handler()) once it sees that the summary status bit for that apid is set. However the hardware is designed to set that bit even if the apid interrupts are disabled. The driver should check whether the apid is indeed enabled before calling the apid handler. Signed-off-by: Abhijeet Dharmapurikar Signed-off-by: Kiran Gunda --- drivers/spmi/spmi-pmic-arb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index ad34491..f8638fa 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -536,8 +536,8 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) void __iomem *intr = pa->intr; int first = pa->min_apid >> 5; int last = pa->max_apid >> 5; - u32 status; - int i, id; + u32 status, enable; + int i, id, apid; chained_irq_enter(chip, desc); @@ -547,7 +547,11 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) while (status) { id = ffs(status) - 1; status &= ~BIT(id); - periph_interrupt(pa, id + i * 32); + apid = id + i * 32; + enable = readl_relaxed(intr + + pa->ver_ops->acc_enable(apid)); + if (enable & SPMI_PIC_ACC_ENABLE_BIT) + periph_interrupt(pa, apid); } }