From patchwork Tue May 30 12:38:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Gunda X-Patchwork-Id: 9754521 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 2248F602B9 for ; Tue, 30 May 2017 12:40:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 155E62848B for ; Tue, 30 May 2017 12:40:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 046F828485; Tue, 30 May 2017 12:40:25 +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=ham 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 A15402847E for ; Tue, 30 May 2017 12:40:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbdE3MkX (ORCPT ); Tue, 30 May 2017 08:40:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57450 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbdE3MkT (ORCPT ); Tue, 30 May 2017 08:40:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C4202607C8; Tue, 30 May 2017 12:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148018; bh=S3LiU+WxkBr2/jMDTNDAdN6XemgpB9hBEFp2uO4zzo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mVFyOn2zOYZU4kkWta90wxs+SuVT0kB7KuXZyAR+d5UlLkzsUh/ejLxRK/BvS3TOf Ea43a1uo492JkpMPILzLx6pTAoSAhBTz8xdNye/gv9WsaMctkjQLDr9Ahl9KdltsXS okBlc77EJzvE2EG/82PyBRktHY7RwXFJvIZzGDWU= 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 A00F560818; Tue, 30 May 2017 12:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1496148018; bh=S3LiU+WxkBr2/jMDTNDAdN6XemgpB9hBEFp2uO4zzo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mVFyOn2zOYZU4kkWta90wxs+SuVT0kB7KuXZyAR+d5UlLkzsUh/ejLxRK/BvS3TOf Ea43a1uo492JkpMPILzLx6pTAoSAhBTz8xdNye/gv9WsaMctkjQLDr9Ahl9KdltsXS okBlc77EJzvE2EG/82PyBRktHY7RwXFJvIZzGDWU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A00F560818 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 , 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 08/15] spmi: pmic_arb: use appropriate flow handler Date: Tue, 30 May 2017 18:08:56 +0530 Message-Id: <1496147943-25822-9-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 The current code uses handle_level_irq flow handler even if the trigger type of the interrupt is edge. This can lead to missing of an edge transition that happens when the interrupt is being handled. The level flow handler masks the interrupt while it is being handled, so if an edge transition happens at that time, that edge is lost. Use an edge flow handler for edge type interrupts which ensures that the interrupt stays enabled while being handled - at least until it triggers at which point the flow handler sets the IRQF_PENDING flag and only then masks the interrupt. That IRQF_PENDING state indicates an edge transition happened while the interrupt was being handled and the handler is called again. Signed-off-by: Abhijeet Dharmapurikar Signed-off-by: Kiran Gunda --- drivers/spmi/spmi-pmic-arb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 1d23df0..ad34491 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -625,6 +625,12 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type) } qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type)); + + if (flow_type & IRQ_TYPE_EDGE_BOTH) + irq_set_handler_locked(d, handle_edge_irq); + else + irq_set_handler_locked(d, handle_level_irq); + return 0; }