Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4921729pxv; Tue, 27 Jul 2021 21:35:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzntVayUUjoFY75Hs02aza9j6S3zrz8p8KncvCfbHcXCPu2E2yrGtKRAnl230qTFLKMqx0d X-Received: by 2002:aa7:cb9a:: with SMTP id r26mr32044443edt.78.1627446929998; Tue, 27 Jul 2021 21:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627446929; cv=none; d=google.com; s=arc-20160816; b=wzppxm2a2UkaZM9WyVgF0iyomQdF/G9wup25puibEGX3RaWhKKlH9wMZN1RTup4Td0 4pGRNSlOjOOr9PTcSJXDTrE0HWH3S7ryL5CX0YHAAf1svDdsSitCjhNfX2M4MANYTu57 WtKGSE8X0k7ZQAbdx2hp0d8NF2J/CaqwR0PMPgqW0oYht+eWUYZuOlKH+Fmvx4WTrSLn qnfWa3sTftwQ7T7m8n1PYjniUzCGlsdEkAm0pUi17LRpXWSxla3/WQsIPCCirh8CPOoK nUSxe6qG9XUniPoG75v4Zaa0LkTchFfA1VmWuBwlizn1c60uKv4dX/0IOuPLqE1aVz8M 3KaQ== 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=b8i4zepPuT6KQbvQPE41XM0OROsJPEjZ+k2uxd84LeC3XDlrSHSTHT4JiiAst3IIVm h9aKfgQUst3tjC5TPuF8j1p1j8ptYO6UpGzsu81eh5ZIHUF5OXkBpNvli2S19f8mBrd8 B7byb2ZpE2K72mqEs3A/8Wydk+TmAgTuYwAVN1psQudBtBR9J1yoTiMvY9f9Wf0F5mFR 4fn36pgrRs0sSWbISquM60cy+UaxSc4ZXZenCC78SqU7pNgXCOnDgTlDwz6zIepsCmn/ 3xQhU5IBn0yHALk84p5hTh5i6I0Fh4rMmS4gZXBWXt2c20CKKRdRO7y9wUi+sGRbZNHm MWQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=zjHvxLuS; 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 a17si4764215ejb.749.2021.07.27.21.35.07; Tue, 27 Jul 2021 21:35: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=zjHvxLuS; 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 S234194AbhG1Eay (ORCPT + 99 others); Wed, 28 Jul 2021 00:30:54 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:13787 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbhG1Eat (ORCPT ); Wed, 28 Jul 2021 00:30:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1627446648; x=1658982648; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Ovw9WoZ0YrotwnPUK4JwpO7mOXRMGw27QHpFWOln15I=; b=zjHvxLuS1hbHoMjS4m5xZZHBzAQF3dTN/BJ8swyKZXOBHQQdy2LE+kDZ A5iMt9tYGrzDDs/b6Ym+V4u4Lxr7x8ZaMNd6kApM5eMwVrqDcIenL4IeG JeYQQHirH3mfzA9chL+REICgqzuiHhfXFvvCbhfjobau6sI7f+2+KwqON M=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 27 Jul 2021 21:30:48 -0700 X-QCInternal: smtphost Received: from nasanexm03e.na.qualcomm.com ([10.85.0.48]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 27 Jul 2021 21:30:48 -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; Tue, 27 Jul 2021 21:30:46 -0700 From: Fenglin Wu To: , , "Stephen Boyd" CC: , , , Ashay Jaiswal Subject: [spmi-pmic-arb fixes and optimization patches V1 4/9] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Wed, 28 Jul 2021 12:30:04 +0800 Message-ID: <1627446609-9064-5-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627446609-9064-1-git-send-email-quic_fenglinw@quicinc.com> References: <1627446609-9064-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: nasanexm03g.na.qualcomm.com (10.85.0.49) 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.