Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1929219ybv; Fri, 14 Feb 2020 08:23:57 -0800 (PST) X-Google-Smtp-Source: APXvYqza4MINgBjC5zYuqI8VFVt0sX/tjTTdgr1fLnDgNYlHSTz92JRUadmFiKXTSHsOHw+yL/Zb X-Received: by 2002:a05:6830:1607:: with SMTP id g7mr2928415otr.320.1581697437609; Fri, 14 Feb 2020 08:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697437; cv=none; d=google.com; s=arc-20160816; b=B99jXdttIiDRIhZRZyWFiJI1ffacbv3QjHeTpv/y+YZp+4Rf8VPurY1+L7LQkUCMPI b8sk1DtUxhNQqTBjTB76JLGgLR+YXpwV2qxiseNyKlYMTbCSD0NPbYJh7B4FJXQMJ6B4 7uOk2L+JmF8DhAcBYwib42gpDO2k1RLFxeJmAwPY+K0NVG1GyXx0Cr3vQX1Rlv6MOdkf 8PsUowy4MpgLixUVO8MhuwfOAdUVP4TQz8jJEQW+0vPwsz5GMNz5s6Lf7V9Eak7M3R9h fgtoIGL+PiZxyMeSwjHio66IwQ8WQr1cPV1y83EsdEKoJlfSK8GxlPuYcFrAkDXrxKDz CyQA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kl3kRnCuw+CdDvs9fMIh1fSJ6aBVHH2diF0muyJHeF4=; b=aHn9oi2udHWbOoKYawO25InW+nonKeRpv2Y/ULQwF7ltriXywrsfYG2pOKO4NOQy2s fjGZnEuaPDqykKBhx1XP04Q39mR9pdDHPmelJP5e0IFcsQBvY5oDLoitCzPRRcVf+JSo ecmghWxgP2iKSrdcCtL2jA5RVabipwI9mqxgqzjy57cHC/snM/jbey8b8TclNl5ulQT2 HdHRuVvsnXXECmGAuEtz5eEb8biH4wB4oh8c/fZf1+deWu3SvP0GSJSN1LZWzlWlpkud 2X+bJBl2TsJIrc3CptM+xrPvSoD5np7ZwfL4LCq8sgTB7dbhQ5tYcDs6kowKnqkkznnY C+Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QTMKwkhN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si3101801otp.70.2020.02.14.08.23.46; Fri, 14 Feb 2020 08:23:57 -0800 (PST) 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=QTMKwkhN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393323AbgBNQXC (ORCPT + 99 others); Fri, 14 Feb 2020 11:23:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:56516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393067AbgBNQVm (ORCPT ); Fri, 14 Feb 2020 11:21:42 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 507B0246C0; Fri, 14 Feb 2020 16:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697302; bh=ZKUtbs4x9z+XJALSmUTrVhdPGVdU/ZvRtqluld9BoZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTMKwkhNpu+t47t/63Yh47gl+aa6X936gcYEJtCzkqa0ugZ53qudbAHqbSwUNn5c8 aUHj7k0XR8bmQqwa384j/fdz/rqTqPZzonudaROlWx9h8trqS6PMiuvQynAr/yfJoR bgFXZNAv5urh7m7qyvISnYHTyq8gzqBtLEbBtBCE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Mika Westerberg , Linus Walleij , Andy Shevchenko , Sasha Levin , linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 015/141] pinctrl: baytrail: Do not clear IRQ flags on direct-irq enabled pins Date: Fri, 14 Feb 2020 11:19:15 -0500 Message-Id: <20200214162122.19794-15-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit a23680594da7a9e2696dbcf4f023e9273e2fa40b ] Suspending Goodix touchscreens requires changing the interrupt pin to output before sending them a power-down command. Followed by wiggling the interrupt pin to wake the device up, after which it is put back in input mode. On Bay Trail devices with a Goodix touchscreen direct-irq mode is used in combination with listing the pin as a normal GpioIo resource. This works fine, until the goodix driver gets rmmod-ed and then insmod-ed again. In this case byt_gpio_disable_free() calls byt_gpio_clear_triggering() which clears the IRQ flags and after that the (direct) IRQ no longer triggers. This commit fixes this by adding a check for the BYT_DIRECT_IRQ_EN flag to byt_gpio_clear_triggering(). Note that byt_gpio_clear_triggering() only gets called from byt_gpio_disable_free() for direct-irq enabled pins, as these are excluded from the irq_valid mask by byt_init_irq_valid_mask(). Signed-off-by: Hans de Goede Acked-by: Mika Westerberg Reviewed-by: Linus Walleij Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/pinctrl/intel/pinctrl-baytrail.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index f83a2a60d9c9b..1e945aa77734b 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -958,7 +958,13 @@ static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned int offset) raw_spin_lock_irqsave(&byt_lock, flags); value = readl(reg); - value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); + + /* Do not clear direct-irq enabled IRQs (from gpio_disable_free) */ + if (value & BYT_DIRECT_IRQ_EN) + /* nothing to do */ ; + else + value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); + writel(value, reg); raw_spin_unlock_irqrestore(&byt_lock, flags); } -- 2.20.1