From patchwork Fri May 6 07:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gireesh.Hiremath@in.bosch.com X-Patchwork-Id: 571976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0545C433EF for ; Fri, 6 May 2022 07:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389527AbiEFHc6 (ORCPT ); Fri, 6 May 2022 03:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240161AbiEFHc4 (ORCPT ); Fri, 6 May 2022 03:32:56 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150045.outbound.protection.outlook.com [40.107.15.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD96A66F97; Fri, 6 May 2022 00:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwgYSsK1Xcfo2gOS1cdyvpe+fG/hpIQ33lFYx0ZFlJmHAcGiePi6M371/YwELb64JxjeU4/Fdj6EpEsZHVL8NYQlhw1kjvrzrAD0wI+Br2pE8qqLa3YVG8DKXe3hv7+lTqXATZdyhOMv5YTbI+zZUaFicbrbnvTi8iBp1hJ0OD4MV1dIDVXyiGipyX6kL+xsN05sFBKzZIkVmcBlRZ/kfFTSxBa3yzJu+02DHtX3dEE2e69VWoxdiCFeG9yRNRAQn+NpHgFEbvIF7TES4OxuDEpVe7JaYxbXZ4yyjUsHT1EZEcuMFAFUKuVKRyBlOJD+xck8TXlxUy26paRl0segCg== 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=NpmYBC/isXjTkDVRznKgiK/+FZEmaiU+i3rlY86ykXQ=; b=JebdVzLymu5C5BXWr20pa+ffqJdElhh29EYqlCtlSwGPaK2GSH6NEap4mYVygw4CbE23rsVXHNDjgd2CxLHOp2uoXx4dqUTzxsWkm/ic4zkf4XBc4nCK/MflirfHXHmqvHSqIHJ8V7kcNhmPoP36dt8IUEUTygCEnvxrd7VgkoP0PW0vdkGtIOrw1lxok71eHGBrKEwlF8hILtuE0Hv1YAV7cU6I2cR0sPv/3fPaTUSdDKQYyzf7zRqrH4/q5+RMExqg4U6wjgeCVgMk0tS7KsWr39g0Gr36BZDb84G9XXr+RrcS2J5OhxsxXYj60m53XvarZ042grQWa1NDrTJjoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.203) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NpmYBC/isXjTkDVRznKgiK/+FZEmaiU+i3rlY86ykXQ=; b=gg8BYAjqOCdYDh7yPwP2AnSwwZedulysFT2EZIhQ1EIL7O2PZH5hYqmu4zIQdrsRUfryyf+2WUJ12Sp1jRbqvBM/Ss3AqwmXTJao4+JppBucSr52VHEehIR7MvVgmKYEU6uVXhWEujWSfoeF0OPFISHYEQFccfGcDFaQ9NUjr2Y= Received: from AM6PR08CA0026.eurprd08.prod.outlook.com (2603:10a6:20b:c0::14) by AM0PR10MB3969.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:157::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Fri, 6 May 2022 07:29:08 +0000 Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:c0:cafe::2) by AM6PR08CA0026.outlook.office365.com (2603:10a6:20b:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Fri, 6 May 2022 07:29:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.203) smtp.mailfrom=in.bosch.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.203 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.203; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.203) by AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Fri, 6 May 2022 07:29:08 +0000 Received: from FE-EXCAS2001.de.bosch.com (10.139.217.200) by eop.bosch-org.com (139.15.153.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:02 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by FE-EXCAS2001.de.bosch.com (10.139.217.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:02 +0200 Received: from localhost.localdomain (10.167.1.123) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2375.24; Fri, 6 May 2022 09:28:57 +0200 From: To: , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH v2 1/4] ARM: dts: am335x: Guardian: switch to AM33XX_PADCONF pinmux macro Date: Fri, 6 May 2022 07:27:34 +0000 Message-ID: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.167.1.123] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2c2f344-43eb-4588-262a-08da2f321b87 X-MS-TrafficTypeDiagnostic: AM0PR10MB3969:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JBEzwcpWiBVPC0zZyvdWhpIqOs0DryCSnJqBeJDgJTf4ubBOY+m0ptIotEnH3m/F45D8I3j21NF0XfajU5GBnfqfSjcXvDFmPTWtsdJeao4Bjr+Q8e1+T8D/k31wLa0+85cmeGbFYccRrFMs4HMcdnVM5YoqsMtvSO7vf04ixzsUO9vWEDRWE1HzDv1P3Wtmxb2ykUPSGazmRLqKyx1CYEWFvYSVhX4kLYHrjvozsPV7MzXNQlJvQ5c/YC6idZOA9mGGooFfbHWmNC54EPcyuEzc/OeD2pLpKq1q2xhJ4Mc4oziuv2jYpRPDh9m7A0+C2KlTrUK5lE/7rwSYBU/lv4crpuQtwOIqDOhDQBlchF5FQxtQ6iK4DZ2UJ9MXbMNqmoqreLjTfiEnEewJtxFtFyQ6qkarSQ1n5Be5u5OPoF50jsb5WYfqD/kvP2VdMIcLTvLnVEjSHL//JNl61dgDp5itUn6A+d3WvUfYv7Igh9/wWCmaNpIMh4HoyofKHxcBtLCJUZfCXbKno1GVU5uCxOYcMhT37v3DZLYMI2/H6mtOYWdMYoIdpwnxkcPjuYGSnafbwDN3U6IorpVp6yT/0Vviu8QHwJhFoZif1xtb8sJED5wHr/TXrUqatntrEeUDFt0L7UK5lkVXlHtN9vsV3rjFUzVgfnhjU2WAhc2A0y9Ci2RtFFDwA0Ak42evJnalINvabrCoCMaJPH+foczGsJZ3SzRVEPFMNrWTfW79zHk= X-Forefront-Antispam-Report: CIP:139.15.153.203; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(2616005)(186003)(16526019)(47076005)(86362001)(1076003)(83380400001)(107886003)(336012)(356005)(7416002)(81166007)(5660300002)(82960400001)(36860700001)(2906002)(8936002)(40460700003)(508600001)(70586007)(70206006)(8676002)(4326008)(110136005)(6666004)(316002)(54906003)(921005)(7049001)(30864003)(26005)(82310400005)(2876002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2022 07:29:08.2121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2c2f344-43eb-4588-262a-08da2f321b87 X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.203]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3969 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Gireesh Hiremath switch the pin definitions from AM33XX_IOPAD to AM33XX_PADCONF macro Signed-off-by: Gireesh Hiremath --- No changes since v1 arch/arm/boot/dts/am335x-guardian.dts | 229 +++++++++++++++----------- 1 file changed, 132 insertions(+), 97 deletions(-) diff --git a/arch/arm/boot/dts/am335x-guardian.dts b/arch/arm/boot/dts/am335x-guardian.dts index 1a7e187b1953..94d9e51cd0f9 100644 --- a/arch/arm/boot/dts/am335x-guardian.dts +++ b/arch/arm/boot/dts/am335x-guardian.dts @@ -485,7 +485,7 @@ clkout2_pin: pinmux_clkout2_pin { pinctrl-single,pins = < /* xdma_event_intr1.clkout2 */ - AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3) + AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3) >; }; @@ -493,254 +493,289 @@ pinctrl-single,pins = < /* ADC_BATSENSE_EN */ /* (A14) MCASP0_AHCLKx.gpio3[21] */ - AM33XX_IOPAD(0x9ac, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* ADC_COINCELL_EN */ /* (J16) MII1_TX_EN.gpio3[3] */ - AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* ASP_ENABLE */ /* (A13) MCASP0_ACLKx.gpio3[14] */ - AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLUP | MUX_MODE7) + AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLUP, MUX_MODE7) /* (D16) uart1_rxd.uart1_rxd */ - AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE7) + AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT, MUX_MODE7) /* (D15) uart1_txd.uart1_txd */ - AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE7) + AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT, MUX_MODE7) /*SWITCH-OFF_3V6*/ /* (M18) gpio0[1] */ - AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE7) + AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE7) /* MIRACULIX */ /* (H17) gmii1_crs.gpio3[1] */ - AM33XX_IOPAD(0x90c, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_OUTPUT_PULLDOWN, MUX_MODE7 ) /* (H18) rmii1_refclk.gpio0[29] */ - AM33XX_IOPAD(0x944, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* (J18) gmii1_txd3.gpio0[16] */ - AM33XX_IOPAD(0x91c, PIN_INPUT | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT, MUX_MODE7) /* (J17) gmii1_rxdv.gpio3[4] */ - AM33XX_IOPAD(0x918, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) + AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_OUTPUT_PULLDOWN, MUX_MODE7) >; }; guardian_beeper_pins: pinmux_dmtimer7_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x968, PIN_OUTPUT | MUX_MODE5) /* (E18) timer7 */ + /* (E18) timer7 */ + AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT, MUX_MODE5) >; }; guardian_button_pins: pinmux_guardian_button_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x940, PIN_INPUT | MUX_MODE7) /* (M16) gmii1_rxd0.gpio2[21] */ - AM33XX_IOPAD(0x884, PIN_INPUT | MUX_MODE7) /* (V9) gpmc_csn2.gpio1[31] */ + /* (M16) gmii1_rxd0.gpio2[21] */ + AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT, MUX_MODE7) + /* (V9) gpmc_csn2.gpio1[31] */ + AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT, MUX_MODE7) >; }; i2c0_pins: pinmux_i2c0_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ - AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ + /* i2c0_sda.i2c0_sda */ + AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0) + /* i2c0_scl.i2c0_scl */ + AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0) >; }; led_bl_pins: gpio_led_bl_pins { pinctrl-single,pins = < /* P9_14, gpmc_a[2].GPIO1[18] (backlight control) */ - AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE7) + AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT, MUX_MODE7) >; }; lcd_disen_pins: pinmux_lcd_disen_pins { pinctrl-single,pins = < /* P9_27, mcasp0_fsr.gpio3[19] (lcd_disen) */ - AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLUP | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_MCASP0_FSR, PIN_OUTPUT_PULLUP | SLEWCTRL_SLOW, MUX_MODE7) >; }; lcd_pins_default: pinmux_lcd_pins_default { pinctrl-single,pins = < /* (U10) gpmc_ad8.lcd_data23 */ - AM33XX_IOPAD(0x820, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (T10) gpmc_ad9.lcd_data22 */ - AM33XX_IOPAD(0x824, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (T11) gpmc_ad10.lcd_data21 */ - AM33XX_IOPAD(0x828, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (U12) gpmc_ad11.lcd_data20 */ - AM33XX_IOPAD(0x82c, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (T12) gpmc_ad12.lcd_data19 */ - AM33XX_IOPAD(0x830, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (R12) gpmc_ad13.lcd_data18 */ - AM33XX_IOPAD(0x834, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (V13) gpmc_ad14.lcd_data17 */ - AM33XX_IOPAD(0x838, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* (U13) gpmc_ad15.lcd_data16 */ - AM33XX_IOPAD(0x83c, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE1) /* lcd_data0.lcd_data0 */ - AM33XX_IOPAD(0x8a0, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data1.lcd_data1 */ - AM33XX_IOPAD(0x8a4, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data2.lcd_data2 */ - AM33XX_IOPAD(0x8a8, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data3.lcd_data3 */ - AM33XX_IOPAD(0x8ac, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data4.lcd_data4 */ - AM33XX_IOPAD(0x8b0, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data5.lcd_data5 */ - AM33XX_IOPAD(0x8b4, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data6.lcd_data6 */ - AM33XX_IOPAD(0x8b8, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data7.lcd_data7 */ - AM33XX_IOPAD(0x8bc, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data8.lcd_data8 */ - AM33XX_IOPAD(0x8c0, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data9.lcd_data9 */ - AM33XX_IOPAD(0x8c4, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data10.lcd_data10 */ - AM33XX_IOPAD(0x8c8, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data11.lcd_data11 */ - AM33XX_IOPAD(0x8cc, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data12.lcd_data12 */ - AM33XX_IOPAD(0x8d0, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data13.lcd_data13 */ - AM33XX_IOPAD(0x8d4, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data14.lcd_data14 */ - AM33XX_IOPAD(0x8d8, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_data15.lcd_data15 */ - AM33XX_IOPAD(0x8dc, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_vsync.lcd_vsync */ - AM33XX_IOPAD(0x8e0, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_hsync.lcd_hsync */ - AM33XX_IOPAD(0x8e4, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_pclk.lcd_pclk */ - AM33XX_IOPAD(0x8e8, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) /* lcd_ac_bias_en.lcd_ac_bias_en */ - AM33XX_IOPAD(0x8ec, PIN_OUTPUT | SLEWCTRL_SLOW | MUX_MODE0) + AM33XX_PADCONF + (AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT | SLEWCTRL_SLOW, MUX_MODE0) >; }; lcd_pins_sleep: pinmux_lcd_pins_sleep { pinctrl-single,pins = < /* lcd_data0.lcd_data0 */ - AM33XX_IOPAD(0x8a0, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA0, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data1.lcd_data1 */ - AM33XX_IOPAD(0x8a4, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA1, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data2.lcd_data2 */ - AM33XX_IOPAD(0x8a8, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA2, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data3.lcd_data3 */ - AM33XX_IOPAD(0x8ac, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA3, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data4.lcd_data4 */ - AM33XX_IOPAD(0x8b0, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA4, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data5.lcd_data5 */ - AM33XX_IOPAD(0x8b4, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA5, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data6.lcd_data6 */ - AM33XX_IOPAD(0x8b8, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA6, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data7.lcd_data7 */ - AM33XX_IOPAD(0x8bc, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA7, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data8.lcd_data8 */ - AM33XX_IOPAD(0x8c0, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA8, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data9.lcd_data9 */ - AM33XX_IOPAD(0x8c4, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA9, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data10.lcd_data10 */ - AM33XX_IOPAD(0x8c8, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA10, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data11.lcd_data11 */ - AM33XX_IOPAD(0x8cc, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA11, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data12.lcd_data12 */ - AM33XX_IOPAD(0x8d0, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA12, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data13.lcd_data13 */ - AM33XX_IOPAD(0x8d4, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA13, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data14.lcd_data14 */ - AM33XX_IOPAD(0x8d8, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA14, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_data15.lcd_data15 */ - AM33XX_IOPAD(0x8dc, PULL_DISABLE | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_DATA15, PULL_DISABLE | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_vsync.lcd_vsync */ - AM33XX_IOPAD(0x8e0, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_VSYNC, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_hsync.lcd_hsync */ - AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_pclk.lcd_pclk */ - AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW, MUX_MODE7) /* lcd_ac_bias_en.lcd_ac_bias_en */ - AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW | MUX_MODE7) + AM33XX_PADCONF + (AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN | SLEWCTRL_SLOW, MUX_MODE7) >; }; guardian_led_pins: pinmux_guardian_led_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x868, PIN_OUTPUT | MUX_MODE7) /* (T16) gpmc_a10.gpio1[26] */ + /* (T16) gpmc_a10.gpio1[26] */ + AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_OUTPUT, MUX_MODE7) >; }; mmc1_pins: pinmux_mmc1_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */ - AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */ - AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */ - AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */ - AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */ - AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */ - AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* GPIO0_6 */ + /* mmc0_dat3.mmc0_dat3 */ + AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0) + /* mmc0_dat2.mmc0_dat2 */ + AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0) + /* mmc0_dat1.mmc0_dat1 */ + AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0) + /* mmc0_dat0.mmc0_dat0 */ + AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0) + /* mmc0_clk.mmc0_clk */ + AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0) + /* mmc0_cmd.mmc0_cmd */ + AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0) + /* GPIO0_6 */ + AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7) >; }; spi0_pins: pinmux_spi0_pins { pinctrl-single,pins = < /* SPI0_CLK - spi0_clk.spi */ - AM33XX_IOPAD(0x950, PIN_OUTPUT_PULLDOWN | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_OUTPUT_PULLDOWN, MUX_MODE0) /* SPI0_MOSI - spi0_d0.spi0 */ - AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT_PULLUP, MUX_MODE0) /* SPI0_MISO - spi0_d1.spi0 */ - AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0) /* SPI0_CS0 - spi */ - AM33XX_IOPAD(0x95c, PIN_OUTPUT_PULLUP | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT_PULLUP, MUX_MODE0) >; }; uart0_pins: pinmux_uart0_pins { pinctrl-single,pins = < /* uart0_rxd.uart0_rxd */ - AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0) /* uart0_txd.uart0_txd */ - AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0) >; }; uart2_pins: pinmux_uart2_pins { pinctrl-single,pins = < /* K18 uart2_rxd.mirx_txd */ - AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE1) /* L18 uart2_txd.mirx_rxd */ - AM33XX_IOPAD(0x930, PIN_OUTPUT_PULLDOWN | MUX_MODE1) + AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE1) >; }; nandflash_pins: pinmux_nandflash_pins { pinctrl-single,pins = < /* (U7) gpmc_ad0.gpmc_ad0 */ - AM33XX_IOPAD(0x800, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT, MUX_MODE0) /* (V7) gpmc_ad1.gpmc_ad1 */ - AM33XX_IOPAD(0x804, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT, MUX_MODE0) /* (R8) gpmc_ad2.gpmc_ad2 */ - AM33XX_IOPAD(0x808, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT, MUX_MODE0) /* (T8) gpmc_ad3.gpmc_ad3 */ - AM33XX_IOPAD(0x80c, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT, MUX_MODE0) /* (U8) gpmc_ad4.gpmc_ad4 */ - AM33XX_IOPAD(0x810, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT, MUX_MODE0) /* (V8) gpmc_ad5.gpmc_ad5 */ - AM33XX_IOPAD(0x814, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT, MUX_MODE0) /* (R9) gpmc_ad6.gpmc_ad6 */ - AM33XX_IOPAD(0x818, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT, MUX_MODE0) /* (T9) gpmc_ad7.gpmc_ad7 */ - AM33XX_IOPAD(0x81c, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT, MUX_MODE0) /* (T17) gpmc_wait0.gpmc_wait0 */ - AM33XX_IOPAD(0x870, PIN_INPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT, MUX_MODE0) /* (U17) gpmc_wpn.gpmc_wpn */ - AM33XX_IOPAD(0x874, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT, MUX_MODE0) /* (V6) gpmc_csn0.gpmc_csn0 */ - AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0) /* (R7) gpmc_advn_ale.gpmc_advn_ale */ - AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0) /* (T7) gpmc_oen_ren.gpmc_oen_ren */ - AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0) /* (U6) gpmc_wen.gpmc_wen */ - AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0) /* (T6) gpmc_be0n_cle.gpmc_be0n_cle */ - AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0) >; }; }; From patchwork Fri May 6 07:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gireesh.Hiremath@in.bosch.com X-Patchwork-Id: 570396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DB3DC4167B for ; Fri, 6 May 2022 07:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389540AbiEFHc7 (ORCPT ); Fri, 6 May 2022 03:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389530AbiEFHc6 (ORCPT ); Fri, 6 May 2022 03:32:58 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57A866FA4; Fri, 6 May 2022 00:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iHGbgVHy22B5m0rmW1fXFbIbYo00oxGMhp/3n3Nca3gOIzXdxtFuc1/vUjanJ1BQ9Xuj1DYCA6+z2lm+ZqOMw92/FIi6xBVAsEwjQ/wY3ymFRAZx1H6WRPiQqF5U5FRwZspusf2gEFX/pf6oIzLXnJGRdOGpSmI+YKsOiUF1BLwzB8DAbXYYI3KRsA+cHt9u9NSnpeLhEwzYKVNaLbbgQc3oB4vIRwpwzLcg/XS4k9SbWUh50dRSmEjQ1+Rl+6fzNU+CNFhGisx5ZSWOzgjEV11N60uMjK+OSxKDLzyNTztsZ3PyO+QDIL1bPWeHQlDEHy6R+cdGIEWSxfay1GUnuA== 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=l8z00E7ZdFiRUl9Fd1jKHeOcRV4DCnmrn9eYMdtP8IA=; b=KuhWXymuHdVoacMXbLD2TQ3bJhgWnSWnwQK2ySOSIdF6C0pcrzFayiHnJG5yGeO/N9Rd+ewU2n43HTWRV07pPiZFhoEb96gwK8GPvE0zcKLi1LbfjxXkQpV5qwRketk2B3svIJNbJD7UmhTOtmcRmGAIqmqaf9ULYvqsV8y4L7QcJuB2oZtNz05PhFlNODRUx+1qCqLvd6++2bguMWM7oyGZHt0ZLvMR3FJlNDGEMwCDS7mYO4hn/YLvT3zzmdLcLwF3A/1yxeLP4VWC0D3o3myimBekmXUIcitu1tFttPaFibDG5Bpgjegj3X5MlU8gQVz4TuWqlFY587sGDtFFZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.199) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l8z00E7ZdFiRUl9Fd1jKHeOcRV4DCnmrn9eYMdtP8IA=; b=aqGgyt0+reTBmiIqoVJFptSTIPM4/aYVKRfYht/RJwaQnF0ZtQj+IWC3RMFjVVPQKF/T4UK47e3NSObseyzVxNVJSP9brTeVdYUc8q4/v1cEZUcCHOnAwMXyY48zJIqun9pZM8pMqRcW2BGkEDzmGvJccyukpYKB4L3MYbzXCVk= Received: from AS9PR06CA0143.eurprd06.prod.outlook.com (2603:10a6:20b:467::20) by DB9PR10MB5908.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:39b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.27; Fri, 6 May 2022 07:29:12 +0000 Received: from VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:467:cafe::ac) by AS9PR06CA0143.outlook.office365.com (2603:10a6:20b:467::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18 via Frontend Transport; Fri, 6 May 2022 07:29:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.199) smtp.mailfrom=in.bosch.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.199 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.199; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.199) by VE1EUR03FT045.mail.protection.outlook.com (10.152.19.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Fri, 6 May 2022 07:29:11 +0000 Received: from SI-EXCAS2000.de.bosch.com (10.139.217.201) by eop.bosch-org.com (139.15.153.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:07 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by SI-EXCAS2000.de.bosch.com (10.139.217.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:07 +0200 Received: from localhost.localdomain (10.167.1.123) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2375.24; Fri, 6 May 2022 09:29:02 +0200 From: To: , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH v2 2/4] Input: mt-matrix-keypad: Add Bosch mt matrix keypad driver Date: Fri, 6 May 2022 07:27:35 +0000 Message-ID: <20220506072737.1590-2-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> References: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> MIME-Version: 1.0 X-Originating-IP: [10.167.1.123] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14644c87-9770-48aa-e1cf-08da2f321da6 X-MS-TrafficTypeDiagnostic: DB9PR10MB5908:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9wqKfN+FX6YaKCyxzEB8+XQxZZUxzm4YPh2U9T4yZ4LanDrJhLafd6OoN07ormBw8fi8n7jhE5bM7mNP9MXy6isELD/2EHZo84mfy42eujo2qMWauOu1JLVxATnYYnXA7FifQAnDmdM9d/SGIaR+i5Zgs0/0lV0amxqtAEoPVGxlxY1dUsXxDfItBR0cQv9nCZI+uesWTMzZHy280+z6yXAX3JVDvDh0i5otqU8mInzYa2U/0ds6YHCOWhUWjaehmhZ4GX9Hi5jII1ekielN4Kt0AG89xOAZpCO7Sk82nnoHdqYuak3ggFzprE6GiyULGPEOobhvaN9owz9l/SIe6GvTIrw1DzMK/F7wEXYT627y11ZmgP6+eREjMuzFkvGvTIx/wHl7iN6CNZtStwKvqale1PBgdJAm3aSCeP7/AURHIFXo/BDNlgA3nTHohQWJaqzh+5bQBeRspaC4+t99uNEESgOxyYvVnYtAWHA/QgYTXGDq1KifuTv+CHBVu9geY4sjqcomRFlczYcPW4aHW3pZQkPi0c7bYjVVR7iYqizgsf+phia0YIJ6lghB8R370SDqqdClIM/YdxPbabb+owzsiFoRgKOdL3vQNp3onshebC6C3UcLWaIxWfGZcJ0mS4UDpHsoSoZFvfJ6/UtQ2g0+UsrXW9x1nMnfHlSHwkh9ukJUipJ5Lb181iNkJJkCZnQiJ8/toCtkeYqQYTNLjcuKuwt8kiMdDzx8Sg2YaAk= X-Forefront-Antispam-Report: CIP:139.15.153.199; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(107886003)(40460700003)(1076003)(2616005)(6666004)(508600001)(81166007)(5660300002)(86362001)(921005)(356005)(8676002)(70586007)(70206006)(82960400001)(4326008)(82310400005)(83380400001)(26005)(54906003)(30864003)(7416002)(110136005)(2906002)(2876002)(8936002)(316002)(16526019)(186003)(36860700001)(47076005)(336012)(7049001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2022 07:29:11.7911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14644c87-9770-48aa-e1cf-08da2f321da6 X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.199]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR10MB5908 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Gireesh Hiremath add support for keypad driver running on Bosch Guardian Dtect board using TI-am335x cpu. Driver implementation is based on matrix_keypad.c Signed-off-by: Gireesh Hiremath Reported-by: kernel test robot --- Hi Marco, Changes since v1: resolved compilation warnings >On 22-05-04, Gireesh.Hiremath@in.bosch.com wrote: >> From: Gireesh Hiremath >> >> The existing matric_keypad.c use different gpio line for row and colunm, >> where in mt_matrix_kepad.c use same gpio line for row as well as column. >> a key can be placed at each intersection of a unique row number >> not equal to a unique column and they are diagonally symmetric. >> Advantage of this is with existed gpio line we can get more keys >> >> example: in matrix_keypad.c for 5 gpio line possible matrix is 2X3 or 3X2 >> and maximum possible keys are 6 but >> in mt_matrix_kepad.c for same 5 gpio line possible matrix is 5X5 and maximum >> possible buttons are 10, below table will discribe that > >Nobody should stop you to increase the amount of max. possible keys, so >this isn't a real block. >> ------------------------------------------------------ >> |Row\Col |GPIO 0 | GPIO 1 | GPIO 2 | GPIO 3 | GPIO 4 | >> ------------------------------------------------------ >> | GPIO 0 | X | KEY_9 | KEY_2 | KEY_3 | KEY_1 | >> ------------------------------------------------------ >> | GPIO 1 | KEY_9 | X | KEY_6 | KEY_5 | KEY_0 | >> ------------------------------------------------------ >> | GPIO 2 | KEY_2 | KEY_6 | X | KEY_4 | KEY_7 | >> ------------------------------------------------------ >> | GPIO 3 | KEY_3 | KEY_5 | KEY_4 | X | KEY_8 | >> ------------------------------------------------------ >> | GPIO 4 | KEY_1 | KEY_0 | KEY_7 | KEY_8 | X | >> ------------------------------------------------------ >> X - invalid key >> KEY_x - preferred key code > >That should be pointed somewhere very clearly, thanks for the >description. Also what is than the benefit of the original matrix_keypad >driver? we have special keypad for Bosch measuring tools, which is not completely matric keypad so we have derived from matrix_kepad.c to make our keypad to work. In this keypad there may or may not have keymap for all gpio line as below ------------------------------------------------------ |Row\Col |GPIO 0 | GPIO 1 | GPIO 2 | GPIO 3 | GPIO 4 | ------------------------------------------------------ | GPIO 0 | X | KEY_9 | KEY_2 | X | KEY_1 | ------------------------------------------------------ | GPIO 1 | KEY_9 | X | KEY_6 | X | X | ------------------------------------------------------ | GPIO 2 | KEY_2 | KEY_6 | X | KEY_4 | KEY_7 | ------------------------------------------------------ | GPIO 3 | X | X | KEY_4 | X | KEY_8 | ------------------------------------------------------ | GPIO 4 | KEY_1 | X | KEY_7 | KEY_8 | X | ------------------------------------------------------ X - invalid key example DTS line-gpios = < &gpio1 24 1 /*gpio_56*/ &gpio1 23 1 /*gpio_55*/ &gpio1 22 1 /*gpio_54*/ &gpio1 20 1 /*gpio_52*/ &gpio1 16 1 /*gpio_48*/ >; linux,keymap = < 0x00000000 /* row 0, col 0, KEY_RESERVED */ 0x0001000a /* row 0, col 1, KEY_9 */ 0x00020003 /* row 0, col 2, KEY_2 */ 0x00030000 /* row 0, col 3, KEY_RESERVED */ 0x00040002 /* row 0, col 4, KEY_1 */ 0x0100000a /* row 1, col 0, KEY_9 */ 0x01010000 /* row 1, col 1, KEY_RESERVED */ 0x01020007 /* row 1, col 2, KEY_6 */ 0x01030000 /* row 1, col 3, KEY_RESERVED */ 0x01040000 /* row 1, col 4, KEY_RESERVED */ 0x02000003 /* row 2, col 0, KEY_2 */ 0x02010007 /* row 2, col 1, KEY_6 */ 0x02020000 /* row 2, col 2, KEY_RESERVED */ 0x02030005 /* row 2, col 3, KEY_4 */ 0x02040008 /* row 2, col 4, KEY_7 */ 0x03000000 /* row 3, col 0, KEY_RESERVED */ 0x03010000 /* row 3, col 1, KEY_RESERVED */ 0x03020005 /* row 3, col 2, KEY_4 */ 0x03030000 /* row 3, col 3, KEY_RESERVED */ 0x03040009 /* row 3, col 4, KEY_8 */ 0x04000002 /* row 4, col 0, KEY_1 */ 0x04010000 /* row 4, col 1, KEY_RESERVED */ 0x04020008 /* row 4, col 2, KEY_7 */ 0x04030009 /* row 4, col 3, KEY_8 */ 0x04040000 /* row 4, col 4, KEY_RESERVED */ >; > >> both matric_keypad.c and mt_matrix_kepad.c logically operate differently, >> my openion is not to merge both. > >IMHO from the user/system-integrator pov it is looking the same and so >one driver should be fine. To distinguish between both modes we could >add dt-property or add a new dt-compatible like "gpio-matrix-keypad-v2". > as mentioned above our keypad is not complete matrix keypad and it will not be compatible with matrix_keypad diver. that is the reason we derived mt matrix keypad driver. to avoid confusion, we will rename the driver as bosch_mt_keypad.c if you suggest. >Regards, > Marco Regards Gireesh Hiremath drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mt_matrix_keypad.c | 741 ++++++++++++++++++++++ include/linux/input/mt_matrix_keypad.h | 85 +++ 4 files changed, 837 insertions(+) create mode 100644 drivers/input/keyboard/mt_matrix_keypad.c create mode 100644 include/linux/input/mt_matrix_keypad.h diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 4ea79db8f134..a55ee8656194 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -303,6 +303,16 @@ config KEYBOARD_MATRIX To compile this driver as a module, choose M here: the module will be called matrix_keypad. +config KEYBOARD_MT_MATRIX + tristate "GPIO driven MT matrix keypad support" + depends on GPIOLIB || COMPILE_TEST + help + This driver enable support for GPIO driven + mt matrix keypad. + + To compile this driver as a module, choose M here: the + module will be called mt_matrix_keypad. + config KEYBOARD_HIL_OLD tristate "HP HIL keyboard support (simple driver)" depends on GSC || HP300 diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 721936e90290..c7686d338b5d 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o obj-$(CONFIG_KEYBOARD_LPC32XX) += lpc32xx-keys.o obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o +obj-$(CONFIG_KEYBOARD_MT_MATRIX) += mt_matrix_keypad.o obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o obj-$(CONFIG_KEYBOARD_MCS) += mcs_touchkey.o obj-$(CONFIG_KEYBOARD_MPR121) += mpr121_touchkey.o diff --git a/drivers/input/keyboard/mt_matrix_keypad.c b/drivers/input/keyboard/mt_matrix_keypad.c new file mode 100644 index 000000000000..2664ce3c2653 --- /dev/null +++ b/drivers/input/keyboard/mt_matrix_keypad.c @@ -0,0 +1,741 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * GPIO driven mt matrix keyboard driver + * + * Copyright (c) 2008 Marek Vasut + * Copyright (c) 2017 vinay + * + * Based on matrix_keypad.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MODULE_NAME "mt-matrix-keypad" + +struct mt_matrix_keypad { + struct mt_matrix_keypad_platform_data *pdata; + struct input_dev *input_dev; + + DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS); + + struct delayed_work work; + spinlock_t lock; + bool scan_pending; + bool stopped; + bool gpio_all_disabled; +}; + +static bool +get_gpio_line_value(const struct mt_matrix_keypad_platform_data *pdata, + int row); +static void +activate_line_driving(const struct mt_matrix_keypad_platform_data *pdata, + int line, bool on); + +void init_phase(struct mt_matrix_keypad_platform_data *pdata) +{ + pdata->phase_state.phase_prepare = -1; + pdata->phase_state.phase_start = 0; + pdata->phase_state.phase_update_button = pdata->num_line_gpios; +} + +void button_init(struct button *btn, bool btn_hw_state, int key) +{ + btn->state.boPrevious = btn_hw_state; + btn->state.boCurrentStateOfHw = btn_hw_state; + btn->state.boCurrentStateOfSw = false; + btn->state.boCurrent = btn_hw_state; + btn->state.boEnabled = true; + btn->state.boStateAtInit = btn_hw_state; + btn->event.ui8Register = 0; + btn->key = key; +} + +struct button_states get_button_state(struct button *btn) +{ + return btn->state; +} + +union typeEvent get_and_clear_events(struct button *btn) +{ + union typeEvent beTemp = btn->event; + + btn->event.ui8Register = 0; + + return beTemp; +} + +uint8_t get_btn_index(struct mt_matrix_keypad_platform_data *pdata, int btn_key) +{ + uint8_t i; + + for (i = 0; i < pdata->num_of_buttons; i++) { + if (pdata->button_array[i].key == btn_key) + break; + } + return i; +} + +void set_btn_state_by_hw(struct button *btn, bool boButtonState) +{ + btn->state.boCurrentStateOfHw = boButtonState; +} + +bool check_button_changes(struct button *btn) +{ + btn->state.boPrevious = btn->state.boCurrent; + btn->state.boCurrent = + btn->state.boCurrentStateOfHw || btn->state.boCurrentStateOfSw; + + /* Check if Button is pressed */ + if ((btn->state.boPrevious == false) && + (btn->state.boCurrent == true)) { + btn->event.status.boPressed = true; + } + + /* Check if Button is released */ + else if ((btn->state.boPrevious == true) && + (btn->state.boCurrent == false)) { + btn->event.status.boReleased = true; + } + + if (btn->event.ui8Register != 0) + btn->event.status.boGlobalChanged = true; + + return btn->event.status.boGlobalChanged; +} + +struct button_states +get_btn_id_state(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index) +{ + if (btn_index < pdata->num_of_buttons) + return get_button_state(&pdata->button_array[btn_index]); + else + return get_button_state(&pdata->button_array[0]); +} + +union typeEvent +get_and_clear_btn_events(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index) +{ + if (btn_index < pdata->num_of_buttons) + return get_and_clear_events(&pdata->button_array[btn_index]); + else + return get_and_clear_events(&pdata->button_array[0]); +} + +void button_hdl_init(struct mt_matrix_keypad_platform_data *pdata) +{ + int row, col, index; + int i; + + pdata->scan_phase = pdata->phase_state.phase_prepare; + pdata->intialize_buttons = true; + + /* Init Button Objects, will be reinited once states are captured */ + i = 0; + for (row = 1; row < pdata->num_line_gpios; row++) + for (col = 0; col < row; col++) { + index = (row * pdata->num_line_gpios) + col; + if (pdata->button_matrix[index] != + pdata->button_matrix[0]) { + if (i < pdata->num_of_buttons) { + button_init( + &pdata->button_array[i], false, + pdata->button_matrix[index]); + i++; + } + } + } + + pr_debug("[%s]: %s Done\n", MODULE_NAME, __func__); +} + +bool on_button_event(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index, union typeEvent btn_event, + struct input_dev *input_dev) +{ + bool any_btn_served = true; + unsigned int key_code = 0; + int key_value = 0; + + key_code = pdata->button_array[btn_index].key; + + if (btn_event.status.boPressed) { + key_value = 1; + pr_debug("[%s]:%d Pressed\n", MODULE_NAME, key_code); + } + + if (btn_event.status.boReleased) { + key_value = 0; + pr_debug("[%s]:%d Released\n", MODULE_NAME, key_code); + } + + input_report_key(input_dev, key_code, key_value); + input_sync(input_dev); + return any_btn_served; +} + +void process_button_events(const struct mt_matrix_keypad_platform_data *pdata, + struct input_dev *input_dev) +{ + int btn_index; + bool any_btn_served = false; + + for (btn_index = 0; btn_index < pdata->num_of_buttons; btn_index++) { + const union typeEvent beEvent = + get_and_clear_btn_events(pdata, (int)btn_index); + + if (beEvent.status.boGlobalChanged) { + const struct button_states bsState = + get_btn_id_state(pdata, (int)btn_index); + + if (bsState.boEnabled) { + any_btn_served |= + on_button_event(pdata, (int)btn_index, + beEvent, input_dev); + } + } + } +} + +void update_buttons(struct mt_matrix_keypad_platform_data *pdata, + struct input_dev *input_dev) +{ + if (pdata->scan_phase == pdata->phase_state.phase_prepare) { + pdata->scan_phase = pdata->phase_state.phase_start; + activate_line_driving(pdata, (int)pdata->scan_phase, true); + } else if (pdata->scan_phase == + pdata->phase_state.phase_update_button) { + bool btn_changes_occured = false; + int btn_index; + + if (pdata->intialize_buttons) { + int i; + + pdata->intialize_buttons = false; + + for (i = 0; i < pdata->num_of_buttons; i++) { + const bool btn_curr_hw_state = + get_button_state( + &pdata->button_array[i]) + .boCurrentStateOfHw; + button_init(&pdata->button_array[i], + btn_curr_hw_state, + pdata->button_array[i].key); + } + } + + for (btn_index = 0; btn_index < pdata->num_of_buttons; + btn_index++) { + btn_changes_occured |= check_button_changes( + &pdata->button_array[btn_index]); + } + + if (btn_changes_occured) + process_button_events(pdata, input_dev); + + pdata->scan_phase = pdata->phase_state.phase_start; + } else { + uint8_t *btn_keylines; + uint8_t number_of_buttons_pressed = 0; + uint8_t btn_index; + uint8_t btn_key; + uint16_t index; + int i; + + btn_keylines = kcalloc(pdata->num_line_gpios, sizeof(uint8_t), + GFP_KERNEL); + for (i = 0; i < pdata->num_line_gpios; i++) { + index = (pdata->scan_phase * pdata->num_line_gpios) + i; + btn_key = pdata->button_matrix[index]; + btn_keylines[i] = false; + + if ((btn_key != pdata->button_matrix[0]) && + (get_gpio_line_value(pdata, (int)i) != false)) { + btn_keylines[i] = true; + number_of_buttons_pressed++; + } + } + if (number_of_buttons_pressed < 2) { + for (i = 0; i < pdata->num_line_gpios; i++) { + index = (pdata->scan_phase * + pdata->num_line_gpios) + + i; + btn_key = pdata->button_matrix[index]; + if (btn_key != pdata->button_matrix[0]) { + btn_index = + get_btn_index(pdata, btn_key); + set_btn_state_by_hw( + &pdata->button_array[btn_index], + btn_keylines[i]); + } + } + } + + kfree(btn_keylines); + activate_line_driving(pdata, (int)pdata->scan_phase, false); + pdata->scan_phase++; + activate_line_driving( + pdata, (int)(pdata->scan_phase % pdata->num_line_gpios), + true); + } +} + +/* + * NOTE: normally the GPIO has to be put into HiZ when de-activated to cause + * minmal side effect when scanning other columns, here it is configured to + * be input, and it should work on most platforms. + */ +static void +__activate_line_driving(const struct mt_matrix_keypad_platform_data *pdata, + int line, bool on) +{ + bool level_on = pdata->active_low; + + if (on) + gpio_direction_output(pdata->line_gpios[line], level_on); + else + gpio_direction_input(pdata->line_gpios[line]); +} + +static void +activate_line_driving(const struct mt_matrix_keypad_platform_data *pdata, + int line, bool on) +{ + __activate_line_driving(pdata, line, on); + + if (on && pdata->col_scan_delay_us) + udelay(pdata->col_scan_delay_us); +} + +static bool +get_gpio_line_value(const struct mt_matrix_keypad_platform_data *pdata, int row) +{ + return gpio_get_value(pdata->line_gpios[row]) ? pdata->active_low : + !pdata->active_low; +} + +/* + * This gets the keys from keyboard and reports it to input subsystem + */ +static void mt_matrix_keypad_scan(struct work_struct *work) +{ + struct mt_matrix_keypad *keypad = + container_of(work, struct mt_matrix_keypad, work.work); + struct input_dev *input_dev = keypad->input_dev; + struct mt_matrix_keypad_platform_data *pdata = keypad->pdata; + + if (keypad->stopped == false) { + update_buttons(pdata, input_dev); + schedule_delayed_work( + &keypad->work, + msecs_to_jiffies(keypad->pdata->debounce_ms)); + } +} + +static int mt_matrix_keypad_start(struct input_dev *dev) +{ + struct mt_matrix_keypad *keypad = input_get_drvdata(dev); + + keypad->stopped = false; + /* + * memory access initiated before the memory barrier + * will be complete before passing the barrier + */ + mb(); + + /* + * Schedule an immediate key scan to capture current key state; + * columns will be activated and IRQs be enabled after the scan. + */ + schedule_delayed_work(&keypad->work, 0); + + return 0; +} + +static void mt_matrix_keypad_stop(struct input_dev *dev) +{ + struct mt_matrix_keypad *keypad = input_get_drvdata(dev); + + keypad->stopped = true; + /* + * memory access initiated before the memory barrier + * will be complete before passing the barrier + */ + mb(); + cancel_delayed_work_sync(&keypad->work); +} + +#ifdef CONFIG_PM_SLEEP +static void mt_matrix_keypad_enable_wakeup(struct mt_matrix_keypad *keypad) +{ + const struct mt_matrix_keypad_platform_data *pdata = keypad->pdata; + unsigned int gpio; + int i; + + if (pdata->clustered_irq > 0) { + if (enable_irq_wake(pdata->clustered_irq) == 0) + keypad->gpio_all_disabled = true; + } else { + for (i = 0; i < pdata->num_line_gpios; i++) { + if (!test_bit(i, keypad->disabled_gpios)) { + gpio = pdata->line_gpios[i]; + + if (enable_irq_wake(gpio_to_irq(gpio)) == 0) + __set_bit(i, keypad->disabled_gpios); + } + } + } +} + +static void mt_matrix_keypad_disable_wakeup(struct mt_matrix_keypad *keypad) +{ + const struct mt_matrix_keypad_platform_data *pdata = keypad->pdata; + unsigned int gpio; + int i; + + if (pdata->clustered_irq > 0) { + if (keypad->gpio_all_disabled) { + disable_irq_wake(pdata->clustered_irq); + keypad->gpio_all_disabled = false; + } + } else { + for (i = 0; i < pdata->num_line_gpios; i++) { + if (test_and_clear_bit(i, keypad->disabled_gpios)) { + gpio = pdata->line_gpios[i]; + disable_irq_wake(gpio_to_irq(gpio)); + } + } + } +} + +static int mt_matrix_keypad_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct mt_matrix_keypad *keypad = platform_get_drvdata(pdev); + + mt_matrix_keypad_stop(keypad->input_dev); + + if (device_may_wakeup(&pdev->dev)) + mt_matrix_keypad_enable_wakeup(keypad); + + pinctrl_pm_select_sleep_state(dev); + + return 0; +} + +static int mt_matrix_keypad_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct mt_matrix_keypad *keypad = platform_get_drvdata(pdev); + + if (device_may_wakeup(&pdev->dev)) + mt_matrix_keypad_disable_wakeup(keypad); + + pinctrl_pm_select_default_state(dev); + + mt_matrix_keypad_start(keypad->input_dev); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(mt_matrix_keypad_pm_ops, mt_matrix_keypad_suspend, + mt_matrix_keypad_resume); + +static int mt_matrix_keypad_init_gpio(struct platform_device *pdev, + struct mt_matrix_keypad *keypad) +{ + const struct mt_matrix_keypad_platform_data *pdata = keypad->pdata; + int i, err; + + for (i = 0; i < pdata->num_line_gpios; i++) { + err = gpio_request(pdata->line_gpios[i], "mt_kbd_row"); + if (err) { + dev_err(&pdev->dev, + "failed to request GPIO%d for ROW%d\n", + pdata->line_gpios[i], i); + goto err_free_rows; + } + + gpio_direction_input(pdata->line_gpios[i]); + } + + return 0; + +err_free_rows: + while (--i >= 0) + gpio_free(pdata->line_gpios[i]); + + i = pdata->num_line_gpios; + return err; +} + +static void mt_matrix_keypad_free_gpio(struct mt_matrix_keypad *keypad) +{ + const struct mt_matrix_keypad_platform_data *pdata = keypad->pdata; + int i; + + for (i = 0; i < pdata->num_line_gpios; i++) + gpio_free(pdata->line_gpios[i]); +} + +#ifdef CONFIG_OF +static struct mt_matrix_keypad_platform_data * +mt_matrix_keypad_parse_dt(struct device *dev) +{ + struct mt_matrix_keypad_platform_data *pdata = NULL; + struct device_node *np = dev->of_node; + unsigned int *gpios; + struct button *button_array; + int8_t *button_matrix; + uint16_t keycode; + uint32_t *ptr; + int keymap; + int i; + + if (!np) { + dev_err(dev, "device lacks DT data\n"); + return ERR_PTR(-ENODEV); + } + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + pdata->num_line_gpios = of_gpio_named_count(np, "line-gpios"); + if (pdata->num_line_gpios <= 0) { + dev_err(dev, "number of gpio line not specified\n"); + return ERR_PTR(-EINVAL); + } + + if (of_get_property(np, "linux,no-autorepeat", NULL)) + pdata->no_autorepeat = true; + + pdata->wakeup = of_property_read_bool(np, "wakeup-source") || + of_property_read_bool(np, "linux,wakeup"); /* legacy */ + + if (of_get_property(np, "gpio-activelow", NULL)) + pdata->active_low = true; + + of_property_read_u32(np, "debounce-delay-ms", &pdata->debounce_ms); + of_property_read_u32(np, "col-scan-delay-us", + &pdata->col_scan_delay_us); + of_property_read_u32(np, "number-of-buttons", &pdata->num_of_buttons); + if (pdata->num_of_buttons <= 0) { + dev_err(dev, "number of button not specified\n"); + return ERR_PTR(-EINVAL); + } + + button_array = + devm_kzalloc(dev, + sizeof(struct button) * (pdata->num_of_buttons), + GFP_KERNEL); + if (!button_array) { + dev_err(dev, "could not allocate memory for button array\n"); + return ERR_PTR(-ENOMEM); + } + + pdata->button_array = button_array; + + gpios = devm_kzalloc(dev, + sizeof(unsigned int) * (pdata->num_line_gpios), + GFP_KERNEL); + if (!gpios) { + dev_err(dev, "could not allocate memory for gpios\n"); + return ERR_PTR(-ENOMEM); + } + + for (i = 0; i < pdata->num_line_gpios; i++) + gpios[i] = of_get_named_gpio(np, "line-gpios", i); + + pdata->line_gpios = gpios; + + keymap = device_property_count_u32(dev, "linux,keymap"); + if (keymap <= 0 || + keymap > (pdata->num_line_gpios * pdata->num_line_gpios)) { + dev_err(dev, "linux,keymap property count is more"); + return ERR_PTR(-ENXIO); + } + + ptr = kcalloc(keymap, sizeof(uint32_t), GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + if (device_property_read_u32_array(dev, "linux,keymap", ptr, keymap)) { + dev_err(dev, "problem parsing keymap property\n"); + kfree(ptr); + return ERR_PTR(-EINVAL); + } + + button_matrix = + devm_kzalloc(dev, (keymap * sizeof(int8_t)), GFP_KERNEL); + if (!button_matrix) { + dev_err(dev, "could not allocate memory for button matrix\n"); + return ERR_PTR(-ENOMEM); + } + + pdata->button_matrix = button_matrix; + for (i = 0; i < keymap; i++) { + keycode = KEYCODE(ptr[i]); + pdata->button_matrix[i] = keycode; + } + kfree(ptr); + + return pdata; +} + +#else +static inline struct mt_matrix_keypad_platform_data * +mt_matrix_keypad_parse_dt(struct device *dev) +{ + dev_err(dev, "no platform data defined\n"); + + return ERR_PTR(-EINVAL); +} +#endif + +static int mt_matrix_keypad_probe(struct platform_device *pdev) +{ + struct mt_matrix_keypad_platform_data *pdata; + struct mt_matrix_keypad *keypad; + struct input_dev *input_dev; + int err; + int row, col, index; + + dev_info(&pdev->dev, "[%s]: Probe\n", MODULE_NAME); + pdata = dev_get_platdata(&pdev->dev); + + if (!pdata) { + pdata = mt_matrix_keypad_parse_dt(&pdev->dev); + if (IS_ERR(pdata)) { + dev_err(&pdev->dev, "Mt platform data not defined\n"); + return PTR_ERR(pdata); + } + } + + err = pdata->line_gpios[0]; + if (err < 0) + return dev_err_probe( + &pdev->dev, err, + "Could not register gpio chip for mt matrix keypad\n"); + + keypad = kzalloc(sizeof(struct mt_matrix_keypad), GFP_KERNEL); + input_dev = input_allocate_device(); + + if (!keypad || !input_dev) { + dev_err(&pdev->dev, "[%s]: Allocation Failed\n", MODULE_NAME); + err = -ENOMEM; + goto err_free_mem; + } + + init_phase(pdata); + keypad->input_dev = input_dev; + keypad->pdata = pdata; + keypad->stopped = true; + INIT_DELAYED_WORK(&keypad->work, mt_matrix_keypad_scan); + spin_lock_init(&keypad->lock); + + input_dev->name = pdev->name; + input_dev->id.bustype = BUS_HOST; + input_dev->dev.parent = &pdev->dev; + input_dev->open = mt_matrix_keypad_start; + input_dev->close = mt_matrix_keypad_stop; + + if (!pdata->no_autorepeat) + __set_bit(EV_REP, input_dev->evbit); + + input_set_capability(input_dev, EV_MSC, MSC_SCAN); + + for (row = 1; row < pdata->num_line_gpios; row++) { + for (col = 0; col < row; col++) { + index = (row * pdata->num_line_gpios) + col; + if (pdata->button_matrix[index] != + pdata->button_matrix[0]) { + input_set_capability( + input_dev, EV_KEY, + pdata->button_matrix[index]); + } + } + } + + input_set_drvdata(input_dev, keypad); + err = mt_matrix_keypad_init_gpio(pdev, keypad); + + if (err) + goto err_free_mem; + + button_hdl_init(pdata); + + err = input_register_device(keypad->input_dev); + + if (err) + goto err_free_gpio; + + device_init_wakeup(&pdev->dev, pdata->wakeup); + platform_set_drvdata(pdev, keypad); + + return 0; + +err_free_gpio: + mt_matrix_keypad_free_gpio(keypad); + +err_free_mem: + input_free_device(input_dev); + kfree(keypad); + return err; +} + +static int mt_matrix_keypad_remove(struct platform_device *pdev) +{ + struct mt_matrix_keypad *keypad = platform_get_drvdata(pdev); + + device_init_wakeup(&pdev->dev, 0); + input_unregister_device(keypad->input_dev); + mt_matrix_keypad_free_gpio(keypad); + kfree(keypad); + + return 0; +} + +#ifdef CONFIG_OF +static const struct of_device_id mt_matrix_keypad_dt_match[] = { + { .compatible = "gpio-mt-matrix-keypad" }, + {} +}; +MODULE_DEVICE_TABLE(of, mt_matrix_keypad_dt_match); +#endif + +static struct platform_driver mt_matrix_keypad_driver = { + .probe = mt_matrix_keypad_probe, + .remove = mt_matrix_keypad_remove, + .driver = { + .name = "mt-matrix-keypad", + .pm = &mt_matrix_keypad_pm_ops, + .of_match_table = of_match_ptr(mt_matrix_keypad_dt_match), + }, +}; +module_platform_driver(mt_matrix_keypad_driver); + +MODULE_AUTHOR("vinay"); +MODULE_DESCRIPTION("GPIO Driven Mt Matrix Keypad Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:mt-matrix-keypad"); diff --git a/include/linux/input/mt_matrix_keypad.h b/include/linux/input/mt_matrix_keypad.h new file mode 100644 index 000000000000..46dfe49c5fe1 --- /dev/null +++ b/include/linux/input/mt_matrix_keypad.h @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _MT_MATRIX_KEYPAD_H +#define _MT_MATRIX_KEYPAD_H + +#include +#include +#include + +#define MATRIX_MAX_ROWS 32 +#define KEYCODE(keymap) (keymap & 0xFFFF) + +struct button_states { + uint8_t boPrevious : 1; + uint8_t boCurrent : 1; + uint8_t boCurrentStateOfHw : 1; + uint8_t boCurrentStateOfSw : 1; + uint8_t boEnabled : 1; + uint8_t boStateAtInit : 1; +}; + +union typeEvent { + uint8_t ui8Register; + struct { + uint8_t boGlobalChanged : 1; + uint8_t boPressed : 1; + uint8_t boReleased : 1; + } status; +}; + +struct button { + uint8_t key; + union typeEvent event; + struct button_states state; +}; + +struct phase { + int phase_prepare; + int phase_start; + int phase_update_button; +}; + +struct mt_matrix_keypad_platform_data { + const struct mt_keymap_data *keymap_data; + const unsigned int *line_gpios; + unsigned int num_line_gpios; + unsigned int num_of_buttons; + unsigned int col_scan_delay_us; + unsigned int debounce_ms; + unsigned int clustered_irq; + unsigned int clustered_irq_flags; + + bool active_low; + bool wakeup; + bool no_autorepeat; + bool intialize_buttons; + + int8_t scan_phase; + int8_t *button_matrix; + struct button *button_array; + struct phase phase_state; +}; + +void init_phase(struct mt_matrix_keypad_platform_data *pdata); +void button_init(struct button *btn, bool btn_hw_state, int key); +struct button_states get_button_state(struct button *btn); +union typeEvent get_and_clear_events(struct button *btn); +uint8_t get_btn_index(struct mt_matrix_keypad_platform_data *pdata, + int btn_key); +void set_btn_state_by_hw(struct button *btn, bool boButtonState); +bool check_button_changes(struct button *btn); +struct button_states +get_btn_id_state(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index); +union typeEvent +get_and_clear_btn_events(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index); +void button_hdl_init(struct mt_matrix_keypad_platform_data *pdata); +bool on_button_event(const struct mt_matrix_keypad_platform_data *pdata, + int btn_index, union typeEvent btn_event, + struct input_dev *input_dev); +void process_button_events(const struct mt_matrix_keypad_platform_data *pdata, + struct input_dev *input_dev); +void update_buttons(struct mt_matrix_keypad_platform_data *pdata, + struct input_dev *input_dev); +#endif /* _MT_MATRIX_KEYPAD_H */ From patchwork Fri May 6 07:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gireesh.Hiremath@in.bosch.com X-Patchwork-Id: 570397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F320FC43219 for ; Fri, 6 May 2022 07:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389536AbiEFHc6 (ORCPT ); Fri, 6 May 2022 03:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378251AbiEFHc4 (ORCPT ); Fri, 6 May 2022 03:32:56 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140089.outbound.protection.outlook.com [40.107.14.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4DA66FA0; Fri, 6 May 2022 00:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eRUPARCI+gSyLGQmveZx+QXPFv79FDXtbhWEVZzkYXWUwYgTXxqYiFnOxBj6FnlYHCcHd7jzzY03pHDyF/OGFkFe1BIVn5CKkiTPEvycjNhJAv5WfqgxLN6O1iicGXQ4h6Za8by6Pe56g7l50ZU5Zmju//vMH7dJyhn49326+nDxZgc7N43/lxMLD5w3ZCdnkMUOk4AoertizLgKcb0oTxQaqCRwBeueimS0oM9WEiVQhLZJYGDgmw7Clhn7ZgwLv12GED8pDIqnQTdBX/bOflAokxemQBB9FU1XYcmfsjX/lAl1St5UwDdJtFiSyoZrPWLA+Zt1PXspkqPL2GQSzw== 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=Ra9aVPNgEMdzmUCQXvAKbZdrFWPXBt2CyVsxdFca7Rs=; b=QYimufKSTYUFi0dmHsXZj5gqWn02a53bsXnh2MuO1l8Y2Wou3ApiiMsiS7V/vQp5O3VLcptyP36t5e6j8II8rDadWZeIKtYLUJMzj+pZ0kSLmfQxWw+pEk5x2axAEGjBFzYOQWVGqs6a01zTwKIJZSBTgNdY2E0bQGMgfbSVIr3Pu1GBoKOO4gRU7p29HcubXbaXui7au9rCmVGCUPPLrdaUI6O52vk77WzUc4fjUy476hN20XD9lUHrgrK8HdfeMZe2upGjb63X0AWkZgty/Bz1V1rvWmHyz9bmqxV5p4xhNEpa4mUrHI4F2xmxul5azL1qFVZ/UFp/8GfTlA12BA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.200) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ra9aVPNgEMdzmUCQXvAKbZdrFWPXBt2CyVsxdFca7Rs=; b=DgFZ9MGB50cYRsr+Irb0QRMhxzUvP5u2j7iUXTrDXWssWmvUuq56OvHTqvBCJHNJN3lMUZaylPV8x4EUMUh/x+1K1B1hILBcXpYHAz6DDf9lXHpciI7+SAiGn5Wv0r5LXloznw+OsJgfn2RJTCGwW2sj7lV12kxxNCHyaB5tYJo= Received: from AS8P251CA0019.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::22) by AM5PR10MB1843.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:1d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Fri, 6 May 2022 07:29:11 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::50) by AS8P251CA0019.outlook.office365.com (2603:10a6:20b:2f2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18 via Frontend Transport; Fri, 6 May 2022 07:29:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.200) smtp.mailfrom=in.bosch.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.200 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.200; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.200) by VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Fri, 6 May 2022 07:29:10 +0000 Received: from FE-EXCAS2001.de.bosch.com (10.139.217.200) by eop.bosch-org.com (139.15.153.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:10 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by FE-EXCAS2001.de.bosch.com (10.139.217.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:10 +0200 Received: from localhost.localdomain (10.167.1.123) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2375.24; Fri, 6 May 2022 09:29:06 +0200 From: To: , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH v2 3/4] ARM: dts: am335x: Guardian: add keymap to mt matrix keypad Date: Fri, 6 May 2022 07:27:36 +0000 Message-ID: <20220506072737.1590-3-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> References: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> MIME-Version: 1.0 X-Originating-IP: [10.167.1.123] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24ed3e19-90cc-4d80-71df-08da2f321d12 X-MS-TrafficTypeDiagnostic: AM5PR10MB1843:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zn5xc/aAVkfDM0A0LCT0ah74ymR12uKPUZyRgazftFmxDtgvpzYex6HYF04MnimHM3CzySwsd1NiN5VZeT9q5sXTw/InPoq26MdCaz8+maMVtbCo5Nyr73QdxDJvQAYZBT3LGrW8VGWD/3Y5RYjouFFQT6mct9w7QJ8v8t3ARcjOMYmBOTAs6wxBF9Gln2zkx+6+DlmOLDykRTfJsjf7dWcao8RZpTyjXFUJiMG5S+hCc3eyYj3Sl3sek4pYTZdZbL9ivG3czij2PASIshGTRVv44DVCuhrObyc4QUhEfbDitl+nBxNBJJGfizuR+G2V+3fe96I269Pv0PJ8buyTuG67wresYtH+j7mIvfN8E1IykaQNHdrYOMtPckW1d0aFbB1SjpAvqacPBNBNuCrPjybhchqFEZ4ngQotUhOeDXysP3WttSXKHp2Qa8PH418p8/UBryb4/lhcvddzRCl+3PE8SwIQmrrtM+kffjIG7S0HPwvLwXYwOT04v+8CqaF3Z7yQCdrsolnlTLLzxHdPf7Bs9WAJZM0tphWLIbp+TepptxBLqgZq8kf340L/nb1rbG5gSJCdr/+6z5G2TfzXTpZ2RWfEjyprHZo6rGcyf6zJIMvwBt+OsbGUxrZwq5iGjhsBBVd3UsCKU+VmWBKa4ax6tBOakndNtqRPMyrTmz4AKSXKtxHHlS3TKA37RSLDyfkfn0viaRYWhTYJGcQVyPWyGzWjK5A+BalWazvgc6s= X-Forefront-Antispam-Report: CIP:139.15.153.200; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2616005)(110136005)(186003)(26005)(7049001)(54906003)(7416002)(81166007)(82960400001)(40460700003)(5660300002)(2876002)(6666004)(356005)(107886003)(70586007)(8676002)(4326008)(921005)(70206006)(316002)(36860700001)(8936002)(336012)(16526019)(1076003)(86362001)(47076005)(508600001)(83380400001)(2906002)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2022 07:29:10.8016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24ed3e19-90cc-4d80-71df-08da2f321d12 X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.200]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR10MB1843 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Gireesh Hiremath add linux,keymap to mt matrix keypad Signed-off-by: Gireesh Hiremath --- Changes since v1: - updated node names arch/arm/boot/dts/am335x-guardian.dts | 44 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/am335x-guardian.dts b/arch/arm/boot/dts/am335x-guardian.dts index 94d9e51cd0f9..a172d0e2842f 100644 --- a/arch/arm/boot/dts/am335x-guardian.dts +++ b/arch/arm/boot/dts/am335x-guardian.dts @@ -120,20 +120,48 @@ regulator-max-microvolt = <3300000>; }; - mt_keypad: mt_keypad@0 { - compatible = "gpio-mt-keypad"; + keypad { + compatible = "gpio-mt-matrix-keypad"; debounce-delay-ms = <10>; col-scan-delay-us = <2>; - keypad,num-lines = <5>; + number-of-buttons = <7>; linux,no-autorepeat; gpio-activelow; line-gpios = < - &gpio1 24 GPIO_ACTIVE_LOW /*gpio_56*/ - &gpio1 23 GPIO_ACTIVE_LOW /*gpio_55*/ - &gpio1 22 GPIO_ACTIVE_LOW /*gpio_54*/ - &gpio1 20 GPIO_ACTIVE_LOW /*gpio_52*/ - &gpio1 16 GPIO_ACTIVE_LOW /*gpio_48*/ + &gpio1 24 1 /*gpio_56*/ + &gpio1 23 1 /*gpio_55*/ + &gpio1 22 1 /*gpio_54*/ + &gpio1 20 1 /*gpio_52*/ + &gpio1 16 1 /*gpio_48*/ >; + linux,keymap = < + 0x00000000 /* row 0, col 0, KEY_RESERVED */ + 0x0001000a /* row 0, col 1, KEY_9 */ + 0x00020003 /* row 0, col 2, KEY_2 */ + 0x00030000 /* row 0, col 3, KEY_RESERVED */ + 0x00040002 /* row 0, col 4, KEY_1 */ + 0x0100000a /* row 1, col 0, KEY_9 */ + 0x01010000 /* row 1, col 1, KEY_RESERVED */ + 0x01020007 /* row 1, col 2, KEY_6 */ + 0x01030000 /* row 1, col 3, KEY_RESERVED */ + 0x01040000 /* row 1, col 4, KEY_RESERVED */ + 0x02000003 /* row 2, col 0, KEY_2 */ + 0x02010007 /* row 2, col 1, KEY_6 */ + 0x02020000 /* row 2, col 2, KEY_RESERVED */ + 0x02030005 /* row 2, col 3, KEY_4 */ + 0x02040008 /* row 2, col 4, KEY_7 */ + 0x03000000 /* row 3, col 0, KEY_RESERVED */ + 0x03010000 /* row 3, col 1, KEY_RESERVED */ + 0x03020005 /* row 3, col 2, KEY_4 */ + 0x03030000 /* row 3, col 3, KEY_RESERVED */ + 0x03040009 /* row 3, col 4, KEY_8 */ + 0x04000002 /* row 4, col 0, KEY_1 */ + 0x04010000 /* row 4, col 1, KEY_RESERVED */ + 0x04020008 /* row 4, col 2, KEY_7 */ + 0x04030009 /* row 4, col 3, KEY_8 */ + 0x04040000 /* row 4, col 4, KEY_RESERVED */ + >; + }; }; From patchwork Fri May 6 07:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gireesh.Hiremath@in.bosch.com X-Patchwork-Id: 571975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2558C433F5 for ; Fri, 6 May 2022 07:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389574AbiEFHdM (ORCPT ); Fri, 6 May 2022 03:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389548AbiEFHdC (ORCPT ); Fri, 6 May 2022 03:33:02 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7ECF66FA0; Fri, 6 May 2022 00:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dMP0NWJWgS3stdeGj4v9ZvusMUfohC0nqhc8Jf8faBetKQc7sZuDNLJgiDrur4Nc7mqklFOS6TEKMMCqBJLm8jToAomPf346gb4x8gLob2t4mZo/sdKRZLDxssjDjzy6BHgFeR46xfjqqwgdWaINLgClNykZ3vzpogp5Xr9zWuCprSuDuD/LMARwViaAvFUXZU7TYwsc7w95llteIyKor0czKKKfA8zmsWPSRcbE9jXcYiN7V9425tlChcG4jKEoi0LzU0krblsIhqnguJYRP+Kyplj6ZXDccyKYWoLz5AE18NKeFs893Zu+/Z8teLTYpqpbovQcV46vO78vF5vcqA== 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=iDfLiqMaFnxYhVi9yn91Ko6mT0Lpt3PlAC2y+iD44jk=; b=FLN4VpatEuZlE2BSCDgl3QDhyJTkt3fVt1KY0nAk2qJtEkpnZVzrrvv/hTFH62Nb/WuDqcMys3nOvUP74CiLJYk5RMW79APrdb3XQLzrD6k0CC9Hqd4ERbPbwn4Mg01WtmcJ4EaJSxfkdEEn/79B75fRVF4/+ChqcFsENwFY4MjdpeIiwntBvMJjc9KUFlHcZ+Vf1W/13jFX9lUoQbJhGaRdLf1VfSIcn1wXga4iHXiplMrWWSU0SY8OacnbuX+35VZUGp05/0XEHR+/Q0zUj6LxuE3zYve+LstOpOzHh7MukuBId6doOr3EPYP6j5OrqJg4G0oWY4kaabn78Rym8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.203) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iDfLiqMaFnxYhVi9yn91Ko6mT0Lpt3PlAC2y+iD44jk=; b=UHonRfDvdNGKCikn4DgJrqm/4YXavC2zMZfZmO3gROVDCimX8gKolFdqvKiXLeMIDJJAhkE9qQ8k5sMYrPmi1vcYUEMV+RZupDbjSuRN1nP+Jj5JASVFQHL9uKYqhFENw9WGhC9m/K3goUIxR91JGfOA252dKo81x/Ub6yRe9wg= Received: from AM6P193CA0089.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::30) by DB8PR10MB3308.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:113::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.18; Fri, 6 May 2022 07:29:15 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::34) by AM6P193CA0089.outlook.office365.com (2603:10a6:209:88::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20 via Frontend Transport; Fri, 6 May 2022 07:29:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.203) smtp.mailfrom=in.bosch.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.203 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.203; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.203) by AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Fri, 6 May 2022 07:29:15 +0000 Received: from SI-EXCAS2001.de.bosch.com (10.139.217.202) by eop.bosch-org.com (139.15.153.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:14 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by SI-EXCAS2001.de.bosch.com (10.139.217.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.24; Fri, 6 May 2022 09:29:14 +0200 Received: from localhost.localdomain (10.167.1.123) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2375.24; Fri, 6 May 2022 09:29:10 +0200 From: To: , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH v2 4/4] dt-bindings: input: mt-matrix-keypad: add guardian mt matrix keypad bindings definition Date: Fri, 6 May 2022 07:27:37 +0000 Message-ID: <20220506072737.1590-4-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> References: <20220506072737.1590-1-Gireesh.Hiremath@in.bosch.com> MIME-Version: 1.0 X-Originating-IP: [10.167.1.123] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3ba7966-136e-43b5-3943-08da2f321faa X-MS-TrafficTypeDiagnostic: DB8PR10MB3308:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lCR4IZ/Rf+6YXhD5G2oyG97fFwxPV92piXNF4kepTP6LOpE3IEEYGH1J6z1JPcccm/gB4dfBjjEqCKMh4NfE6QhyJYbmkZ9dIPL6IJM8Iy0/4kSRZlVC6hzrdBztMwSrbV7jMnbDodP/F6kKAsxQFXgwxJ4RfDcbjyjrzO7MMUEpwLYmJOPnDzgeXAEwOxjM5MfFZ2eks/0vdXUtf/UcbCqmF1ZceDXdnK3ul5VEZCbffVT0bo1P3eaFvyqOPqSTbtk8YdhCxukHaQ9EJWUeNQr2uOAwPpsDTLTQW5/nljSK/e2ZQ7NV/YFqebO59DAVObaqyyWTckKLvFzGiXguRDb2mnep4shhkn4dvof3g//4S5lwIidf4gGFNVjMysj2uBKC8hPL/y7BW+nW6d3OiIdQjWmvFr1ipoxlTzCSijKKa5UKFeOGJWVs90TAYJqizuBa2JEchaPpkWMbb0fQrZ2W70A0GyZUcR6/OllVI24V5GBHsoB84DVylNMDFOBom7fBLKrg3q73D+lB0BZuHhCg9zcoe/yG3MYr3ZUE4EFb8w1uoiXmYBrXwGpyv/0uHpbRzL3YICdB85Q4BbkkLcBLIve90Zc9zaG00Q64/o/h2VTRHhvJv9dFQYFKG+leHFguyVW6Fr9mO60LmakGwn+M8CSAy6lLuSTg7ovHRRS+4UXoARTVZAZScdwjybV1woj5Iv9Qag5DKqNDi6Ti/b903QHHJBybXtZZXOgms1jxdtqMBA7QzoKsgYS/U9HOrw5E6atfJDs4OQmyBKx24dq5h/3kYTQ4YnYLHina3pf1PnWMLzardJoVnFQujxss X-Forefront-Antispam-Report: CIP:139.15.153.203; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(336012)(5660300002)(54906003)(107886003)(110136005)(1076003)(82310400005)(7416002)(2616005)(508600001)(26005)(40460700003)(966005)(70586007)(8676002)(4326008)(316002)(70206006)(47076005)(186003)(82960400001)(16526019)(36860700001)(81166007)(83380400001)(8936002)(356005)(921005)(7049001)(6666004)(86362001)(2906002)(2876002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2022 07:29:15.1528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3ba7966-136e-43b5-3943-08da2f321faa X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.203]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3308 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Gireesh Hiremath Add binding definition for the support of the Guardian mt matrix keypad driver. Signed-off-by: Gireesh Hiremath --- Hi Krzysztof Changes since v1: addressed review comments >> Add binding definition for the support of the Guardian >> mt matrix keypad driver. >> >> Signed-off-by: Gireesh Hiremath >> --- >> .../bindings/input/mt-matrix-keypad.yaml | 134 ++++++++++++++++++ >> 1 file changed, 134 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml >> >> diff --git a/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml b/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml >> new file mode 100644 >> index 000000000000..b52cd478f638 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml >> @@ -0,0 +1,134 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/input/mt-matrix-keypad.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: GPIO driven mt matrix keypad device tree bindings >> + >> +maintainers: >> + - vinay >> + >> +description: | >> + GPIO driven mt matrix keypad is used to interface a SoC with a mt matrix >> + keypad. The mt matrix keypad supports multiple gpio line, all gpio line act > >s/line/lines/ modified >> + as row as wel as column lines, a key can be placed at each intersection > >s/wel/well/ modified >> + of a unique row number not equal to a unique column and they are diagonally >> + symmetric. >> + > >What is "mt" in the "mt matrix"? > mt is bosch measuring tools matrix keypad >> + Example- For 5 gpio lines, possible matrix is 5x5 and maximum possible >> + keys are 10. >> + >> + Sample matrix table for 7 button and 5 gpio line >> + >> + ------------------------------------------------------ >> + |Row\Col |GPIO 0 | GPIO 1 | GPIO 2 | GPIO 3 | GPIO 4 | >> + ------------------------------------------------------ >> + | GPIO 0 | X | KEY_9 | KEY_2 | X | KEY_1 | >> + ------------------------------------------------------ >> + | GPIO 1 | KEY_9 | X | KEY_6 | X | X | >> + ------------------------------------------------------ >> + | GPIO 2 | KEY_2 | KEY_6 | X | KEY_4 | KEY_7 | >> + ------------------------------------------------------ >> + | GPIO 3 | X | X | KEY_4 | X | KEY_8 | >> + ------------------------------------------------------ >> + | GPIO 4 | KEY_1 | X | KEY_7 | KEY_8 | X | >> + ------------------------------------------------------ >> + X - invalid key >> + KEY_x - preferred key code >> + >> + The mt matrix keypad can sense a key-press and key-release by means of GPIO >> + lines and report the event using GPIO interrupts to the cpu. >> + >> +properties: >> + compatible: >> + oneOf: >> + - const: gpio-mt-matrix-keypad >> + - items: >> + - enum: >> + - gpio-mt-matrix-keypad >> + - const: gpio-mt-matrix-keypad > >Aren't all these compatibles the same? modified >> + >> + debounce-delay-ms: >> + description: Delay after the first bounce of button. >> + default: 0 >> + >> + col-scan-delay-us: >> + description: Delay before scanning next active line. >> + default: 0 >> + >> + number-of-button: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: Number of button connected to the keypad controller. > >s/button/buttons/ I presume. modified >> + >> + linux,no-autorepeat: >> + description: | >> + Disable the Linux input system's autorepeat feature on the input device. >> + >> + gpio-activelow: >> + description: Gpio line are active low. > >No, GPIOs should instead use common flags. this flag is used to compare with the gpio read value >> + >> + line-gpios: >> + description: | >> + Gpio lines connected to keypad controller. >> + all gpio line act as row as wel as column lines. >> + >> + linux,keymap: >> + $ref: '/schemas/types.yaml#/definitions/uint32-array' >> + description: | >> + An array of packed 1-cell entries containing the equivalent of row, >> + column and linux key-code. The 32-bit big endian cell is packed as: >> + row << 24 | column << 16 | key-code > >But anyway this should be just merged into matrix-keypad. It's a simpler >set of that binding. we have special keypad for Bosch measuring tools, which is not completely matric keypad so we have derived from matrix_kepad.c to make our keypad to work. >> + >> +required: >> + - compatible >> + - number-of-button >> + - line-gpios >> + - linux,keymap >> + >> +additionalProperties: true > >This cannot be true. > updated > >> + >> +examples: >> + - | >> + mt_matrix_keypad { > >No underscores in node names. Generic node name, so just "keypad". modified >Best regards, >Krzysztof Best regards, Gireesh Hiremath .../bindings/input/mt-matrix-keypad.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml diff --git a/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml b/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml new file mode 100644 index 000000000000..d88a2e712667 --- /dev/null +++ b/Documentation/devicetree/bindings/input/mt-matrix-keypad.yaml @@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/mt-matrix-keypad.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIO driven mt matrix keypad device tree bindings + +maintainers: + - vinay + +description: | + GPIO driven mt matrix keypad is used to interface a SoC with a mt matrix + keypad. The mt matrix keypad supports multiple gpio lines, all gpio lines + act as row as well as column lines, a key can be placed at each intersection + of a unique row number not equal to a unique column and they are diagonally + symmetric. + + Example- For 5 gpio lines, possible matrix is 5x5 and maximum possible + keys are 10. + + Sample matrix table for 7 buttons and 5 gpio lines + + ------------------------------------------------------ + |Row\Col |GPIO 0 | GPIO 1 | GPIO 2 | GPIO 3 | GPIO 4 | + ------------------------------------------------------ + | GPIO 0 | X | KEY_9 | KEY_2 | X | KEY_1 | + ------------------------------------------------------ + | GPIO 1 | KEY_9 | X | KEY_6 | X | X | + ------------------------------------------------------ + | GPIO 2 | KEY_2 | KEY_6 | X | KEY_4 | KEY_7 | + ------------------------------------------------------ + | GPIO 3 | X | X | KEY_4 | X | KEY_8 | + ------------------------------------------------------ + | GPIO 4 | KEY_1 | X | KEY_7 | KEY_8 | X | + ------------------------------------------------------ + X - invalid key + KEY_x - preferred key code + + The mt matrix keypad can sense a key-press and key-release by means of GPIO + lines and report the event using GPIO interrupts to the cpu. + +properties: + compatible: + const: gpio-mt-matrix-keypad + + debounce-delay-ms: + description: Delay after the first bounce of button. + default: 0 + + col-scan-delay-us: + description: Delay before scanning next active line. + default: 0 + + number-of-buttons: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Number of buttons connected to the keypad controller. + + linux,no-autorepeat: + description: | + Disable the Linux input system's autorepeat feature on the input device. + + gpio-activelow: + description: Gpio lines are active low. + + line-gpios: + description: | + Gpio lines connected to keypad controller. + all gpio lines act as row as well as column lines. + + linux,keymap: + $ref: '/schemas/types.yaml#/definitions/uint32-array' + description: | + An array of packed 1-cell entries containing the equivalent of row, + column and linux key-code. The 32-bit big endian cell is packed as: + row << 24 | column << 16 | key-code + +required: + - compatible + - number-of-buttons + - line-gpios + - linux,keymap + +additionalProperties: false + +examples: + - | + keypad { + compatible = "gpio-mt-matrix-keypad"; + debounce-delay-ms = <10>; + col-scan-delay-us = <2>; + number-of-buttons = <7>; + linux,no-autorepeat; + gpio-activelow; + line-gpios = < + &gpio1 24 1 /*gpio_56*/ + &gpio1 23 1 /*gpio_55*/ + &gpio1 22 1 /*gpio_54*/ + &gpio1 20 1 /*gpio_52*/ + &gpio1 16 1 /*gpio_48*/ + >; + linux,keymap = < + 0x00000000 /* row 0, col 0, KEY_RESERVED/invalid key */ + 0x0001000a /* row 0, col 1, KEY_9 */ + 0x00020003 /* row 0, col 2, KEY_2 */ + 0x00030000 /* row 0, col 3, KEY_RESERVED/invalid key */ + 0x00040002 /* row 0, col 4, KEY_1 */ + 0x0100000a /* row 1, col 0, KEY_9 */ + 0x01010000 /* row 1, col 1, KEY_RESERVED/invalid key */ + 0x01020007 /* row 1, col 2, KEY_6 */ + 0x01030000 /* row 1, col 3, KEY_RESERVED/invalid key */ + 0x01040000 /* row 1, col 4, KEY_RESERVED/invalid key */ + 0x02000003 /* row 2, col 0, KEY_2 */ + 0x02010007 /* row 2, col 1, KEY_6 */ + 0x02020000 /* row 2, col 2, KEY_RESERVED/invalid key */ + 0x02030005 /* row 2, col 3, KEY_4 */ + 0x02040008 /* row 2, col 4, KEY_7 */ + 0x03000000 /* row 3, col 0, KEY_RESERVED/invalid key */ + 0x03010000 /* row 3, col 1, KEY_RESERVED/invalid key */ + 0x03020005 /* row 3, col 2, KEY_4 */ + 0x03030000 /* row 3, col 3, KEY_RESERVED/invalid key */ + 0x03040009 /* row 3, col 4, KEY_8 */ + 0x04000002 /* row 4, col 0, KEY_1 */ + 0x04010000 /* row 4, col 1, KEY_RESERVED/invalid key */ + 0x04020008 /* row 4, col 2, KEY_7 */ + 0x04030009 /* row 4, col 3, KEY_8 */ + 0x04040000 /* row 4, col 4, KEY_RESERVED/invalid key */ + >; + };