Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1257973pxa; Thu, 20 Aug 2020 06:57:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTWV0/XJVE5vhRw6UzJ/O16sYFU510jDnHR5rsK1mcojJxwotWrpVfI0JW+6nb6aNjm0R0 X-Received: by 2002:a17:906:dd5:: with SMTP id p21mr3570689eji.416.1597931860166; Thu, 20 Aug 2020 06:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931860; cv=none; d=google.com; s=arc-20160816; b=u/qiwwSgtaHMXsZU4rp/Tqk+pt/w26wb3ho2CQv0OKDEs4YUHoRqsyhhnueFplaFMP bK1puUZFWoI4FHP/2DaMtxmShw0oKOKD4vNNXLzlQ2SQTQzfTJl0Po8+6hnMG593x2Mq xG/YF9h6FycrJbZHz/dqua/9QqV/ijOsYLmPw69yEsrWZc+XEpBctcI7zHwMBUWsqXym O2DV1h9QFqB3uN7rixcpf/OATQmqr3ZiymFM01ephG9AkiPsG4dc/eCHpsNuYbubo9FK Ikakz8a2wY/VFWZYJLlsSw2A1LvgkmWxF9zuiIUxjulrcPdspZWb22BhoE9J8EbsB531 SNCQ== 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=XL9bH+7RovqkrGJYjFEAIFKeWpMzsV5xY06xFXelkMQ=; b=C64eh4JQHUlSddQT0LCYiRsLOGpbBsLZa+rZLw5uxxcuFF1YxL3D7wjv0zoGD7TvNQ aOD0kJQT2mpNDYzhoKrrKgSxw2PUzgVvo/+f8WpLo67Vnn/0qB/IYaXNVY+835caXM6F VmngI7uWljOiY1nYMSoqSgqNnr+/RQcfYMa8jIJhcu1fSaCBczkLYdUkeLpRdb0nj11R Ydb6NPG5RJCYvBnje4ssb9iE8zp4h/tPuMBs5YutffCgyrygQMQrko/nQoRmO4dmHwuT O849g4ibxszP2omXkks/ghYbXLHAsLlJZrEll8jlnbVNEuzaB4zSWHEAKiS1SV4WzA2R mFdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XIKo5Xwa; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si1327017edt.242.2020.08.20.06.57.15; Thu, 20 Aug 2020 06:57:40 -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=pass header.i=@kernel.org header.s=default header.b=XIKo5Xwa; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728926AbgHTN4j (ORCPT + 99 others); Thu, 20 Aug 2020 09:56:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:33584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727840AbgHTJ0B (ORCPT ); Thu, 20 Aug 2020 05:26:01 -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 BD11B22D08; Thu, 20 Aug 2020 09:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915553; bh=yr1SDa0zPqE6iEOJH7QLxriE/fB8TR/45ppC0A2ud4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIKo5Xwac6JH60PHEUXHNHhd4krhtFo4gMMnof1qG9Dzfkb294BkTLEEkQ/jNDCkJ ltFomKv43EtJjjkxGBO3TTsqTP/t9KO+3dFoM6SoMedLwMe1HbYd35k3Z/a68wqnnp hJIFzWH063AgfJa7f7ITEeKXf+WH3xBQzIRCq238= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jo=C3=A3o=20Henrique?= , Paul Cercueil , Linus Walleij Subject: [PATCH 5.8 054/232] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ Date: Thu, 20 Aug 2020 11:18:25 +0200 Message-Id: <20200820091615.399471310@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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: Paul Cercueil commit 84e7a946da71f678affacea301f6d5cb4d9784e8 upstream. The PAT1 register contains information about the IRQ type (edge/level) for input GPIOs with IRQ enabled, and the direction for non-IRQ GPIOs. So it makes sense to read it only if the GPIO has no interrupt configured, otherwise input GPIOs configured for level IRQs are misdetected as output GPIOs. Fixes: ebd6651418b6 ("pinctrl: ingenic: Implement .get_direction for GPIO chips") Reported-by: João Henrique Signed-off-by: Paul Cercueil Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200622214548.265417-2-paul@crapouillou.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-ingenic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/pinctrl/pinctrl-ingenic.c +++ b/drivers/pinctrl/pinctrl-ingenic.c @@ -1955,7 +1955,8 @@ static int ingenic_gpio_get_direction(st unsigned int pin = gc->base + offset; if (jzpc->info->version >= ID_JZ4760) { - if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1)) + if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) || + ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1)) return GPIO_LINE_DIRECTION_IN; return GPIO_LINE_DIRECTION_OUT; }