From patchwork Tue May 30 12:38:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Gunda X-Patchwork-Id: 9754553 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1025602B9 for ; Tue, 30 May 2017 12:42:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B33662846A for ; Tue, 30 May 2017 12:42:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A799C2847A; Tue, 30 May 2017 12:42:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9702846A for ; Tue, 30 May 2017 12:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751879AbdE3MkQ (ORCPT ); Tue, 30 May 2017 08:40:16 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57224 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbdE3MkK (ORCPT ); Tue, 30 May 2017 08:40:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7B735608D4; Tue, 30 May 2017 12:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148009; bh=ByTPrQr3NEaF+TayT4OErnuEAcCVWa1IdNALGAn4yP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Av4tpY5WJvGMWLY54QFS1JrCPvbzl2SBNuqzTD3rPtwUHMQ1I/+U9DwoXNMQvO4xn nZwjMM9vWg7gKGqmkpnxNwEXbXuEJRutobBntBosVt1OZuROXB6JBgBNq1RyLzm5yl Mu6SP4P1mLDrCGAopFl0zAkh2TaVCErNU7VuBfjI= Received: from kgunda-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kgunda@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AD456608CF; Tue, 30 May 2017 12:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148008; bh=ByTPrQr3NEaF+TayT4OErnuEAcCVWa1IdNALGAn4yP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFCKrcZEeLoxOQG0ejX60y82VAyOmZ/blkB1oVQhhXfnUJHcwgkaBudwIQi8pby1W uXnbzQqm+hkHR+me6ODWwA7ML2WaTUA+EOAGl86jyjJo0jtUqV/dB6DWR8l8w5KW/p LQwGasZlhAd7UMshVpIELiamZ7DRwqnwLW/7ZxwI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AD456608CF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kgunda@codeaurora.org From: Kiran Gunda To: Kiran Gunda , Abhijeet Dharmapurikar , Greg Kroah-Hartman , Christophe JAILLET , David Collins , Subbaraman Narayanamurthy , linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, adharmap@quicinc.com, aghayal@qti.qualcomm.com, sboyd@codeaurora.org Subject: [PATCH V1 06/15] spmi: pmic-arb: fix missing interrupts Date: Tue, 30 May 2017 18:08:54 +0530 Message-Id: <1496147943-25822-7-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496147943-25822-1-git-send-email-kgunda@codeaurora.org> References: <1496147943-25822-1-git-send-email-kgunda@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Abhijeet Dharmapurikar irq_enable is called when the device resumes. Note that the irq_enable is called regardless of whether the interrupt was marked enabled/disabled in the descriptor or whether it was masked/unmasked at the controller while resuming. The current driver unconditionally clears the interrupt in its irq_enable callback. This is dangerous as any interrupts that happen right before the resume could be missed. Remove the irq_enable callback and use mask/unmask instead. Also remove struct pmic_arb_irq_spec as it serves no real purpose. It is used only in the translate function and the code is much cleaner without it. Signed-off-by: Abhijeet Dharmapurikar Signed-off-by: Kiran Gunda --- drivers/spmi/spmi-pmic-arb.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 0a5728c..bc03737 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -588,17 +588,6 @@ static void qpnpint_irq_unmask(struct irq_data *d) qpnpint_spmi_write(d, QPNPINT_REG_EN_CLR, &data, 1); } -static void qpnpint_irq_enable(struct irq_data *d) -{ - u8 irq = d->hwirq >> 8; - u8 data; - - qpnpint_irq_unmask(d); - - data = BIT(irq); - qpnpint_spmi_write(d, QPNPINT_REG_LATCHED_CLR, &data, 1); -} - static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type) { struct spmi_pmic_arb_qpnpint_type type; @@ -647,7 +636,6 @@ static int qpnpint_get_irqchip_state(struct irq_data *d, static struct irq_chip pmic_arb_irqchip = { .name = "pmic_arb", - .irq_enable = qpnpint_irq_enable, .irq_ack = qpnpint_irq_ack, .irq_mask = qpnpint_irq_mask, .irq_unmask = qpnpint_irq_unmask, @@ -657,12 +645,6 @@ static int qpnpint_get_irqchip_state(struct irq_data *d, | IRQCHIP_SKIP_SET_WAKE, }; -struct spmi_pmic_arb_irq_spec { - unsigned slave:4; - unsigned per:8; - unsigned irq:3; -}; - static int qpnpint_irq_domain_dt_translate(struct irq_domain *d, struct device_node *controller, const u32 *intspec, @@ -671,7 +653,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d, unsigned int *out_type) { struct spmi_pmic_arb *pa = d->host_data; - struct spmi_pmic_arb_irq_spec spec; int rc; u8 apid; @@ -686,10 +667,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d, if (intspec[0] > 0xF || intspec[1] > 0xFF || intspec[2] > 0x7) return -EINVAL; - spec.slave = intspec[0]; - spec.per = intspec[1]; - spec.irq = intspec[2]; - rc = pa->ver_ops->ppid_to_apid(pa, intspec[0], (intspec[1] << 8), &apid); if (rc < 0) { @@ -705,9 +682,9 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d, if (apid < pa->min_apid) pa->min_apid = apid; - *out_hwirq = spec.slave << 24 - | spec.per << 16 - | spec.irq << 8 + *out_hwirq = (intspec[0] & 0xF) << 24 + | (intspec[1] & 0xFF) << 16 + | (intspec[2] & 0x7) << 8 | apid; *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK;