Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4921069pxv; Tue, 27 Jul 2021 21:33:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdImRkSlhcp8YyJBmUe0h1DAJ9BaYGbtzyMFb9Znh7V+m9IPk93fEoxuNHzx60LwVgS00G X-Received: by 2002:a17:906:40d5:: with SMTP id a21mr19926569ejk.325.1627446835450; Tue, 27 Jul 2021 21:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627446835; cv=none; d=google.com; s=arc-20160816; b=DFhiODl+aJpwqHFwzGsWlP76Zt9fWLpQ06XXzYoPcMpxDVPmcviZMxea3aFJl1cWDM RZofvrwB6HTfcjZD+4395lYa2N0D71I11ibcPo4fwu1Ij3GEoq6t2niaWiMKRIUEBMdk pj60NTZgALz1UPss18szjoB55KWWxrwbuH2XYPAxtGA/WtCWN4uzW0nUUssp8h2x0pt0 nb/7qAD8/ObsF7fYRewFmiFWom6qFd0wuFLG5ku0vq2V39wMEjqaQBTrKDsvEbJrPl0g z/mGhq9mFlgQgdGmXyx15ZIJbKsIFzbHJFeBsWtyROT1NyN6FixtyOVYIp2yPXfUSQTm nc9A== 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=DuFJTMIgnE6qkb5/qXuxRtYziawNZCDPFG0x0p2dOEM=; b=oAB4G767QbUV2pBkW43GIhxvdUN8xpDtoipprMwdHJileFY0CMBqkBfzouA8mK+wRR TR4thPdBGHXCK4z1ncCwxa0pMLxFYue0MRL7fl1zhhXFfPbvfp1P1vA8Y8iAgade6hlq EnLNdoSl9H3AxolBsmGOV8z9Og6ZBBbgKKFy/J027MA7SzFSYjY8IqdQ2xia3t8yS+95 hl2fFAuNAYbQjL23dXVUdYkh5IzQu41BJKk7LaCLq7yT9/bmdeK/EQ4jbrDcANmSNQSl swXtIc1z5k8f+6/Bis37TBqQq2LFGKNG8FPGrZl/1rZiRWyEMwggubGJMiGfJKpqHGjo +LiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=faP67nMh; 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=fail (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 gy12si4630798ejb.580.2021.07.27.21.33.30; Tue, 27 Jul 2021 21:33:55 -0700 (PDT) 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=fail header.i=@quicinc.com header.s=qcdkim header.b=faP67nMh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbhG1EbD (ORCPT + 99 others); Wed, 28 Jul 2021 00:31:03 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:35713 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbhG1Ea5 (ORCPT ); Wed, 28 Jul 2021 00:30:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1627446656; x=1658982656; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=IWJ0A04ElihV+hsa8p2cu+aTFCm2Gzo/yxHhJJUCiV0=; b=faP67nMhBZLMqhSeJD0c3PRxqRssnZ+HN9euhIi+dT0aXzkh21AXusOY M6aGjyPmdfhYLg5CBoS4qtLr6PifeAG29JEXQtQqktjphsL7FTSe4OirV ksSef8/X9evkXELvl2ZWQZ7pIyUD3OMcos2t2M0s0QZc03JSJJmc1bRyO Y=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 27 Jul 2021 21:30:56 -0700 X-QCInternal: smtphost Received: from nasanexm03e.na.qualcomm.com ([10.85.0.48]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/AES256-SHA; 27 Jul 2021 21:30:56 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nasanexm03e.na.qualcomm.com (10.85.0.48) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 27 Jul 2021 21:30:54 -0700 From: Fenglin Wu To: , , "Stephen Boyd" CC: , , , Yimin Peng Subject: [spmi-pmic-arb fixes and optimization patches V1 7/9] spmi: pmic-arb: support updating interrupt type flags Date: Wed, 28 Jul 2021 12:30:07 +0800 Message-ID: <1627446609-9064-8-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627446609-9064-1-git-send-email-quic_fenglinw@quicinc.com> References: <1627446609-9064-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: nasanexm03g.na.qualcomm.com (10.85.0.49) To nasanexm03e.na.qualcomm.com (10.85.0.48) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yimin Peng Have the qpnpint_irq_set_type function clear unwanted high/low trigger bits when updating the interrupt flags. Signed-off-by: Yimin Peng Signed-off-by: Subbaraman Narayanamurthy Signed-off-by: Fenglin Wu --- drivers/spmi/spmi-pmic-arb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 9239830..988204c 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -636,8 +636,12 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type) type.type |= BIT(irq); if (flow_type & IRQF_TRIGGER_RISING) type.polarity_high |= BIT(irq); + else + type.polarity_high &= ~BIT(irq); if (flow_type & IRQF_TRIGGER_FALLING) type.polarity_low |= BIT(irq); + else + type.polarity_low &= ~BIT(irq); flow_handler = handle_edge_irq; } else { @@ -646,10 +650,13 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type) return -EINVAL; type.type &= ~BIT(irq); /* level trig */ - if (flow_type & IRQF_TRIGGER_HIGH) + if (flow_type & IRQF_TRIGGER_HIGH) { type.polarity_high |= BIT(irq); - else + type.polarity_low &= ~BIT(irq); + } else { type.polarity_low |= BIT(irq); + type.polarity_high &= ~BIT(irq); + } flow_handler = handle_level_irq; } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.