From nobody Mon Apr 6 14:54:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 410BDC433F5 for ; Fri, 30 Sep 2022 00:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbiI3Auw (ORCPT ); Thu, 29 Sep 2022 20:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbiI3Au2 (ORCPT ); Thu, 29 Sep 2022 20:50:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6ACC5A8B5 for ; Thu, 29 Sep 2022 17:50:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 15E0EB824C2 for ; Fri, 30 Sep 2022 00:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F822C43141; Fri, 30 Sep 2022 00:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664499021; bh=h409O7MuFLd1R61Cty/K7nU8QRAFuS/SVZNLRXmCENc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JAk6c6zc1p79t1K11l/7dq2q4WAISTuoGI6iVo6I/QPLVZjJ6qQNXsclw2B7oac5D gnyKhhL2rANgr15f1hGG31cR2o2/Lzt0HRP1/UKeVq7sPpNC4Fr03d2y/mMYljlqpj VSFOq0yOOVsOado9BtDJTss34j3/25KqDbSn10fnEEUtFf+R2Icw6wOnbCQA7930e+ kzO3bUEi5UU1W4nOyxVACFzLVfycLPQUAYV48CLsmi+XMUdDpN4ni9CU66yh3a89Vn jdjLqwsPFHlMWJk5plJvzeJzKlP2s81+S/rlK3O+MnvZVTSJuGmcsmAKQD7WebQmkq wuTMxWsZMYFPw== From: Stephen Boyd To: Greg Kroah-Hartman Cc: Ashay Jaiswal , linux-kernel@vger.kernel.org, patches@lists.linux.dev, David Collins , Fenglin Wu Subject: [PATCH 6/9] spmi: pmic-arb: add support to dispatch interrupt based on IRQ status Date: Thu, 29 Sep 2022 17:50:15 -0700 Message-Id: <20220930005019.2663064-7-sboyd@kernel.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20220930005019.2663064-1-sboyd@kernel.org> References: <20220930005019.2663064-1-sboyd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Link: https://lore.kernel.org/r/1655004286-11493-6-git-send-email-quic_feng= linw@quicinc.com Signed-off-by: Stephen Boyd --- 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 e19eaec30aa5..56f22941d570 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 *des= c) u8 ee =3D pmic_arb->ee; u32 status, enable, handled =3D 0; int i, id, apid; + /* status based dispatch */ + bool acc_valid =3D false; + u32 irq_status =3D 0; =20 chained_irq_enter(chip, desc); =20 for (i =3D first >> 5; i <=3D last >> 5; ++i) { status =3D readl_relaxed( ver_ops->owner_acc_status(pmic_arb, ee, i)); + if (status) + acc_valid =3D true; + while (status) { id =3D ffs(status) - 1; status &=3D ~BIT(id); @@ -653,6 +659,29 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) } } =20 + /* ACC_STATUS is empty but IRQ fired check IRQ_STATUS */ + if (!acc_valid) { + for (i =3D first; i <=3D last; i++) { + /* skip if APPS is not irq owner */ + if (pmic_arb->apid_data[i].irq_ee !=3D pmic_arb->ee) + continue; + + irq_status =3D readl_relaxed( + ver_ops->irq_status(pmic_arb, i)); + if (irq_status) { + enable =3D 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=3D%d status=3D%x\n", + i, irq_status); + if (periph_interrupt(pmic_arb, i) !=3D 0) + handled++; + } + } + } + } + if (handled =3D=3D 0) handle_bad_irq(desc); =20 --=20 https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git