Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1354344pxb; Tue, 8 Feb 2022 15:33:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxT8KkGorBGlhkjnqvbn3eaiv8340lFsqZgs8A8xE4T4kBNjp5kFVCKr6GWhkNMFQis3+8D X-Received: by 2002:a17:902:dac7:: with SMTP id q7mr6781804plx.120.1644363215893; Tue, 08 Feb 2022 15:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644363215; cv=none; d=google.com; s=arc-20160816; b=B4N67DLacT8DdmR5kvecl1nN+Nr+MAjJ6omRPvmqoFRbsnEagr+ppeGC7DyEt4Kf4J EE2RrqnSGF+C9trjS4QZ7Pj+ESE+qOIBpZ1Uizooljiap6mgTcTH6ozRVLyHmVBMbBzZ ihoaQvrma2sSTs6NemY57ldzzewAnNaJzlNdPlTokPDvWgKD+zLeCRQHy9slTYQSplOD 0mavEN2byfGsRie1hgGHw6/7Waeq9tCsetOsGauhB8q2zaidaUj6bwWXmZnIX5aJtt1g fQ0YvfAzuYPqM6Skjje48G3TgBUbW4Bbw7Bfoo14xy7O0TDR7rxlvcMkGEZtyapIA0hr nqgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XxMk5plMAdargsJY+Ygt5ksDxBHSpI8hMr5YaD1qmHU=; b=PG+SkWOivU+ljKM2IqkcqmdEjlPq4rTd0dVuHHaqUWRzQ0bnEQepH3aL85NIBR2+SN ZdjbUSvzwQxLRbiYFMmtZc0nKtZwaKCra08VeMG4xANRUbXsYcOp08/zOB+Wyv5KVgbv RYEaEGJ/9eRhMy7MQU8q4E828xOO+UGD26YF/R2m4Ztytt6FhMc+ROOxb3XIXaLYcWEe YkFiBMYtb/LS5afPirwcS9l7eM0xben0ujSc99SSkqGKBUFzY2w5mBEgkKDiywnjKVwp XppzsykCE/n6TP6TQX2xiWlrePmGIdTDPz0asoBwofBKedjm+jDFg38OzkSjkJj0D9VX t5MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ONQNk2MB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h70si14040861pgc.670.2022.02.08.15.33.22; Tue, 08 Feb 2022 15:33:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ONQNk2MB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386672AbiBGLfS (ORCPT + 99 others); Mon, 7 Feb 2022 06:35:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384060AbiBGLYh (ORCPT ); Mon, 7 Feb 2022 06:24:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C9FC043181; Mon, 7 Feb 2022 03:24:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D95461426; Mon, 7 Feb 2022 11:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262D4C340EB; Mon, 7 Feb 2022 11:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233075; bh=hGthDrumJtm6T5rSAr+FgCa3SsvvzGoGvBKplDoc2ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONQNk2MBfJdMeqfDb5bTrFanj5Hp4NnP0a6A7cwfgX7rFGi9Eb4049jpKuKPECGAP KbSQTuEGTVYC7fB9w1ZpWfp11Hi534Nn8bm4t/k7QYxPP2Pq9CmqIOkkYA9Z9CEf7B f6Rd15HXIkl0tRpt+W2DAcgqj16bUI5E7HbEW1ic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kane Chen , Andy Shevchenko , Mika Westerberg , Grace Kao Subject: [PATCH 5.10 49/74] pinctrl: intel: Fix a glitch when updating IRQ flags on a preconfigured line Date: Mon, 7 Feb 2022 12:06:47 +0100 Message-Id: <20220207103758.827863262@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.232676988@linuxfoundation.org> References: <20220207103757.232676988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit e12963c453263d5321a2c610e98cbc731233b685 upstream. The commit af7e3eeb84e2 ("pinctrl: intel: Disable input and output buffer when switching to GPIO") hadn't taken into account an update of the IRQ flags scenario. When updating the IRQ flags on the preconfigured line the ->irq_set_type() is called again. In such case the sequential Rx buffer configuration changes may trigger a falling or rising edge interrupt that may lead, on some platforms, to an undesired event. This may happen because each of intel_gpio_set_gpio_mode() and __intel_gpio_set_direction() updates the pad configuration with a different value of the GPIORXDIS bit. Notable, that the intel_gpio_set_gpio_mode() is called only for the pads that are configured as an input. Due to this fact, integrate the logic of __intel_gpio_set_direction() call into the intel_gpio_set_gpio_mode() so that the Rx buffer won't be disabled and immediately re-enabled. Fixes: af7e3eeb84e2 ("pinctrl: intel: Disable input and output buffer when switching to GPIO") Reported-by: Kane Chen Signed-off-by: Andy Shevchenko Acked-by: Mika Westerberg Tested-by: Grace Kao Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/intel/pinctrl-intel.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -441,8 +441,8 @@ static void intel_gpio_set_gpio_mode(voi value &= ~PADCFG0_PMODE_MASK; value |= PADCFG0_PMODE_GPIO; - /* Disable input and output buffers */ - value |= PADCFG0_GPIORXDIS; + /* Disable TX buffer and enable RX (this will be input) */ + value &= ~PADCFG0_GPIORXDIS; value |= PADCFG0_GPIOTXDIS; /* Disable SCI/SMI/NMI generation */ @@ -487,9 +487,6 @@ static int intel_gpio_request_enable(str intel_gpio_set_gpio_mode(padcfg0); - /* Disable TX buffer and enable RX (this will be input) */ - __intel_gpio_set_direction(padcfg0, true); - raw_spin_unlock_irqrestore(&pctrl->lock, flags); return 0; @@ -1105,9 +1102,6 @@ static int intel_gpio_irq_type(struct ir intel_gpio_set_gpio_mode(reg); - /* Disable TX buffer and enable RX (this will be input) */ - __intel_gpio_set_direction(reg, true); - value = readl(reg); value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);