Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5709315pxv; Wed, 28 Jul 2021 18:15:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaEiWcgXsLyJXH8TmtcMrLHMK6t2tLqsH25CrhbEwyUg0ZwT4nwUJf0WL7PEqcBlLsIogB X-Received: by 2002:a5d:938a:: with SMTP id c10mr1852590iol.0.1627521301832; Wed, 28 Jul 2021 18:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627521301; cv=none; d=google.com; s=arc-20160816; b=oAk16LcB4KO52wbKYzRuuaVi6D7cOOQQwRKFIKcZDCBrJLlY/V/LErOE4QJVrFUsrE mhA4w7uv/MgbPOWQY4Z1Iw075+OmamDGvuJQT3FqSUG/biE7ghuNtESECaxR4rRcxLO/ Pr6wROkJXi5E6CbvK9PZOmiohLywOR62OiWlYf2h0QXMT089aTwhEqNqDvU78LKlEOQe 9k+3TAM+5Ar9upeUIoGpfuFhYbPOvQmP5W+0lVpc2AtJjTrMh0fodRet/vvpCPCh3bRX iACVhiiD9AMv40LFh01xWemN7PAWmZhaq6Aq68KyQzgY+XSWINwJClHQ9hUXhOKHqWYx Svag== 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=G4dtTy0JLAF844f2/EZu72NLLrcX9T0XRHDhQ0AQcAw=; b=vhaeKwKWxKiOwTi60/o9FLrSWf4nIPm+nJ8jEj23Z/ykETI/Pv+H2QGNdJxaY7e8yj GS1NjShYC62pONvZDvTFaM2CV0qfBHv5adjxXPL3zs/FXCsBT8Pmyivcc0iAzHY3lmaY L1VOFocdk1ifZ9g7+o4OSEmaq+D8MoXLASTfsDc5P0CPwpOwtF79JjZR4Tg4VmacYy5C VmN21nxn3hDjQ/f+MEPXVTww6AuOtCqXkv+N2519X3ZqYLChmFmJkZA5icV7Tzo6X59Y +MJxvUblqmXRxIL8ttJDfqsaC8cWmklTWBK+/LRvlntaA5ZNMP4aCdFSg5q6b2bOs3ee Qeaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b="Ficx/77D"; 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=fail (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 e127si1645013iof.13.2021.07.28.18.14.51; Wed, 28 Jul 2021 18:15:01 -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=fail header.i=@quicinc.com header.s=qcdkim header.b="Ficx/77D"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233370AbhG2BN7 (ORCPT + 99 others); Wed, 28 Jul 2021 21:13:59 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:64145 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbhG2BNx (ORCPT ); Wed, 28 Jul 2021 21:13:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1627521231; x=1659057231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Ovw9WoZ0YrotwnPUK4JwpO7mOXRMGw27QHpFWOln15I=; b=Ficx/77DJdeWqcQ8qpgWP+NIU+WKNd7e79FXDmulb7Retq897HDgxeix Q074LRc0B7M7NZ9w4MW0NjplAep7RjqdaYZm0oeD6TdD39EPDnkp3tRG4 9gzdtizx2dR6+BaQVW33oAnGac43Y1JFw9xtQ63QvsfH+MKtUqMQQ2vrs M=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 28 Jul 2021 18:13:51 -0700 X-QCInternal: smtphost Received: from nasanexm03e.na.qualcomm.com ([10.85.0.48]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/AES256-SHA; 28 Jul 2021 18:13:51 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nasanexm03e.na.qualcomm.com (10.85.0.48) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 28 Jul 2021 18:13:48 -0700 From: Fenglin Wu To: , , CC: , , , Ashay Jaiswal Subject: [PATCH V1 4/9] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Thu, 29 Jul 2021 09:12:42 +0800 Message-ID: <1627521167-18848-5-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627521167-18848-1-git-send-email-quic_fenglinw@quicinc.com> References: <1627521167-18848-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 nasanexm03e.na.qualcomm.com (10.85.0.48) 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 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index c4adc06..59c445b 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -525,12 +525,18 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) u8 ee = pmic_arb->ee; u32 status, enable; int i, id, apid; + /* status based dispatch */ + bool acc_valid = false; + u32 irq_status = 0; chained_irq_enter(chip, desc); for (i = first; i <= last; ++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); @@ -548,6 +554,28 @@ 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 = pmic_arb->min_apid; i <= pmic_arb->max_apid; 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); + periph_interrupt(pmic_arb, i); + } + } + } + } + chained_irq_exit(chip, desc); } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.