Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5442695pxb; Wed, 26 Jan 2022 12:05:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDrt+MuHNQoXGtu+M74s+MSecCJtA+iWFcZai8KouCqGfzWYwjDe1SOrl5O29FWGanPX7D X-Received: by 2002:a63:338e:: with SMTP id z136mr394843pgz.510.1643227511810; Wed, 26 Jan 2022 12:05:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643227511; cv=none; d=google.com; s=arc-20160816; b=k3poc2i6nA1mBWDPUg2sNVD7UYJ96VSCreRiydsszf49CKHWtqLorey870KNp6re0O F1xgeM7DtYHkynNDGbAEqhsspXX0m7mc5/zJnablKPam6CPmN+YA7pmP3Yq54OEeKlDR LS5TGap2Xb0WeppKPCs4Wqmw/xVbpGLhOmmoUA6KVex4C0g/mcpIdfQCnfjlETRd3lHb FR0fm2yEmQewlB7tMMcVxqHwJuq0m5w9AD8aec0g6FHcRIEC0Qx91KEIVID5HItXxgYg yVFk4wRF2Zh8QzV7f8/2zpadxuyE8UN42hnBjJNahDFnYuEwsZtvjU/64dmXKM/G7yls OYyA== 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=qGycQEIcuXn1iBDods404/PteGNjF9EX6WPls8vi1xjFYxkWJ9e7xckP1Jtg/59Ag5 vRH197WkR3SaJOwx1qFVYJirNl1pYI4lO+diGNaGQ29JkM9GuD3dlFGy1SFBTzJIdyQQ 2pKK3xYl+9drsbJKusCJu94dnXzpTTFVJidqAns7y+CpqMLoBj5pZjXMp9fBWF7VO3jN 93sbEsrTObB57WpHm/Eau1JOwmIkf5ilCnuXrD6ddsWy9a6JvZyL0JE2eALrnFJGO4Q5 wVXe0Z2oXYLZOod+tODlkeoAXS+nUVc517RLutcqApx0j+iLZ3//6zDCbA7A9F9a5aP0 re/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=c8mUcMCB; 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 y4si225241pfa.331.2022.01.26.12.04.59; Wed, 26 Jan 2022 12:05:11 -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=c8mUcMCB; 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 S235941AbiAZGcm (ORCPT + 99 others); Wed, 26 Jan 2022 01:32:42 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:48499 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235842AbiAZGcl (ORCPT ); Wed, 26 Jan 2022 01:32:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1643178761; x=1674714761; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=g3rY4bpEO25fMFkUyVjEe7VfSZehXBwtx/lekwobvxU=; b=c8mUcMCB+ghOS3fxuWg4JaZuOIEv8GiLIlsrPkesddgIgZc+5zaxzI8D SC7wA77KyHslwd/Ym8xI81bc82cWCc5VybGxgINWxYOMeSGPo1E4MnXcm WPTQTTpP0ciH417v1oCsEDyiT7dPHB9xjYIAlP32hThbnnzoyQ6ez9Wry 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:41 -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:41 -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:40 -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:37 -0800 From: Fenglin Wu To: , , CC: , , , , Subject: [PATCH v5 02/10] spmi: pmic-arb: handle spurious interrupt Date: Wed, 26 Jan 2022 14:31:44 +0800 Message-ID: <1643178713-17178-3-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 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