Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp127200pxb; Mon, 18 Oct 2021 22:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLC/3/OsIjPtwBluG8Lb88SLB1P7eOcBQEllK6piXBbYfdG9x3EzVOINCHh6IiMx15lk14 X-Received: by 2002:aa7:c44d:: with SMTP id n13mr51341035edr.34.1634621550643; Mon, 18 Oct 2021 22:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634621550; cv=none; d=google.com; s=arc-20160816; b=MdGUlh9r125ZUFFqTQCEsXsD23K7Yw4HC3zcNPnfDKY3nszq/qp3ncMAIHHOG/iS6V CBSm1BLsOcU/dYiQFfu1qRp8Aw0+h07FXidPgK7c6mMI/6y3hspDZKaQcOzhmhC5m7+A kmvmairnKHdt3sJEru98WT3LkHBUtdilG0OU/WnVaYBrodjO/a0qtK76Foq1Te/i0gXM YuJ4HbNwBjSnMFV3cNfP2hiWWgzFyRjBjpPu1YQrf2GCpntlk/JvPMK693lwKjCPdWQK /u8FFGAlonoGIUsM8jCoiLW2Mg3tI2E0fINSsL4n4T2Y51HkdHYnvFGF3ALW5xmtT1/v h4sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=E7Vh0Xdq3dAzkFCnG0x+qBaO5s+22AgqdUeWpQaxsfw=; b=vAlHsPMzOIGzI9Bh/NXgr6gYAOLlFezGuE9JFYrJ9ohmm95AlA/BOuqv2p0Nuocg2w +4AS01TVCa7IpfxMslMGdAgFfOI+CwucHbR3bR3M18W65WE5Vmqc8iDInyTjma5ZvzzC Mxb7CtWBXVGpjvRe1FRXRi28bCLr7IpNg+zkcOHlP6zlfgiQSbgv+7h/YvpdBu2PYuu2 BHjDU9XLYV1jETaops/OmMXZBxpkiWfoDIRnFrIkiZLxolEla5238nzARLbEtbg9y14A qUrEO3cvukKOOvmnt9kisQ9MLsGHoyXvnGJxsmlWI1fNRb41w/Kyiwn+BDoxwVrsFj98 WBnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sBH4ykhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si5753761edb.72.2021.10.18.22.32.06; Mon, 18 Oct 2021 22:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=sBH4ykhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233497AbhJSFcX (ORCPT + 99 others); Tue, 19 Oct 2021 01:32:23 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:20543 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233437AbhJSFcS (ORCPT ); Tue, 19 Oct 2021 01:32:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1634621406; x=1666157406; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=E7Vh0Xdq3dAzkFCnG0x+qBaO5s+22AgqdUeWpQaxsfw=; b=sBH4ykhOMrhC6MONBkeK0zQ5gRVUjeRZVX65kX6kJj5B/J5IRttk31GC 80lJsQuIN1kvPiMECWZRgddBghSHKMHijEyzC9G6645eJJbWrrZ95tUIO JYSVrVnVsW1d01HeaDMukkLEsFm2gf4JbHWrB1uAB8vgRcZT22SSiF10X c=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 18 Oct 2021 22:30:06 -0700 X-QCInternal: smtphost Received: from nalasex01c.na.qualcomm.com ([10.47.97.35]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 22:30:06 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 18 Oct 2021 22:30:03 -0700 From: Fenglin Wu To: , , CC: , , , , , "Ashay Jaiswal" Subject: [PATCH v2 04/10] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Tue, 19 Oct 2021 13:29:15 +0800 Message-ID: <1634621361-17155-5-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1634621361-17155-1-git-send-email-quic_fenglinw@quicinc.com> References: <1634621361-17155-1-git-send-email-quic_fenglinw@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ashay Jaiswal Current implementation of SPMI arbiter dispatches interrupt based on the Arbiter's accumulator status, in some cases the accumulator status may remain zero and the interrupt remains un-handled. Add logic to dispatch interrupts based Arbiter's IRQ status if the accumulator status is zero. Signed-off-by: Ashay Jaiswal Signed-off-by: David Collins Signed-off-by: Fenglin Wu --- drivers/spmi/spmi-pmic-arb.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 479f721..127a427 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -528,12 +528,18 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) u8 ee = pmic_arb->ee; u32 status, enable, handled = 0; int i, id, apid; + /* status based dispatch */ + bool acc_valid = false; + u32 irq_status = 0; chained_irq_enter(chip, desc); for (i = first >> 5; i <= last >> 5; ++i) { status = readl_relaxed( ver_ops->owner_acc_status(pmic_arb, ee, i)); + if (status) + acc_valid = true; + while (status) { id = ffs(status) - 1; status &= ~BIT(id); @@ -551,6 +557,29 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) } } + /* ACC_STATUS is empty but IRQ fired check IRQ_STATUS */ + if (!acc_valid) { + for (i = first; i <= last; i++) { + /* skip if APPS is not irq owner */ + if (pmic_arb->apid_data[i].irq_ee != pmic_arb->ee) + continue; + + irq_status = readl_relaxed( + ver_ops->irq_status(pmic_arb, i)); + if (irq_status) { + enable = readl_relaxed( + ver_ops->acc_enable(pmic_arb, i)); + if (enable & SPMI_PIC_ACC_ENABLE_BIT) { + dev_dbg(&pmic_arb->spmic->dev, + "Dispatching IRQ for apid=%d status=%x\n", + i, irq_status); + if (periph_interrupt(pmic_arb, i) == 0) + handled++; + } + } + } + } + if (handled == 0) handle_bad_irq(desc); -- 2.7.4