From patchwork Tue Apr 23 02:28:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13639265 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2043.outbound.protection.outlook.com [40.107.13.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8AE51A702 for ; Tue, 23 Apr 2024 02:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713839331; cv=fail; b=r8Da0NUz0JzpU6LV7WJVeAea8cotVPAH4roKNC+pyutbun4HvCWfwrMKR7OXh/FYaNbgT+K7CWbdEpjQkkOTtrBCHPrrqEre0h1GblDPKEgNycarzxCmuYs5+o1I2sKUdrZfE37mL9PjT6iODC74egHZB+lwGPd36vzOmx+0OsA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713839331; c=relaxed/simple; bh=Hs8rcJ+RVxpO4U60LR+iDWU/HUMzZI1cTzadNgJQlDg=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=OFVnlbXIwQ3vwGxyvq4b8ztbUqpUM8y5dDdmEQrsTM4VYjWAMi+zAQ1Db57Toq7N/spQJahtf07zp/ZGi8jBDHBxrhWaNTWYtkAhj8aZKt2Mr+nQnO2hTSsVDVzE4WXHYP5gbpLCqD08wjdNCcIk6yh8NOA0Nf5a4d/HFqGrxdM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=JdGfldmu; arc=fail smtp.client-ip=40.107.13.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="JdGfldmu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOULnQh0d6OD9cX56w0IutulFwNGLMBHPMaJcgguNixHuKNCz6f6H6gbi6mcXcCLIXOjlGokNvGLPodHVl/eH7RW6rmKP2+mAggzyhvnyGp+RBRng3jNzhGGmGG8c4jqXlySZ6j9eFO04hbe2xqBAEJNqyXd4MjJfLdp9mZr80OSFgsEtmrxvr3/NpcNZWQjDHKn1ItQHJoiR39L+cvIAK0p4IDmL/oSTCDi9/CSNwiLtOBcJQKu6rGVYEuXT1+EKCp2jBr29c6/TR0+Zk5qJuCf+ey4Wz95SWHCJJTGZ1v4IGqIgCTugsrflbdQG9cYOA+1b0+4ax5lFNw0erFTiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7aekq6Fd/o1H+XWrNY8CCjy8BzXAlXKb5LxMGVq1fWo=; b=kTFcSMTms/1jw3nxILYMgpvT+SXSXeRZX5QEibLODcSY7oz/EYtnxT/0NdwuiH2rNAYe0Mc3m00nRXnPVPdKzqTsnsXqHl+mHX6hhvliwHrPvf6fFQgmLpGzBrVOCegBFrNkxbX/ReBGE+l0X+ZKUTbf/AUJpQq9Apg0FMY2fesGi8xtGobKvRPM4T/u8W2GJyVECGxfx/DZZoEKkzvq0cqc+6DTV2a+Otzd3ZLXAHL4jcazpKjSbxQ17k8NItQitIaQEt06f+SppOyPrsNITI6iW/W3d8BU6mj9JTa6JeXjr5lo58hs4NbnUYkFjcOTcw7cG2mDmn+k2HjeZTBqZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7aekq6Fd/o1H+XWrNY8CCjy8BzXAlXKb5LxMGVq1fWo=; b=JdGfldmuL+iaKgdgbGyiPEQSljQFuPa3cWY3KwgloTI/w6ZxV+xCVRSgsZkeRVxIkSw7wTTY5WoI165iW7bO3HIfOAtlZ/NldtE+OTLFs3YIjFYAP7Uaudtr9VavV6K2emK/ur5EAPkRuEnUEeXj4/VRDn1ehGMDWAlMXYKJLVo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) by DB8PR04MB7098.eurprd04.prod.outlook.com (2603:10a6:10:fd::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 23 Apr 2024 02:28:46 +0000 Received: from DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::8271:6309:7e7c:1895]) by DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::8271:6309:7e7c:1895%4]) with mapi id 15.20.7472.044; Tue, 23 Apr 2024 02:28:46 +0000 From: haibo.chen@nxp.com To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, haibo.chen@nxp.com Subject: [PATCH] gpio: vf610: always set GPIO to input mode when used as interrupt source Date: Tue, 23 Apr 2024 10:28:14 +0800 Message-Id: <20240423022814.3951048-1-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:1f6::19) To DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9496:EE_|DB8PR04MB7098:EE_ X-MS-Office365-Filtering-Correlation-Id: f3abecc4-9490-49cb-7a60-08dc633d19f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bmpXf1c1TcWTIcJcXGWN+O6IvBCqgcG7mFzAKtG2Ozxy71qpkUZAFr/tAPzlGqJqp0QwKUs26AdXfU+cqTFzGIAJAVzLTJwvB0fn83jqAkVMkcgDfUNiD81+/Nxu8KUcQXnP9Br/TCWUeD7n2DM+bU7VsAH9IsjSWYzUN1ODZ841pF1rkayeVRBaxsldE7Z4DhO0KjEitRl6nJBC4NIFonKJ4bD6Otz5bdHnYU1X1M07IE/498n7Hp8KQLB7O/cSggR0SuYTE5RM1fOxe7ZBhvaWPa1EcCdStzlT+MzkTdpHOLQP/wBOPTLXC+QfFP4ALBt8mjPDaXFwR5Tj82kaQ06NXcOUQm0pLWxkO702eYpQ3LnqQKDY0agPN2H75cBZ9CJ5v2UPAPSEKxfXdTATjygagql01r87//kpIIA8WEWH8bk3vJhj+bYqVIpgJnUdDkI8oQWSclXuQIECUmVFYNj4ZWGouRTNhZTHPPenGHfoGwWyeB9hkPpebvAxm1+XmrIUdS9d3dbZWFeUrEvioZRi4AKrSnncSh/NAnuH/mTr8IPvD3UJoGNihJCg2UF3N9/YRoCTKXkWHVzHgiZZtc4Uik6wNaEEMMKZLx68w+01Wzh9dYj/sob3ibw2RVQXRv65hHNVEJg4N0xtkKxIOTHELvdO+1lk6fBg+g9wrEiJ90arqwztcTFDC8++6P2TaKC1euhEditJMHHEqQTTAnXiwxqnvfDWzgiWb0sZyTseEdqHfenKIolsM3vM4DCKCuzv8Q3NzhTaaOfkuamn++GByTxXZywuySmu8NYBmpvRg6JOdFjwH83coEf+N5zLP0gkaJILAuyKVwytN1hRMMPDP5tPok0stRZUvtvDet4giBlA8qUD3Agh/22Cdaf21tFmOuLltTMjVRAEbSbEBDJM6Zrs5DFwaPKfBanpi/+ucDnH9SWqwWWxoEdHKeBHZFI0ZK4RIhVSQQMDU5TJxrLL6g9M8i0XdTznXR14pezyOYykXmv9VQF2YgEzC86HAJnxzIdHFKtf9oV2uEQaa8v/3rjZiIO3IOINV/d1qUWN7WiykDXANwxbtaPrKILXTQRABDFgwzeiIGAcfV6L7O+y2BCsdZRzlgU5mOYaGi6JvAG3oAphOZ1em0Zc2ywIjnyNcZDjKFHI7lTljgMAE0FfI6KPII882Mkc8+6WUmAaLkHjKlZYgtWAschODPK0bac9IuBeXkGeAwU3Y9wKGwZYw5TkFBMJxaD5hmnJYMebGOFp2bVbbpfG8dt/GJ9aAsVWtCa8Zwqz9ztopWHZANogWNEO3kO+j4jvd68LlKGzZoHUjJurZs8W1d0cYqE95RQDaA+GJ/Jip6Ny1wpxfQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9496.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3ZeFVq+5ikG6UbLoUyW+Ef0Vo3dho8DtUkkMeN9f/CwcMowKD0q/cyvIKHLqdAxESchQX5KSmuKL6560YCNoZ5Hk/w2pzl6dPoD4pJBxisDj/WqAeEM0XLIrfJXCa5ub51UsBnvfj6ZM9SFcPrRBytKiXz5CtAfQ+gda5MtpCZtoXIVL5FbAMSzbfTse9QX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/URTwdqW4dUrEyqAwMnpMtCuCR2Z0Hh81fSxEdZV6GmpRhGMVl/IuOIXBgrzG2UdMQ7fBCkaTI6rDBDxlImY6egp6Yr60yq+HAw5LGUrLHSv1a/RwIFNTuVsfxeEp/GDHaZLC+RDu0qAKxeaZGcgW5YuK/cPXbAZ/pqDFSepBFNjZPEboHUUKjbbXwNhWaQpL5GZFO0TdIia8jeUS8EfCJNluclSfsxkhexJde6BnvhcKDXLxdn+JSE6HFcoghWmPHNQMbs1lqUsJ6SdFjvh0h9ekLl2f47P9UHTpI8NivHEZxyBI X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3abecc4-9490-49cb-7a60-08dc633d19f8 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9496.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2024 02:28:46.3119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hOmJbWxz50VVh1fAUbEAB6io9QnSfDph4kEjO3LAGgUP7vk/jz/NozfbXGKust17qyHXeksdaAz2h633N49dTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7098 From: Haibo Chen Though the default pin configuration is INPUT, but if the prior stage does configure the pins as OUTPUT, then Linux will not reconfigure the pin as INPUT. e.g. When use one pin as interrupt source, and set as low level trigger, if prior stage already set this pin as OUTPUT low, then will meet interrupt storm. So always set GPIO to input mode when used as interrupt source to fix above case. Signed-off-by: Haibo Chen --- drivers/gpio/gpio-vf610.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 07e5e6323e86..305b0bcdee6f 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -214,7 +214,7 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) else irq_set_handler_locked(d, handle_edge_irq); - return 0; + return port->gc.direction_input(&port->gc, d->hwirq); } static void vf610_gpio_irq_mask(struct irq_data *d)