Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp406452pxb; Wed, 1 Sep 2021 01:21:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypjTghXhRXQ3PG9UJ8UB12SGPRP9PVMNaGFq4mkyKDxzIdSjcQXwiUPGbSoc/bPsuDyxUS X-Received: by 2002:a5d:8f91:: with SMTP id l17mr26597963iol.121.1630484475372; Wed, 01 Sep 2021 01:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630484475; cv=none; d=google.com; s=arc-20160816; b=bh03i3pZ1FFT2JHLrEOY3D4hZXWi0Q+9StNGWalj0Os7WtTe/3sckmef54VDDPmNtC NdWJ3O7qUO2nc0ypWPWvlVt3d06BLWv6ZsE0SyCLNMlL/2aA5ZxfVqh8SJkXVaiQzCKv 9fcdUuPXmkNg+Dov//J57kC6Haf20bMr61UMEdKgwEsVZSi8KXjszouui8FXNzCePFag +hiwoMqSdDhtXCfuJkbb6xdBBwTlG3lrZWJM5UVutuuisqsbBpfoF8GxQN2LooXjaBjX 1IMcEJvV5Hu/LyWwTtFhW2/zNIDMnzNQjROsYbl3X9eqNBX63bmXDyy0Y7w+FJVuFqtq zqeQ== 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=p82VOXmbjdo886MdyqYqr8kAUG2iDKw6pyvPODt1jVg=; b=hS4wpwEgXMp+8LWHArYEKUke/U8xTU4swy3SNyR8nUWwPCDA931m7CutKpw6lHqp0+ 9cOvxPEBGsg40QvMKd7beNu0MTjLpx010Ov0M/FcgBZzrQvnlcMVv/R+UxR4mn/PkI7m tk6bfOPB40IMZsroWteDj/fMvOdfQntGbK9xb59DLTkw6nCyslwBEBMF2uMmFh3FCAiS Ga4RXKROOj3b3pxWAnQUsZgCiPz9Pvb7RwHSIb55Dh86zZXMLf7RyC+877C2gucvD/AJ j81OqsdBBTFrEEc+c7D84Q9NkJ8L5mmn8WR2egmLcHEZPJ8AtuHJeoPJ1HMtqhf1qpEU +gpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=yMoy5hIC; 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 g1si19970493ile.140.2021.09.01.01.21.03; Wed, 01 Sep 2021 01:21:15 -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=yMoy5hIC; 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 S243147AbhIAIU2 (ORCPT + 99 others); Wed, 1 Sep 2021 04:20:28 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:17574 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243113AbhIAIUR (ORCPT ); Wed, 1 Sep 2021 04:20:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1630484361; x=1662020361; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=p82VOXmbjdo886MdyqYqr8kAUG2iDKw6pyvPODt1jVg=; b=yMoy5hICfzs1p9h9k7swZFT/enG0EOu6xGhNHjkPb//HWsL2CXNtisVF yFmjpd9Tl/huaEotnCaRelJjxffHDJevvCmenPrQ2wCEX8XXMFf43ulLL olOLoPA8FtNlj3XxL8LOEiyG55j40lIaPYrk47Z9sdh4mIV7rBkP4OSI8 c=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 01 Sep 2021 01:19:21 -0700 X-QCInternal: smtphost Received: from nalasex01c.na.qualcomm.com ([10.47.97.35]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2021 01:19:20 -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; Wed, 1 Sep 2021 01:19:17 -0700 From: Fenglin Wu To: , , CC: , , , Ashay Jaiswal Subject: [RESEND PATCH v1 4/9] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Wed, 1 Sep 2021 16:18:05 +0800 Message-ID: <1630484290-28190-5-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1630484290-28190-1-git-send-email-quic_fenglinw@quicinc.com> References: <1630484290-28190-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 | 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); } -- 2.7.4