Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2236182ybi; Thu, 20 Jun 2019 11:21:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzATSAk73buo52K7RNakXFaxuZq23sfZRcLGAvY4EqjrPAgckXpjGz9sf62e+f9gvODFOn4 X-Received: by 2002:a17:902:2869:: with SMTP id e96mr121590343plb.203.1561054889181; Thu, 20 Jun 2019 11:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054889; cv=none; d=google.com; s=arc-20160816; b=vALWhq7h5sogP0YUbtNW3n7zg9SX7S2N37TX4xUYazDSbxjkFLFIgDWPBco1VdJNFd WMMBwNmFnsnDIsfHTO1CfYHGyWixaqrE3WpdvRYONidcVWVn0tuC4SIQVTvCMkyJcl31 XaFQEKphuOdOdGoEzw9k5gA2uivyX1IMES9JFpe8Gk8sDTWqeyc/f62ppFc2ef0+vdpU i2mxq++kbW2srsSe9WrIFe3GQF7TfTTQv+vnOOt/bjP4yUnEkP3DXD4nIdgT5jglkLrh FQ+pzm1AYC1U5A5fPZqf8OQNziVuTjFn6bwe8smQwUIXXlfzfJSuLFPfBSk+IqfhtD9S 5OJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2yIdNNGbus+/NRvcbHaYe4jEEFsjeWzaYH1IVnHE4Ho=; b=qbRHdIUxV7kNXFe+34xbTQnkoe8oi9YOA5F/ZLzc75QWhTEt4Zc4B+Ni61EQRuSY48 0DqoKdQIrv2BBiZ76UvVC+ESUe7K8yTWilIJqLi4xFzJk/4TVmjBa0d4uYINiJLpZf4v qItA5KpV6/vHKdRHbQHU9PTj3Eexa2uRqBUNY5wLNdbDMpZNq6Gx4NCYc2/9rxmRe/rL zfKkOr4p+rYyBTFBK6BJor8I8RJyx5TDXRdUJ2vtXskDbYLfp6eDZtMmjJYILb1bLZAD EeXTPjffWhygMUYuj2WMLs8wdk5FwiJtq7AV3DLuNFbArpzescu4BCaFM7pxjHVHl2+J aAYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ERPQsRvO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si189193pgi.218.2019.06.20.11.21.14; Thu, 20 Jun 2019 11:21:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ERPQsRvO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729178AbfFTSOY (ORCPT + 99 others); Thu, 20 Jun 2019 14:14:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:42610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729440AbfFTSOV (ORCPT ); Thu, 20 Jun 2019 14:14:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30F6A2082C; Thu, 20 Jun 2019 18:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054460; bh=I3BsryP/5Zxl8KTwCtVmeaeJ9pMHX61Ww9t6D4ooh+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERPQsRvOqdkson3/1l5pjwRKTn3Jmt5tSUy2HRpXBkxze0xc/JJ5cu2ApeLvPdTtb xIvREfDgx0wfgC3RUK8hnHdvztBEhrA2q52jWwuj/NVHg84Dm8uV4n5N8f3PWrI6YL Kgzlx5MqHFM5rxHQLzR5Dtc578d2J4SEwy+9C2WI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.1 36/98] pinctrl: intel: Clear interrupt status in mask/unmask callback Date: Thu, 20 Jun 2019 19:57:03 +0200 Message-Id: <20190620174350.729997143@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 670784fb4ebe54434e263837390e358405031d9e ] Commit a939bb57cd47 ("pinctrl: intel: implement gpio_irq_enable") was added because clearing interrupt status bit is required to avoid unexpected behavior. Turns out the unmask callback also needs the fix, which can solve weird IRQ triggering issues on I2C touchpad ELAN1200. Signed-off-by: Kai-Heng Feng Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/pinctrl/intel/pinctrl-intel.c | 37 +++++---------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 70638b74f9d6..95d224404c7c 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -913,35 +913,6 @@ static void intel_gpio_irq_ack(struct irq_data *d) } } -static void intel_gpio_irq_enable(struct irq_data *d) -{ - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_pinctrl *pctrl = gpiochip_get_data(gc); - const struct intel_community *community; - const struct intel_padgroup *padgrp; - int pin; - - pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp); - if (pin >= 0) { - unsigned int gpp, gpp_offset, is_offset; - unsigned long flags; - u32 value; - - gpp = padgrp->reg_num; - gpp_offset = padgroup_offset(padgrp, pin); - is_offset = community->is_offset + gpp * 4; - - raw_spin_lock_irqsave(&pctrl->lock, flags); - /* Clear interrupt status first to avoid unexpected interrupt */ - writel(BIT(gpp_offset), community->regs + is_offset); - - value = readl(community->regs + community->ie_offset + gpp * 4); - value |= BIT(gpp_offset); - writel(value, community->regs + community->ie_offset + gpp * 4); - raw_spin_unlock_irqrestore(&pctrl->lock, flags); - } -} - static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); @@ -954,15 +925,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) if (pin >= 0) { unsigned int gpp, gpp_offset; unsigned long flags; - void __iomem *reg; + void __iomem *reg, *is; u32 value; gpp = padgrp->reg_num; gpp_offset = padgroup_offset(padgrp, pin); reg = community->regs + community->ie_offset + gpp * 4; + is = community->regs + community->is_offset + gpp * 4; raw_spin_lock_irqsave(&pctrl->lock, flags); + + /* Clear interrupt status first to avoid unexpected interrupt */ + writel(BIT(gpp_offset), is); + value = readl(reg); if (mask) value &= ~BIT(gpp_offset); @@ -1106,7 +1082,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) static struct irq_chip intel_gpio_irqchip = { .name = "intel-gpio", - .irq_enable = intel_gpio_irq_enable, .irq_ack = intel_gpio_irq_ack, .irq_mask = intel_gpio_irq_mask, .irq_unmask = intel_gpio_irq_unmask, -- 2.20.1