Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp986619pxp; Wed, 16 Mar 2022 23:33:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySHMg32yzpDEmgfY6Gvw5ZWCjj9aAtq0xPlcCX5vfxMSwnAmBQdVCFonF1AbguKB/Lnwzb X-Received: by 2002:a63:b10:0:b0:373:393f:2015 with SMTP id 16-20020a630b10000000b00373393f2015mr2538218pgl.322.1647498810712; Wed, 16 Mar 2022 23:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647498810; cv=none; d=google.com; s=arc-20160816; b=wuESh25xXVBoQ9PY8o0Fu/huX4ewo2StR1OMN79m6yO+9Zxhm2OMMdqrYNWBKlYVCE e36LMjtVS7BcJgrUDYc27HvHgJuF8OmckaOJyzXJM9uBEx3B9t4AFObkQdwFvb83Ro8E DiIOrty9vQ8aOFJodNzJrjsNudON38nr//VumlbTr8+CCT5OQNwwniii9KYUCmpzV8G/ 45MRKTtA5ClRimkL7GnDVypquOKPzHoMYqj9U5kcccXp8n0plXfq4IycVcshfiQzjo6b AfGsxEzeaV089+Jbmj1q/KlRZUDk6SuWpTlZ54ry/YQq5aHxB3sF0aMP28RhHpq+JYPt JhCQ== 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=g3rY4bpEO25fMFkUyVjEe7VfSZehXBwtx/lekwobvxU=; b=mAS0vL+4F9GPDsPqQx1Mi7UuZ8o2kBpL6dRzbvTLxTvCFq22h0yAtYDM0yU29nrHIu Pvs63y273/7uczYjuFI+p6WnPxOfGLXRoZNM54NzSZhEXtAYjlNwEHfLekPOT0lFqgHW 3FCc2Wn7mL3y/LysqwBsmGT+DxAjQ/k0QFb3hF5ko/mvzGl6AvNi3SxxZyw9tbWJMUVq +MJfqS7w1g2zL9lA5zg1N4FSpKOVpOnv4bFg3D+HFMNfgEis5DFgtx3pQawvvI+xnIED 4RSLAdUBIyzTOxP+3PPg++ToaPscAELrHke+NhpLNltNZsSpAwssxigf+b0eA4mJMJ3H ymmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=rXlrHRHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a63da4d000000b003816043f083si1135094pgj.632.2022.03.16.23.33.18; Wed, 16 Mar 2022 23:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=rXlrHRHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229890AbiCQGXq (ORCPT + 99 others); Thu, 17 Mar 2022 02:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229952AbiCQGWb (ORCPT ); Thu, 17 Mar 2022 02:22:31 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6AEA124C31; Wed, 16 Mar 2022 23:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1647497565; x=1679033565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=g3rY4bpEO25fMFkUyVjEe7VfSZehXBwtx/lekwobvxU=; b=rXlrHRHmzQnU3ht4Bxiy29SY8IystGc47XfhacjmpOSI/Vu6H2r/jN8R 0ZZ8RAdodDK1t+16dwalONmpTpA4P9ldSdAMtQHLyN6tdh0PlWRz4lpWi XstydSevZ9xb2p+BAuTmFDBhTHk8tJ/NMEx7uRn8CGx65YRg75eAhIKOx Y=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 16 Mar 2022 23:12:45 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 23:12:45 -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.986.22; Wed, 16 Mar 2022 23:12:45 -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.986.22; Wed, 16 Mar 2022 23:12:42 -0700 From: Fenglin Wu To: , , CC: , , , , Subject: [PATCH v6 02/10] spmi: pmic-arb: handle spurious interrupt Date: Thu, 17 Mar 2022 14:12:07 +0800 Message-ID: <1647497535-32151-3-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1647497535-32151-1-git-send-email-quic_fenglinw@quicinc.com> References: <1647497535-32151-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) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call handle_bad_irq() when the summary interrupt is fired spuriously. Signed-off-by: Fenglin Wu --- drivers/spmi/spmi-pmic-arb.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 5a99723..719bd73 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -605,10 +605,11 @@ static void cleanup_irq(struct spmi_pmic_arb *pmic_arb, u16 apid, int id) irq_mask, ppid); } -static void periph_interrupt(struct spmi_pmic_arb *pmic_arb, u16 apid) +static int periph_interrupt(struct spmi_pmic_arb *pmic_arb, u16 apid) { unsigned int irq; u32 status, id; + int handled = 0; u8 sid = (pmic_arb->apid_data[apid].ppid >> 8) & 0xF; u8 per = pmic_arb->apid_data[apid].ppid & 0xFF; @@ -623,7 +624,10 @@ static void periph_interrupt(struct spmi_pmic_arb *pmic_arb, u16 apid) continue; } generic_handle_irq(irq); + handled++; } + + return handled; } static void pmic_arb_chained_irq(struct irq_desc *desc) @@ -634,7 +638,7 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) int first = pmic_arb->min_apid >> 5; int last = pmic_arb->max_apid >> 5; u8 ee = pmic_arb->ee; - u32 status, enable; + u32 status, enable, handled = 0; int i, id, apid; chained_irq_enter(chip, desc); @@ -649,10 +653,14 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) enable = readl_relaxed( ver_ops->acc_enable(pmic_arb, apid)); if (enable & SPMI_PIC_ACC_ENABLE_BIT) - periph_interrupt(pmic_arb, apid); + if (periph_interrupt(pmic_arb, apid) != 0) + handled++; } } + if (handled == 0) + handle_bad_irq(desc); + chained_irq_exit(chip, desc); } -- 2.7.4