Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1145684pxb; Thu, 19 Aug 2021 22:00:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZNXAzx9z69PesSuOHnQmQIpp/C/gYeTD6x1bE5riFXQ3xjuGn4V3kBr9/8NZHw/kkhbrA X-Received: by 2002:a05:6638:10c7:: with SMTP id q7mr15786282jad.97.1629435629683; Thu, 19 Aug 2021 22:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629435629; cv=none; d=google.com; s=arc-20160816; b=Uf4cm8RUL7E6UY79frnTmS8Rbbq3Kaut2nQf805RiDpHeBm4SP5rDBvZHv038ydA96 zBH1b0Dr5fkV/LZp2uleb49i5sw2LW3627p0wOax/UdTl80tFDaT7L6SvoGi4XG0abaw 5rKhj0oIV1jaM5IcNQTi6lwDBg99W5FxoiBsAJ+bd04YQuWuVDrdYsMg3eexpczOLXBx ewaR9Nl9O2evxMm/axCv84/HEJC/HRH000uwjIhOhky4ao77+OB2A78cStgdn3tdGn9F RXfFhev1z20PTCGScxUBt4klay/IIMbYcFV1vqnE1g0C7Es7XPhxYcp+3JUw6pXz98wc WPbA== 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=Lo+YrF9btNsDhGn7i6fVe7AHBFubzzk7Qfb7tmRKfSnwl7c1nwGZpB5fTdYzGGsLgG JWHYnzK9lnhiqXgyLWzyMbr/c5WW1t170jbPfCnSToTe5wjMClqHp2rFoBGxEPjM5rwL iiwWVJobFRW2wxlo7LlXMfrJ2l6yIRtLC4uRB6oplSUauFWjlfKgN4csgOXQgfw5Bsx6 0a+6ECopgWBJ9+E/6XLJztp2RTBxSNwodZungcXfF90QFZzB5it+thg25QjhP3Y6+bbr F3lTD/C4F8jKW1EBaMlqa9LupU+AH4xeK8Tr/1M/Y2iYgI69TblNM8YhPaVvqp1Nw/td JNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=uomQ06ag; 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 i7si5099088ilk.127.2021.08.19.22.00.03; Thu, 19 Aug 2021 22:00:29 -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=uomQ06ag; 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 S238288AbhHTE70 (ORCPT + 99 others); Fri, 20 Aug 2021 00:59:26 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:43416 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235904AbhHTE7V (ORCPT ); Fri, 20 Aug 2021 00:59:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1629435524; x=1660971524; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Ovw9WoZ0YrotwnPUK4JwpO7mOXRMGw27QHpFWOln15I=; b=uomQ06ag3rVfKIfhxVcZ21Ve/xdxVo9dBowUy5d+gbDruDZLB33Et/oJ crXh4JJBA3mZbV+Bv8MQb5itMFj/ByWEWsCXtcRkOOE77BFQpGnUfS0JJ 9aVHeMtfUBwUWYXuGRyXCzZmaszpo0zzzginc7cJfkuZSghDxFBnsrpYh s=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 19 Aug 2021 21:58:44 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2021 21:58:44 -0700 Received: from nalasex01c.na.qualcomm.com (10.47.97.35) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Thu, 19 Aug 2021 21:58:44 -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_CBC_SHA384) id 15.2.858.15; Thu, 19 Aug 2021 21:58:41 -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: Fri, 20 Aug 2021 12:57:59 +0800 Message-ID: <1629435488-10228-5-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1629435488-10228-1-git-send-email-quic_fenglinw@quicinc.com> References: <1629435488-10228-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: nasanexm03h.na.qualcomm.com (10.85.0.50) 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 | 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.