Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5443104pxb; Wed, 26 Jan 2022 12:05:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcMTefhOUo2/hxWnC4Y7q9N2FpN5cIXCjZaaNorX9PkjziDFf4VQAeFgKQiUtAQTIyqmgU X-Received: by 2002:a63:1262:: with SMTP id 34mr411532pgs.194.1643227542043; Wed, 26 Jan 2022 12:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643227542; cv=none; d=google.com; s=arc-20160816; b=H53eJaqwJVqu1Og8GQtCx+LY9I9M5aR2OLT3IK/NVeGl03ScbKHP6CkZtSnJPeW1aE LJAcvZV1SWfN9+KlckJlU7s/5cGcCzbRjzCDtOaX4pbTZ4Y9uiMm4/pIeqvMBLaFDhho nkaiKt29QV4SCyGYN2yBuLQuUbNguhnxuk/Ikh7U4OUVNH4WRpRRoG28I6iOAXTZ0U7z jLtMq5D8ajYrHQnDexk/jDf2ZUeO9TupDvMTEZs4U1dWfQVQsr1ntacEqFgn6IOCaeHF qzT9DVemT60US+4SCyzR0BQbsgUXugE3Wk+H0fasxptHu1m//c33Ih4ttNv+2q0X3zoq oQ0w== 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=vFm/1iPltzV2y4DMijEhe5IyJTZ/LWY1V45aTZ9IiEs=; b=uJppoQf1ZI6diLJeYnBeF+lxn4hgIiDEYrRJdZ5mTYmWswrTUrWzk5lu03ZzRx/9Ge f23VOjym5X7VsgNAg+t31GEwEB6qCF1x3eG/ncLDCYlrTjiRaUtAvTnlPpwMVPe3ohHu 35nF9Gj7dnRpZZ1yFO3RpI9HcifB5+OHTbLhOqkJgExMu7UAIEgRFuiTKh8BA5tH0dZ+ nq4tYqX0ap9hHMai1NOVy/kNB9UYOOONipwO3Zy3GWf8GHlhzS9Xm68aVF27TwPTprU7 etQwVj0/Ls/rYzZkFZaMQsFgloV58Mi74ioZz0H7zUgBF50FjHL64YiSiyaa+rDmxIN8 EXUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ZtWMyWX8; 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 z1si157168plk.513.2022.01.26.12.05.26; Wed, 26 Jan 2022 12:05:42 -0800 (PST) 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=ZtWMyWX8; 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 S236121AbiAZGcw (ORCPT + 99 others); Wed, 26 Jan 2022 01:32:52 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:48556 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbiAZGcu (ORCPT ); Wed, 26 Jan 2022 01:32:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1643178770; x=1674714770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=vFm/1iPltzV2y4DMijEhe5IyJTZ/LWY1V45aTZ9IiEs=; b=ZtWMyWX8QrCQyZ/O0lxDavgYmxsdk6D0rI695G/IRQifSzVhYthgQJPx iQcoedPrMUqYvkik2aVXa5FHg2ZcgSkLbSe2h4TDMFB47NtD+xlNEXzQ1 khfJ7YXDDOeHv9gtnVrEOtQzSNKKoImCT8E8GYxiCX7QKuQ8jbo5XsK/d k=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 25 Jan 2022 22:32:50 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:32:50 -0800 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.922.19; Tue, 25 Jan 2022 22:32:50 -0800 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.19; Tue, 25 Jan 2022 22:32:47 -0800 From: Fenglin Wu To: , , CC: , , , , , "Ashay Jaiswal" Subject: [PATCH v5 05/10] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Wed, 26 Jan 2022 14:31:47 +0800 Message-ID: <1643178713-17178-6-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1643178713-17178-1-git-send-email-quic_fenglinw@quicinc.com> References: <1643178713-17178-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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 e19eaec..56f2294 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -630,12 +630,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); @@ -653,6 +659,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