From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079C9C3F34F for ; Thu, 27 Feb 2020 13:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBF0D20801 for ; Thu, 27 Feb 2020 13:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582811186; bh=ZKUtbs4x9z+XJALSmUTrVhdPGVdU/ZvRtqluld9BoZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AMn5UCHrlFbkhPCYmKCuDtfnEnvk66AyJWPVQ387bWJqvmQihcntEvd5Cdyo6h5RI cfWYHKCNiN/oJkNkR70Yb64xaIShfPms1PHUZ9x1wY53/QRVXQMO8P8InNaHBaOvLB 2OuIYi+EiSNkoC41t4XoG5Dzb++GMZecrQkIGM2M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730172AbgB0NqZ (ORCPT ); Thu, 27 Feb 2020 08:46:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729646AbgB0NqV (ORCPT ); Thu, 27 Feb 2020 08:46:21 -0500 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 E77A920578; Thu, 27 Feb 2020 13:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582811181; bh=ZKUtbs4x9z+XJALSmUTrVhdPGVdU/ZvRtqluld9BoZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOiW8R5f0sdK43MybmKHZt9LshHOb9aGuSiJjmz2lEiBHMNrOlds1zpPMfV7Rz7AS HBql2Dbbuz5jK0PYy2dk0JVxG3hY8Xri8aJ4nTOyFzbfhJrQCE2pQkfauTb5wk/pKj vo8sJGhL6Iv3edE/vTwRbZZrLSJUpn84isY4Jleg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mika Westerberg , Linus Walleij , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.9 032/165] pinctrl: baytrail: Do not clear IRQ flags on direct-irq enabled pins Date: Thu, 27 Feb 2020 14:35:06 +0100 Message-Id: <20200227132235.750238456@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132230.840899170@linuxfoundation.org> References: <20200227132230.840899170@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 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