From patchwork Thu Oct 31 06:29:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Burri X-Patchwork-Id: 839939 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013046.outbound.protection.outlook.com [52.101.67.46]) (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 EBA2F7A15A; Thu, 31 Oct 2024 06:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356237; cv=fail; b=gGULCFMZYcT3zMlMHFwkTM2D3qkmuzPByfwRMVw8iNF5VTqSHj+uRTki88eZ/hgwvCxhSkND2P6Wzv5mGMDkxj4aDrZgK6D3lL+QPHwbfYZQHEFbL66ZyWUv0VnyrTrfApRWb/Mgt4aphiUJRcr1TKtbHE0PsnS/+Eo8UU6X/m0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356237; c=relaxed/simple; bh=2JgJUp0muyY6HKUfcYE7hCw4Uywu17MgmCICSXHZvnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Vfs2PNzeIZk01Re4RvghnB63v6Gbf8KtyA5zISV0WbCJ11zVqBAkQUfQTcaqSV831hxnhMzns6BXrXW5L0NPyoxWexEqtPbLQUVB2nzrCMaybcw4iZ2GbPKZ6wXQUymY6eXA1woL50qQmNjsShnyWpRzcAHsKaioZ2jD2cVUYKs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com; spf=pass smtp.mailfrom=mt.com; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b=GfINoTzN; arc=fail smtp.client-ip=52.101.67.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b="GfINoTzN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oaJX25RzUZ4FWx6/VQdJ25gbZJ3Rp56S6Xwo3WJB0eat0Wlkp0uqWcT8lzqdNx2pNz9+LMhx4PlxP6Wm7bRb045u+q8bnRXAxzCkaq7x5B2tDaSa0lg19gZVay0aXhWLGqNxvLn05IFx406IDZ9+y8wWqsyG+EkA/fBlmm/2TdONhjMFMT23x/YPb+QGOirxiWG67+xce3lZrm9hDB2dJZWIbluF5mgNxJ2dx2AdRsrR0T4+hrIW+0VKgXQFYSp2ZkwYTK7VdXPsdeTDqkFXP0rCqsg2sD5J27bfN9J4qD5jc0s/Sql1CZ4Tmm+FOU9VfBDYamnp+j2tF9qym9GgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ElWlJbJZR8MOatkQ6tjF16LmsPBk6+DHoeCHsZS8qMM=; b=lRTx+CPzELIgygvsqAqniPMeBAh9sewKnPWtgPt9imySMldFMjazO4R2ay6kjko6bJCM/96Jgf0GqRMvb+FxI87F4hQGpCgjtQ6cXuvuI7Nx/+mIfm4F0c7WY9HPwG2XI3LrGu4ABD6RX8xAdL0J8eHmRSQSc6HEy7uJ3t5GxdBW1kh46bdu2m69AfiGpavXPmC5HwAxExVPJ69YCRXZzR/q31ccgAm+tXKy4vcDwBemJo7ywW+1J1bqCesLLPADCW8tQsLJctokP6BLR6YhNZd9Gk8I9/jkk0nrorRi5knx3NKr99Nq9J9ENAFOGJE/uPKP+AV+acPiML0fyn+8Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ElWlJbJZR8MOatkQ6tjF16LmsPBk6+DHoeCHsZS8qMM=; b=GfINoTzNZS2uhBbRb7z23AQWZHHxJtEoYWpPQwPtR767zAO2VmrUfvdFYQADY0VbweTroMgkNAEwfayfs53EKFM4Lkv/FG3PDHuH52lvCBEk/nlLCHCjeUDB1W/TKsAlBvNO6sg7QaCQTqT70kTe5RgxmbFQjw/4eM422saCgP18AMqImyIDfwynW+3bmHtzqhPk8JkIZKcq/MZyHqTbcn5Qk3VCNdcUTZ+aD3smXd3Dfdv9wjyx+YibWf0OtpE1aNov7SfgVFihe67DCAWVn94+XfSJ4vQhJ3JVNn00sWzPQ2YAjnCWFg0MEB9jXyH8dKssu6lFSoX/BkNv5AOq9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) by PAVPR03MB9797.eurprd03.prod.outlook.com (2603:10a6:102:311::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.18; Thu, 31 Oct 2024 06:30:32 +0000 Received: from DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a]) by DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a%4]) with mapi id 15.20.8093.014; Thu, 31 Oct 2024 06:30:32 +0000 From: Markus Burri To: linux-kernel@vger.kernel.org Cc: Markus Burri , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-input@vger.kernel.org, devicetree@vger.kernel.org, Manuel Traut , HeDong Zhao Subject: [PATCH 1/6] Input: matrix_keypad - move gpio-row init to the init part Date: Thu, 31 Oct 2024 07:29:59 +0100 Message-Id: <20241031063004.69956-2-markus.burri@mt.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241031063004.69956-1-markus.burri@mt.com> References: <20241031063004.69956-1-markus.burri@mt.com> X-ClientProxiedBy: ZR0P278CA0087.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::20) To DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBPR03MB5399:EE_|PAVPR03MB9797:EE_ X-MS-Office365-Filtering-Correlation-Id: 34bee9d6-cb3a-41d7-5825-08dcf9758527 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: gBBGzupsebTPHTBV2vjtvnSwrEQH63Zh9I3GAz71UZ7FJcBFYdHEonTzvcih+jxV0WwuPOKb3J7WfJJh8JdKdbOD3lxoSux7sRh5zE/t9zvpKNMt/hUEh4Oqq/9PVw9Cw5GgVR65R0fVbrgWwLrdzxQU/33oA6xViS2U6ebnfIAE4rQTAG1rLd1bvH2jqVSx+LhGUATz5V6K/Ifq9SFcwpy4o2f8AFKSf1wrDhql8U6RvELhOGRXoxz89RbCORVaomAzGcb2sgJDs7gwlAiNd+/w/WfK39zYueIZROB7qfAzmpwafUL90X+EQk4Z4FmF2NcnOnZyhNI5n8Roh5X4gWOiobRMmFdnsb13B1cb02Blc+9S1miLKEo8zEYHiFUlfrKX6zi227B56pPRkeNXIyFHL4931UPcq8btsDHk84yZwO+FqQkO0tANLLQ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Iyonii0YNQEvjHVCJGAwY7GYH4Bu3m5dRqdeJylzn22VrQt/8EegyaEBxo+v1kV4Bu2zUZa+GEjm+mo9xLYiiTYLz3dUoDq+gNtU1h72OO5NUjp+PUE7JX9qI6QuxMfybpKhnWI0W96jhIwqDRiUofB9hzXaW79o1LCXfvkjNA133aC7DW/RDoI+U3sbE8CoPX0YmtCnQT/K0sbas5rFDWdNfbtSIfvx7fCe/+kXDW1KIkauOZxSEKBv+QAj6mpNku3GQQUsG7gBEDuTjkERigIWsoDE+5mJTV3KOa5iv9dOURWgifiYP3cjyL/Oyobkp93+B9b0tofZADP82Ycz+MkWoAS55C5RFcTOL2yXjVF0qu0nSFEb4Mdubv17I0qFq3j3C3/7l4oCVPzFtxNdRLTkgsLt5bDEdCBSqlverEVNuVO+cNBqPfkRMmVeKbwtx6x+YqJ60HoRayZqRuVWPFey0zCt5fVSt8HSelTbmS9Cseru8ooXuWUZ51h/IsxYj4tHQfV/26qWPjKZM+eoljkq1Uk3fpnYnzT+jtS7lxfHVLOGbI3yGORW64BjtcHoicC/JuerhM+k83YHncPV19Pk0xKh5+WrKw3wANlq4yAm0g7xagsloccPgFt1xh1Xw4Gauy X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34bee9d6-cb3a-41d7-5825-08dcf9758527 X-MS-Exchange-CrossTenant-AuthSource: DBBPR03MB5399.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 06:30:32.1017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 02/HTA1LlGn3OQA3RaWYxbfgginRuThcQotbXcZRRNs+ALDS0eqFGnFvjcAOl9l/8EUqouSFCdvGVig1xeA64w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB9797 If the matrix keypad is wired over a slow interface (e.g. a gpio-expansion over i2c), the scan can take a longer time. Move the initialisation of row gpio from scan to the init function will reduce the scan time and therefore increase scan performance. Signed-off-by: Markus Burri Reviewed-by: Manuel Traut Tested-by: HeDong Zhao --- drivers/input/keyboard/matrix_keypad.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 3c38bae..a2ec9f6 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -118,9 +118,6 @@ static void matrix_keypad_scan(struct work_struct *work) memset(new_state, 0, sizeof(new_state)); - for (row = 0; row < keypad->num_row_gpios; row++) - gpiod_direction_input(keypad->row_gpios[row]); - /* assert each column and read the row status out */ for (col = 0; col < keypad->num_col_gpios; col++) { @@ -326,6 +323,8 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, if (active_low ^ gpiod_is_active_low(keypad->row_gpios[i])) gpiod_toggle_active_low(keypad->row_gpios[i]); + + gpiod_direction_input(keypad->row_gpios[i]); } return 0; From patchwork Thu Oct 31 06:30:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Burri X-Patchwork-Id: 839938 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013025.outbound.protection.outlook.com [52.101.67.25]) (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 70DAD146A71; Thu, 31 Oct 2024 06:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356256; cv=fail; b=aSvCqvup2wAsGX/TomqaO0DuzpDmEvj/Sb8CNto0Y7v4ADls/IYewat89fR05IndedVmWaGnw8TabMoy30mYDhMJ2e8aflKIV4NcJrgy0BOQTKxCtHTs5iMp70EmnWkC6QuhCacXOa1CEQkbVL2oiNoCn+/Qcc8nx58a/Kf8ajE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356256; c=relaxed/simple; bh=0TL3eszPsXS15LWRzFBdD5LNuJOQOlWN2vuPYINr93E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=L/M/pfF+LXOz72X92iFHE//on9WRl2pRu1vlz/oEefNAWc3o6rPN7twgLhjkRYoiSvePD4HfLTKRlMNkIDW3ULa7GvN1mr3p8Oomppx0tIq85MstRMfP3naYNZrVWWVsA9Yg2E6UAv9rbe/qf6aI7msxgvjkBtFRBucXZc5RVeY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com; spf=pass smtp.mailfrom=mt.com; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b=Fu91qiNO; arc=fail smtp.client-ip=52.101.67.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b="Fu91qiNO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ImIlhm4qIOAn8WGb17w1vriO9SMH3e5uURBd/e5U/HctNOrYjIxqPVYxdpZutLViiqw4yGD7sbyo3hAxa7ifZwS46S4ORO6LKzVdpIdHnjo6cvtJkH8CoOZZF8WRnmCXkRhw5nochh2/JkWB16l9k+XAXNzJs5AQsM/ib3XL77C5TByHHAuUEQElehhoLPdpFr1h3/OjcxI0z9cYWrWv8Ttwt8CDE9fC/OSsTVHmiw9oEB7BRUrN1cNc39FKptr1FFo/oMAWbziJQnGqnWAlew8RD6JYN3rWD0OFsM8sqJzHpQLMk+afWCPHoTE4GKX2VyHlc9nx3UqAkqJaFlADNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bqsdfSW+AIXNzHY2JAESylM/5d99FguRZSl9P9cv3OI=; b=SpmOARpyygsF3dNXi9VjWe6KsLod65afEEIlkmFOt94+BL/g8cDjtJ//Wmde8aK/DTPrKgdKVuNMEjToPXHx9Noorvt6YZNlIXLqs4gqeETfKpCmzzpq+D3RgFKcCbjKK4fZQFcnfU7XmMy5l0mgphicgCnmR4h5c18ZMOwKH1XvkMDLC2NW5ijdtMQcdqLCHRyDH80uh7yCFzoalUF056ucc8eYhu0hrSzIdZBFxpDcsOGYrKbxn69WQOIsr5D6Y1TxsnChpnS/SyzQddjt5Y2vv+PSYU2MKeoAZsMN2Za7aY1zRtNPGk/r6plrRPaPwVkWY2NhY9xFqL53WRqiNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bqsdfSW+AIXNzHY2JAESylM/5d99FguRZSl9P9cv3OI=; b=Fu91qiNOdt/1K7PhrybctTAsQIcXg4Ki33YV+vPz0O6n57j62gbaE1krb5R4oJWL4VXfbzoc9XYtwQMRWbElbSKNYCyx70M4xtfZfhGsRErNptk2/8O7kTPSjrda8ko18EGjO/KPu2mbEB+63dVom4yNix4cqj+VSdvmkFPFZLcfVJDsYSPxt9SSGiCzqBvQap7AHam5TWTAT9tA4mGY7w1SUHth9tAaAH/iD1XPEgBALCk7rSVpAnXV8PxyOpoSDJLihnBP8CbEfVA/+Wpg2nfkqneXi5obWaR6Ptk/DDBgEtKLrhESFnzDkCFIUNQp/GjN5dSbLYonCfprwBOUfg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) by PAVPR03MB9797.eurprd03.prod.outlook.com (2603:10a6:102:311::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.18; Thu, 31 Oct 2024 06:30:51 +0000 Received: from DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a]) by DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a%4]) with mapi id 15.20.8093.014; Thu, 31 Oct 2024 06:30:51 +0000 From: Markus Burri To: linux-kernel@vger.kernel.org Cc: Markus Burri , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-input@vger.kernel.org, devicetree@vger.kernel.org, Manuel Traut , HeDong Zhao Subject: [PATCH 3/6] Input: matrix_keypad - add function for reading row state Date: Thu, 31 Oct 2024 07:30:01 +0100 Message-Id: <20241031063004.69956-4-markus.burri@mt.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241031063004.69956-1-markus.burri@mt.com> References: <20241031063004.69956-1-markus.burri@mt.com> X-ClientProxiedBy: ZR2P278CA0018.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:46::16) To DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBPR03MB5399:EE_|PAVPR03MB9797:EE_ X-MS-Office365-Filtering-Correlation-Id: f386ac41-3ebd-493e-1dcd-08dcf97590a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: WwxrPTnEwsQ6Obh53jLzReDShkKkjTR3fQeMl8QXb+blEI7pM7jyPKeAaGsgjbJD1gZEjmJslxdj2taU2n4Fra0jxuqUHK6zwF6MfuINMklEd4I6tYNMvLQopHFVYxUaREoDVxip4KrvyjKmZED3Eqym7LvDoXyCAaUi6al8yHGoowFvVdGa07+vr2RAijRB0qyF80+wCwGcw/pFRy7nCoxyNijpQMucu9HnP44+zMHwFJWvpONNgia8PTLHBPjgh+wVWDj20sJElGnAFn7q3TTlWKVNJ9bZyqqip1NFaBCr/di72Br6U5UZJtxKWYCY0DccmBj1Z8nGcuz0frtmxzgXSYqNaIzQuZQDFEhTDeIGCJqQad72WXV4f6Qgzd+OILN29bc1te/xHN3F8WQQbL0qlCog4fQe1dh8KpF3hAkOFZ7a7BT6svmTgwWidEm6a6ACALFFxpX297sCF9RiIM7aBYC+Qn3py6P8hdR6s9BA1Kq9sO5GHKDJ10ov/4Tv41rtqgZphN94BKzxHD6MQnay/dN3UKaJ5doifztRNKk1rOcIUe1MAAGsDoXRzmvcvipn1JTuF1flmnwg/QfbHvIMJKmrHEHr57MurqkW3VxhSJmHVvaU2AmGQnFpTEKwf4HzR/8FIFTsYJf2XjGYIOG46eFWma6pAsh/ZT+5pz1IysWRBOh1P5Gw9fRtOqAXCZjStyquEh+wmB1EFRZkX/hZHaUt2vFlbpJXNKJrq/RrsFUORSPrwlyWuezmtaknTcDdBfdiygwntvWuLUeDWY/a+4TK13FlLkb4RQz2SHg+n4vRLVhQ49ka/v0NEQCqUCT0w/PWb5zk6uTKAaDP6GJnh7USuLAUE3SkkeqCndN4X2GvfetFlMSUsOyMHDj4eG7viDv8EO5+9w23sOfOtrccL67NhoN4QFz7fauvvF9P4EIpmoNo0tlxQ80uomuQn56F8nrCy74tdAzYBeaHUE9l8CymJGBzN9tUfm4C5krate46YMDtWEzopB8DxLaOnCUAXbvmulea2XndmXqiZp7m6qnCeneqv8JdkRB4s5IxidtjEIe02qMEdBc7dm7l169KvDeiFck3KV68rA+rU3QYm+QdJ4MbxBKSFdWxNfRi0vilA2O3YlJxEWCDvoKNSnWZHyaiCBszzENA7HaXxuXIRisgNwOm7HuyMOxhKcGbTLn/MB5b6kUuho2lCEOcXHqwPVAgTdATRRnv/sWNwKo3NuzqOdNWd66n04WD49XeeWF2++d90KEEH04WO7S1g6IJM/qbhwZeyDTFLRsi2oSzGlI7f0jS5QoJBL7sO/tB1kDS+2xuyMU0awXnN/duTvOMv6QjAA4HTLVQvJSj9WHFjZHy/xSOGBK7G6lGJQE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR03MB5399.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cyd96F7epd0FaEK01YFSvtT1tp41krdXQlkPwCE+NuoPhfrQCsgQouWhw1Oc4T8hXbuBGqee7MKR4HPbchOo1mJVOYZKHUbmTRVZ+c7BRFoAp8uqpZLZnsmjXdUHNOJOQvC+ZBCqE7RuFhkgWUKzMessIfi2A/rX9bsW1d4zdmqxP/RZsNhT7NyAvypt+kHIRP/81C2Qcc4AsuVWu1uk3jgB+qqtR3QtuXSz4VE2drVdyxs2MyMvmQ+WP+OoaTJMcsGh/JCxG5kGzXQF3UPGOa+EaqjEqLu4WqxVmcEjh7LmlYNnymmMlgdT5TlSNu1Ws0P0hOrGkPmGSV3HDODxlgiadgxpPFJbYnfAv9NzK+F2yYZ+tGiFymYLdOvCtdEY4BrjjaHMEq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aFFsq1Zz4VouJYXdQtTNb+V7h5HMuiEpuFK8zj48ynk3T1F8XY4xz+EZq37bcDZTzC2Y8vRwGoqnfCjTSmnzfd25f7jcpyokyK6tMMxN8THmFsfcE+2fveE X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: f386ac41-3ebd-493e-1dcd-08dcf97590a9 X-MS-Exchange-CrossTenant-AuthSource: DBBPR03MB5399.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 06:30:51.4298 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CUEIB/9bkMpGBN9RyrZ/84aDFO+gRJmgtCDAyiQKi78bkeo+E4Ltsk79DIgQXYUe+Ko5VEp+2GYLgNnxmR4buw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB9797 Move the evaluation of a row state into separate function. It will be also used by a change later in this series. Signed-off-by: Markus Burri Reviewed-by: Manuel Traut Tested-by: HeDong Zhao --- drivers/input/keyboard/matrix_keypad.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index e08d7d5..c091f90 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -101,6 +101,16 @@ static void disable_row_irqs(struct matrix_keypad *keypad) disable_irq_nosync(keypad->row_irqs[i]); } +static uint32_t read_row_state(struct matrix_keypad *keypad) +{ + int row; + u32 row_state = 0; + + for (row = 0; row < keypad->num_row_gpios; row++) + row_state |= row_asserted(keypad, row) ? BIT(row) : 0; + return row_state; +} + /* * This gets the keys from keyboard and reports it to input subsystem */ @@ -123,9 +133,7 @@ static void matrix_keypad_scan(struct work_struct *work) activate_col(keypad, col, true); - for (row = 0; row < keypad->num_row_gpios; row++) - new_state[col] |= - row_asserted(keypad, row) ? BIT(row) : 0; + new_state[col] = read_row_state(keypad); activate_col(keypad, col, false); } From patchwork Thu Oct 31 06:30:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Burri X-Patchwork-Id: 839937 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013056.outbound.protection.outlook.com [52.101.67.56]) (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 1496C146D6E; Thu, 31 Oct 2024 06:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356273; cv=fail; b=cnHkrbaIqOqTAwRmwWvDh/Bvf7i8TAZ5rxOEVwwBu/1lQIcB/ZWgNiZdPm+uosN2576xcrWZ1hL69FbDJXsXEaPB3Qmim1LQ7kH3uLs9mPW+c2Ppt0iHi3WExLFG/cEHH0jpKMi0srvjvADrjddKlP2Y1ARNHagoAA/UOfCfbI8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730356273; c=relaxed/simple; bh=St5a4cm327l1cBWkQVf5p1hsDXxmtaWCJlFZ8JJvnXc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=H36c+njyMeqkP/Aj9MGOHNdBNvQGa8WX6/Tfk5dJUHcKAPz1herfaS6zm0s8FT3mbslHwwyvgrE6NEhmVcxrPSzAZn6ODK+9IDhXDGOSYIOxigogoiMrsCDvBHFfX6VRqZHSE3iU1OSTpFZseJ5H63U/daY45Cesv54KS3cCsXA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com; spf=pass smtp.mailfrom=mt.com; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b=lvr79fEz; arc=fail smtp.client-ip=52.101.67.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mt.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt.com header.i=@mt.com header.b="lvr79fEz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cam0XomqzzVAkkWvVW68/t9J9jYsvgzG4EkXJQ92HU2+gKGhSUX86UBN6hdhwQ8eV3tKQZlv690BWtmlodx5bk5PUUO4JPUup5x6WxlwqE3OVejGV7T0huYoBOizP7GLx2jIU9bTC35D57yFsbCB3hIXGAq4vyf5ae0UZ3tBhYCFGX7XcTy5181ghQeB3alGAkr7YGg2cw4JQtFp52SDtxIRRLVn3SDgjY+Ruvf/rLG5PHZ1KXNfdSwvu6cEfxvpnAlEWKhfWAoudTqePwToaQJSJii8ndMQEM5yHm3Un4yy3BTO9Q1XUCL6tL8GZUZGtEyZFw0iDR0tWTEMBnyLGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=EaW40cTlogoneT8tAEqcXOHyjc/wCnOytjchG3JYfM4=; b=pUtHdqL2y59h0NRAbHz8uaR7rh0L1R/m6XmpsL2clMX4d2NiW7rZrTb6acBPiYKbfB6eFidQOirDMVI6jbZO5t5ZFO0F3L4Sneb95H3rg1XkW3Aa0cfxs1F74uC+txFnRF2UvycAhTusjJGsGG/rXXWl/eDFjg0QWI2rC+7b8UQkU6avAQ2P6R6A3rVvpD8lGU5TY9yDhldxcWV/SSoSwmu6OJo9gCHv20/B057nEH5nWBCI5bQOS932uiWfCX2vcSjdlnJN4gcVXltcP945g+ZKIOqqZ52RUyp5YDlwXU67AxoDofTUD7QtTyYOrl99ZGDjW7+/oEqY6N0JFk4UEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EaW40cTlogoneT8tAEqcXOHyjc/wCnOytjchG3JYfM4=; b=lvr79fEzlgaoUlR8EcCunXXS3bUxFFiWaZ7GGQGzSHrMFY3XSoCpJg5cMljHSHuGwNEcGtINdgpedFYAVCjYv05OQopx3yiyYtju91pEcJVjxPmGlFZRrIIgRsjy2cxEdNtL2SKhiN2GMKDwliFNfL1Q9tX1jSLieu8xwoNLcOSyS7hxkZm+/lYmFIVBVm3dTuvxvJkZ8Y+teEZlGDp8xdB5B4LLdSXZIvg4HOMyhRPPvVL+I/hRVDp7BaNlz57PwZ+4CQ54pWT3T1n+jVjs4YtuLyglu+cJpG2o2z9PCEmUFGWM8UmqIj5xnTvjTHsOkXjpugpUTZNAOwRH2CsmqQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) by PAVPR03MB9797.eurprd03.prod.outlook.com (2603:10a6:102:311::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.18; Thu, 31 Oct 2024 06:31:08 +0000 Received: from DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a]) by DBBPR03MB5399.eurprd03.prod.outlook.com ([fe80::2fec:64f5:1893:f53a%4]) with mapi id 15.20.8093.014; Thu, 31 Oct 2024 06:31:08 +0000 From: Markus Burri To: linux-kernel@vger.kernel.org Cc: Markus Burri , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-input@vger.kernel.org, devicetree@vger.kernel.org, Manuel Traut , HeDong Zhao Subject: [PATCH 5/6] Input: matrix_keypad - add settle time after enable all columns Date: Thu, 31 Oct 2024 07:30:03 +0100 Message-Id: <20241031063004.69956-6-markus.burri@mt.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241031063004.69956-1-markus.burri@mt.com> References: <20241031063004.69956-1-markus.burri@mt.com> X-ClientProxiedBy: ZR2P278CA0006.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::12) To DBBPR03MB5399.eurprd03.prod.outlook.com (2603:10a6:10:f5::22) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBPR03MB5399:EE_|PAVPR03MB9797:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a213cdf-fbfc-4b5c-830d-08dcf9759abf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: rYE/yV9vZnxAATaUnaxZ88M4c1/XQJgEYTy0hgZJKzXuuMXPT1FfGgDaHerWydW8e5NbJzQvxoQ5n+yVfhSRWVj7+ki71zGLMIQEDeDqv4vVIoJd+4mPk/IitwoYHbjCeG7wHHU2jbhCOxjmWfsddYV/cdrwkLeqYiWStWljKZNsyfdcXP3xb5bsHuU1s7iO5REZRdXRZgHddNT20X5PWAwy2iouoz0z6KBDV6tmOicAnvUbefaHSGWOMUNutJBUptHetMjPQ7n9wnnaLF3TJb35e2VpFF9xHGYJzHzPTZRAnVO4qeVY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antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR03MB5399.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dcSnUtxKC5OacpPfDc3CA1Lo4lgtHZEnKvLXmX4qfquyf31caOWqtk6qW18enuDb/BJP7kEQea7AVPg66UConEsHalQeHLV4iKBHnZxZLR50krbLCHknxTOV/czn0vmleSaMRug3Hj00AWIjDBNHsSctIWdweVbIJTrCahHIvML70Nkq0wFodhxNl53jacl6WdENymQ8KP80ilDiW0P7ra+5nekqw2SXNvPTbuRb4an4BSRgMcmWobvu0S/kwgiIcETIo22+erEkmewLWX8vktmlWKXqQCkrOfxxULKT7W4cw0Gvmi4RwV5DQ1hnpOZKEO9ZJN3MHQ3VPBcYYLmFfRDIpGwRYjr1r72yN166SCLU9ONUwO4lq7f7mPi/ZVmFrhSZTIde19afh3CB6qB/V0UFnM2PpZYL9qZF2Afa0lnPI601OpnmaKbmUb5TnsXKEOrPKXdQBmTWYnMC21363PJD3jtoJrYkxl5IwTwCOdyZ4LPofa4Wr+p49aUIUHvWN6n9WvvUpf7kKN8viyetPyge+nHgFzdinUuuvQzvuT5B36lpSIqYNSt+ztWFjAeNbiWbRgBcG+317UsCmKMgyZZDGWYz2orDYAG2iGSp8/GzoqShIp89jNzO0b2i/BecDgMmiRJaXadUKhCRGee6uiuO8mwriD0YTQeQIN8Sm4LUj31PPQs08j3HyaRg2KLzSwH7Q8IAPf88U1m1DxqsTKKw89HY7iu77r+9KoyUqzqg5TZkR31u8v8wO2YJnvG7mT2sqlqfsfouEq0DYpA1RjmNvQ+9zW5VNkFEwCwQy/s4ZW1iMQWWAAcB84657nj9rIKNELW/t0WB07b5OxGMDkajyUS3QS1wJR1cLQWhRnBXUXqDUx01xdiyY9aSHnsluXcC8xb2sQsbEzer6U5pj17Tuz3UKpqOvp/LI5WuGHgYAlesNT5x9iici2MScl0MG7WoB0J9bo5UKUToTL+rwBqDcjYyx7yzgPBo7JBm0P7ZF0SbgUAk6hAEURIIHrYvBDzqw4cXuezWQuf2QvFp4XSgHjVkXhIsjU1ipFCnlfGGGsXdnpEvcV32o8bsqN5iMyDKuiFbPrBrsOzmTA8kgG7gBIXzEysD0Rbk7QgCP9z4fKDUmrNHTkftrpfMW+nBLqnyr9HbvXR/wP3XcbKB7AhIJWH0ruM3jJ6RZ7hO0laTysPcerXoXtiVnlhxLMBo4X6lQ4rRuj2Grkeag6yA2oeTK0u82TipyB+Ofn05gek5/LCQcTlptRwaawENF+kWPb+K+SOhZpCeiVx14MYja3OIipPqNB/WsBQ9cPwn8mhkCr2kWn9j0oumW2DcGqripB0buqlc92Jx8vTOWFgBrC1vH05J6o+83icbclTmeU+DVr6pasW5JSdTC6PPICV7QGGv/yZu74njGgW0WgCQ+QIdxchtQrHE6suTdlJw9vD2tESedutPj66eSzHQa00xZJ6nYPhnyAdh4Oih4M/81Is9npUE3uAsghIew/bz2KRfSiIyzM0x4/idwtw3pFI85QQMg6tB63n5E2iuV2iS2kiTc32rA0SDaFMscNTRYR5uWYxrVtnMqMNRNq62hCZq X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a213cdf-fbfc-4b5c-830d-08dcf9759abf X-MS-Exchange-CrossTenant-AuthSource: DBBPR03MB5399.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 06:31:08.3517 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aklhE9Tk0sm42J+g9wIl+loFX1Ot+udDyesceSWfxQ+cj2Gf9ig6LULd5z65CjU42Ob31dXvySB4+QaVP+m6mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB9797 Matrix_keypad with high capacity need a longer settle time after enable all columns and re-enabling interrupts. This to give time stable the system and not generate interrupts. Add a new optional device-tree property to configure the time before enabling interrupts after disable all columns. The default is no delay. Signed-off-by: Markus Burri Reviewed-by: Manuel Traut Tested-by: HeDong Zhao --- drivers/input/keyboard/matrix_keypad.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index c091f90..f0d3004 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -27,6 +27,7 @@ struct matrix_keypad { unsigned int row_shift; unsigned int col_scan_delay_us; + unsigned int all_cols_on_delay_us; /* key debounce interval in milli-second */ unsigned int debounce_ms; bool drive_inactive_cols; @@ -78,6 +79,9 @@ static void activate_all_cols(struct matrix_keypad *keypad, bool on) for (col = 0; col < keypad->num_col_gpios; col++) __activate_col(keypad, col, on); + + if (on && keypad->all_cols_on_delay_us) + fsleep(keypad->all_cols_on_delay_us); } static bool row_asserted(struct matrix_keypad *keypad, int row) @@ -402,6 +406,8 @@ static int matrix_keypad_probe(struct platform_device *pdev) &keypad->debounce_ms); device_property_read_u32(&pdev->dev, "col-scan-delay-us", &keypad->col_scan_delay_us); + device_property_read_u32(&pdev->dev, "all-cols-on-delay-us", + &keypad->all_cols_on_delay_us); err = matrix_keypad_init_gpio(pdev, keypad); if (err)