From patchwork Sun Jan 29 07:08:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13120030 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 8B003C61D97 for ; Sun, 29 Jan 2023 07:07:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbjA2HHV (ORCPT ); Sun, 29 Jan 2023 02:07:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjA2HHU (ORCPT ); Sun, 29 Jan 2023 02:07:20 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2054.outbound.protection.outlook.com [40.107.6.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADCA2227B4; Sat, 28 Jan 2023 23:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dANkvxWk5bv7CMERURXArm1K6TTBoc11v23xojrZzzDse7aduypNwYksZN+/AkW/eYsVGLhpty2EnLexWYPzXlkSP+wG/tx8H4jfgIpf+fVy3DwoppihRq7vrOGeFAkyZjJMKryzPJkC79iG4rksutmEy2JqJugoTD1KoRnjMc+/Ytm4rFj3TOjaojBRqZg85ew8xd6INa2CZ8sWTSjA8gNausyWHKQ2XZfp9LOsvgbTQOa1khK+SnJWHohrJ9PbP4Xiolgq2mBRo0zcXEJXm/fmjM5Ga24aSuRVkBWynMkfXA1AYZdnGym2GBMUSpYAm0d75xbFhS6/9kwWTwhn9Q== 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=fdno9/3nzzp92mz2talKnfGcF1jnRVNF6jgaSs1Sc7Q=; b=OmgDbx2vjuE0i+TTW7PJvHf9i6vxDzXfW7H5luY/6v7axztfM0ge69D6D4ZBPMuUKlOm7lKi9LppRNUQBOdcQm/0Ck63lqNDR9zjZghiqn10TKR+2qegR1Vo4jKg2IICE/AMmKz7m0Lv7kChdtLsw4Mkq7aXgd6iq8hJUIE/tbgyUMdpnc67pliDbJelJvL31SBUtlFQrx0nX4ytDH34zebtW0HJYDjS7XwA7IkbAd0aVyZMNgIDrWXXYCG3SdBuQhR4e/VD0YP9ivHdBxsNuTct3jtau5CsM/5BG7TKLPig+2F2r1C5CdZ1XkriF/KCUkB9PADiB/blC478FIkqew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fdno9/3nzzp92mz2talKnfGcF1jnRVNF6jgaSs1Sc7Q=; b=YBVYJ1kz0I2hVZ/FDsQgYNxALhj6cYSWaxfT/0dswD8Ld8DmMRT+KLTVXryt5bpNKC2EXX9SrSRujCBz8xlo3nOnXJwrLDGBOnlMslVGRa4pNDKHQro3oTDogbVqQMTjoZh5MnVRXzwVhKXQNk2mFFyJaPg+n/G3kO9eXoeKNkQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by PAXPR04MB8815.eurprd04.prod.outlook.com (2603:10a6:102:20e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Sun, 29 Jan 2023 07:07:16 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c%3]) with mapi id 15.20.6043.033; Sun, 29 Jan 2023 07:07:16 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v4 1/4] dt-bindings: mfd: Add nxp bbnsm Date: Sun, 29 Jan 2023 15:08:20 +0800 Message-Id: <20230129070823.1945489-2-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com> References: <20230129070823.1945489-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0170.apcprd01.prod.exchangelabs.com (2603:1096:4:28::26) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|PAXPR04MB8815:EE_ X-MS-Office365-Filtering-Correlation-Id: cd884d7a-8461-42ae-8db8-08db01c77451 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /vPYKgvnENs1CutuEMNQdp0rwhG8ByhxQVrXEtVeWVcXMd0HOE8p/X2GKOh5A6N3CugzI9kWeyhQUqxAb+tGKLwH9UttNVnv4EopLWNjKBr6eG2R9elrwBWODFwoCeenNx/A4gaDI0E/VKm1mDWrLWGr7bGrhw2QUYrLAeUdfQ+vkwD5Ft0bo9/dQi/Y2IDOwHJrrBRzhnjyNtaMJqN9zzgnK/xl7X7Aka6SfSuOeG7og7ckvS9tGQvk8Tud9Poxi8yJvbHweGvc7DMoGCiYsot7IVTJGqFFBWJ+5vbCLy9bnwolG0zBj9MsVwwb16bb0za+p5Drll+EQB7f4PtsdCDFVfE9zMKZuemHwwUIJ5aDxUvNrLmpT5mquieZ90kHJPR9pU7jjziZm6sE7spVEXf2vkuRb5S0FbQSWnVE8SRJgC/qWWrr/pLLh96/Oz5yEZoC84VPjNM9mTzc7NBLFneZ9DJ4JamCjYXTORrh1aTMGjsD4h9g5DqDUN3ezMOJKQ3GA3dZJl5a9oeaFw8YQygizE8JrTCRjUQto7FG1klQmDERFCyuIiupwFiO24IHEccx8Keb7pIUlP9+BC3D2CH5xrVKm3HrE+5MP2OKOM7Pt6OkO3bil0RxDekufRqXHhqaJ7Bwrk7UVAdo4iPbv4iBccOc96ElFODkwYnQf5Ud2tzV8/NEfLy0ORRuX9AJ075H6/eDgNbsa95aHY9J46EtmldtPPel0QkWmIuobqV++QczF5l4WmezsD2ZKGxJwXX1uctCP6bDZIwfF+Ylpw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(451199018)(2906002)(36756003)(52116002)(6666004)(7416002)(478600001)(6486002)(966005)(38350700002)(86362001)(38100700002)(41300700001)(2616005)(1076003)(6506007)(66476007)(8676002)(66556008)(4326008)(66946007)(316002)(8936002)(5660300002)(26005)(186003)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QKKaIj042KmPVP2oLdgB836TYh4pjWdn69TmyciXQvz3fQEGgk2/oKiRSRUZIcD9EwbwdlAIbx0MZeQWpRhPXbhQ98aVAFjxE22cKHy9GG+3RczoSVHUEvrE4sUL/k5AfhtQM8qzZ6x+RopBe01jrYOZLa/KlvzfjUcmFtpiKg4j0ZwUIspXWfZ0YGmKCuyTo5LuEMPrfSDql3uv3g2Ly2dwKb+9qcQoT7XLNQs8UCi29TOVEP5/+u87aPR/Y1d0d2ptHUmbyr1HogSCLM3pmBPvbOrnFKa5Ki7P4TGQlor9Vo2eE80G6DVN6vWThBtcgXmvGMUd/RaPyDPbJlHqyBpOT5+/Mw2i1oIi55GLO8bdnKs8qbIvcP0bixhjRGRwnIJIjrg37HuUoRKsVLYI9Wzi8dlf4yvVvmXIyErH4w/4Z8GXRKjBMjlZVSdJVfBG/N4bN5IOtbL0Olr36j/z7C0NisJG0hFyDwHB+B7KRSidU/QDT8vKw0Ss76U79JHTSVDeRIrDna/VY9rSUleUhPDhLPQVjlhDsZnmguGk2tDQyq10J5PyHMic/nmbpDq4qLE6vS961Ppp3aw/SQ1SIJGKCk5jG5Vb/3wLhrW7Tnn8t6zDNavryChiEanJHoOlAB+AuCRfEPnLomiBQmNNtPRmlWWu5YDPwShDt6PtBh5AkVTNap1W2f6GzYwv9oFZ8epDzKDihv8JAL2n3U6a2c+D0GL2OOaQL+kGyhwXyipDjc6AvoFXoShzozw7bPa0bECEjTr56RFqes6ds5GcTWTaGGRORRqcuEArp9l2TOK1If4RIlGyfuQx0wSy6T9BZMoBAUQ2EgyOnE//ikxTox8CeOUHY2zHV3U2YBmXveqXIBhIDZWHkZgUPgfY+YOUS5gCGSDtPWYk8ZCPWEHYdspoPLRWrINh4OFU65tYD/N7QrUQdjTf28cv8uqeUifL7oaBb1TefRGSJv1HyFJ//kwTI/LqnLIdS+6zoxPSl6q3hX5p69ifGFsK84fV4GVqMgYunnmlVqGr4SlyFu5SX6QTcNKV7NCRkNf+2irXr8TjAwqb93e69r91hJR5cMzO/Rzps9juNyFFVs0liMseSZkaNuiKAv+IDWt3N0VAjLOaO7ERkdnm+QdeCm2ndTOq0BEO2rtszTmGPD1ySYONBRA0OLnn++spcjwLouKX2A8KZY4YgnGjfEziI5bUeUI5VyNtaKOGB40btt2J6vCQx7rK/jebNKwqgmqvqp5IvZ5QxlcZZErYWY20nXZykdVjleMlJkZ6FbYNu1fqMH+c7Ipv3OXy1XUPpNkA7XFHDRe5AGJgO6eaAt7oU9C9DuXNo/9eXM6IOB9ZwMHxtnsnhe+Gk/UHmI5aiTTIIB6T+lf+nU2ITVYnWYMCnoEKrU7dBvBCWsk7cBGshy4Vo39bRoUVzXT/1WyCtjYAOUW5E8hvz6N3c4cJFIJTKvH2kbp89lqo7nsxKgELqMyp+qo622Rea+q362R70Wz/WxozXilR6Q7/VPPwJVZS/0h5VNmcgNobDBHDwljsSrO56Y6qKnc43W0Un3PX3D2VsnMFLEJin7roxk6PAMlEwlNPUlBt X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd884d7a-8461-42ae-8db8-08db01c77451 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2023 07:07:16.6866 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gzNfXVmL1JlfS+l4paDaFV9VDCMSEnd84rSU8SAiMT3swFkqVjRRWfBlTqLAwY1ECoPf26OgTuMSCuv3nLoV+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8815 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add binding for NXP BBNSM(Battery-Backed Non-Secure Module). Signed-off-by: Jacky Bai Reviewed-by: Rob Herring --- - v2 changes: - remove the redundant 'bindings' string - add ref to rtc.yaml - add start-year property - rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define - add header files including in the example and correct the indentation -v3 changes: - remove the 'nxp,bbnsm-regmap' property, get the regmap directly from the parent node in rtc/pwrkey driver - v4 changes: - update the compatible string to include the soc id as Rob suggested --- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file mode 100644 index 000000000000..b1ade64a1554 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml @@ -0,0 +1,101 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Battery-Backed Non-Secure Module + +maintainers: + - Jacky Bai + +description: | + NXP BBNSM serves as non-volatile logic and storage for the system. + it Intergrates RTC & ON/OFF control. + The RTC can retain its state and continues counting even when the + main chip is power down. A time alarm is generated once the most + significant 32 bits of the real-time counter match the value in the + Time Alarm register. + The ON/OFF logic inside the BBNSM allows for connecting directly to + a PMIC or other voltage regulator device. both smart PMIC mode and + Dumb PMIC mode supported. + +properties: + compatible: + items: + - enum: + - nxp,imx93-bbnsm + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + + properties: + compatible: + enum: + - nxp,imx93-bbnsm-rtc + + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - interrupts + + additionalProperties: false + + pwrkey: + type: object + $ref: /schemas/input/input.yaml# + + properties: + compatible: + enum: + - nxp,imx93-bbnsm-pwrkey + + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + #include + #include + + bbnsm: bbnsm@44440000 { + compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,imx93-bbnsm-rtc"; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,imx93-bbnsm-pwrkey"; + interrupts = ; + linux,code = ; + }; + }; From patchwork Sun Jan 29 07:08:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13120031 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 BDAE3C61D97 for ; Sun, 29 Jan 2023 07:07:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbjA2HHb (ORCPT ); Sun, 29 Jan 2023 02:07:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbjA2HH0 (ORCPT ); Sun, 29 Jan 2023 02:07:26 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8190422A03; Sat, 28 Jan 2023 23:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P13v+8yt9M1LwAZmfPGHoizPM4/We663qw6SWu6Qn//pYKbYVkCybHArZJqoeS6MVgjoVoIrwpG3Bmd9Oh8JwoInjzNy3XzS3mX65II2RZ9sYLYt2Y1A4t10nrQTuSIerV2MDoSspTaNTZQ3CwCAACojrCZjpE5hgA2KGaoODXvmhLTMPXwRaguGP/acvgX7zMEkf3IRkOXygZ6wOa7ucib4aK2hs1l8Jv1XaJLa6l/+St3K/Sc9qXLBm9CtKRZB2jMxE/P25f21XId4nPdDEHf+61N8/2bwB9MnQaOGKdlserK/GI8ojgh28oSNVPaSy+A6BtGL6s+lZokOWuaQ2g== 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=LNQEKSD0SwfvFR4Ud8oMe8N5uEOdIUC9x5hYLNrBhUU=; b=nz6JVfPxjAM8kKNRMEyjx6Edh/TYsKb61CKqiTSKNqqdhjwHj84w8KR7xuYCpwOzl8vPWVfuaLcDt4XWCKzgpq2rHcBPSt3+I4p4MOYulTEqMlBzineCxvmGuBnKHzsD6WIkmgQaDap0h6WZhfYIkLQ6N45KqB/chf17pcFifrND46XVg7eM9rI7MvzsoClxnL0MMAoT9rVfVuswQW7BbSqCcCZWMH3Id/Tn5mCe5kwgDvXE7q5V5gJCtr99NDrn8FRplAxLbINMTfB+W3cmMe23qzh1VaklWRFIw6cTTtIebZx8TQbaXY5LZsiJxNVKxW0d9P6JbwRZpvrfRCY6ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LNQEKSD0SwfvFR4Ud8oMe8N5uEOdIUC9x5hYLNrBhUU=; b=BosaOF6FGHAhFAeBWGBC9y7YWtWIY2rSRDJQ0UIpOsu6uW96mhXgAAf+HMQ3W4fWGyKGNmAVazpp0Vx+4gnXYoXI5Iix4U040syGLUpO41ynLltgmuVT2OYO0zY/XthwGkqJ61TYLOV3WOXX7mq+lRbaggtuNr38hzgzgxVodO4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by PAXPR04MB8815.eurprd04.prod.outlook.com (2603:10a6:102:20e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Sun, 29 Jan 2023 07:07:22 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c%3]) with mapi id 15.20.6043.033; Sun, 29 Jan 2023 07:07:22 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v4 2/4] input: bbnsm_pwrkey: Add bbnsm power key support Date: Sun, 29 Jan 2023 15:08:21 +0800 Message-Id: <20230129070823.1945489-3-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com> References: <20230129070823.1945489-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0170.apcprd01.prod.exchangelabs.com (2603:1096:4:28::26) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|PAXPR04MB8815:EE_ X-MS-Office365-Filtering-Correlation-Id: 41d01fba-adb8-43cc-1809-08db01c7778d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tTDx2U4Yn9cyj8JLh3/hNOM6ocxhimp9toxB1UknUaMV4V2My89fTgi2ehn16jTa4sDCD0NhiRSmiBmvA1UiCWF+KDnTc3jnLMmoF+Kua0KjKHf/cwjM4Sz4ZUz6rIkeDW4RlfFBIvVVLaf4jAwhIUaqH7+WeQIa/zD6iYI2kinXD1gdsIoa5pmM+g90v0/6SHv9Bx5e8QHjdTH8jei71m9r1bj3mrEEM6nGp3TUKZ+Xbw30qOJ+KfhAXdngbc6Fx2O9yUxcP38eQx1Gt6d5GyZD0J4xoPT9FWRANuYeKsKtD2632sxxodGKc49NMLz2m5Pb1T0K7ZrkuufI8PbYGJ+EmIxlqHr9yD1HKUTcGEdOnLo4UvbbGc2nvNddQ6GsvuOJgbrNvo3KRNHdVusuNoEX8kAqTt94kw18iG54IZHa2HZYfDi85TR8AZc9a6WcUMd8+5r98pP+YhN3GEHg89ezaR9NTx3y6dhL/HmtwF0yQYq4x4ZH9LCn4nzOhkpT7BuhvIK5OFSmxEoWdD/WFow+DzSsSTcOk7pPJt8StHu3nXcC9mIPauXNpYQ7BbwAf15AdYJT5e27fjDHn3R4XcPm8W57pBuFdHOOFzfZD23EY1S3hbhtycxtWN6JLIvdLff1QJ6j4og2ZOhK83BE5YJFnTg/yyI4TQzmnizXweJ670USAp65/a9P3yoWpUdy05HCEeFKNGm+J0TnShpDVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(451199018)(2906002)(36756003)(52116002)(7416002)(478600001)(6486002)(38350700002)(86362001)(38100700002)(41300700001)(2616005)(1076003)(6506007)(66476007)(8676002)(66556008)(4326008)(66946007)(316002)(8936002)(5660300002)(26005)(186003)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rZV6u3/UAcHwTDnDwf8keKYgS4tZOOlD4BFy9Ibe3aKcfwKmSqk+VPeZziC7YIno0k9HkD6ZuDyvxgWBiXefkdJhMgOqNFPLesH/IZ8YJhFZDIAL+5hBg3EF13EHTkaTEsP1OOwVLFEoNn6monP+nkhh7JLI+p6Fx184UG++T3Ld4E7+BCKwtjHQRoaVrV741p+QWWWeEsw9KQgpbbAXuUG6iuXStUtfoRMR1RvA6zXiJuF/6B32zraFTGc/kuP87+P4V3SOa5yFL+Ubi+OmCSR4FSubVcLOZnlT9ZHZ7WRFuf/LYCpUGT8ViBh8yoWH3A2v7s3vfobQoq0yrrONgpfYrhjy3tZgMv5W3CS53TuhOnJjJsWNiJOkQSPpN5q0PwfwZaDhbXBV5EK49RCTPv30jkfYLud5/2/Jsk+mUL8D/9utvO6qHKllDaA8bVx/fvyGuO4POnPIZH6Cid7Rpw/V+m8yQnyO7ZNCn1uFiT9VjxohVqdr4lePAJ8aC4enrjSZluhtdrrNdlbIzZe9tIiSMDYfxIYGNLMym8d8/DB/+dHzoyegU4zGOc3asACxhrbrEkGHV2syjpJfaaDDIE9IkE4/hkT+YKKO11pj3ZWnscmY2WO7Eb83e2/sr8DWzokcSiy/Lq4/hAehKnaibPkVAbfBVnJDQnGnkGN1GHC2Fim00VAWCw/9kSDbA1iQCVWvs6k+jg2EHqeMlXLMwDHpwJL7452ESAoJ26un2dcFtZuXcF+qbvXgpAe2w0Nfo7DhvVqlzqX2w6hAPSUQQmPEyhYeBp0TYIjdTB4m3XfyJUcUf4hdduLzkpBtwEO1ma40dmgRrtaDSozj6JparRrVPWL/gBOkAaDs+UyLbqVkwhdn6Ysx/+Bmj4T0LVu/G/CB6Y5+mHQHttXrypyMoNN4WuC3ASRhFwKyE+60mMGnhYCWcB1qYgEsSWADo7yjg0p5k5lR1v4VYzkPMWZ71PWRWbvkCxXTvFjKYaia2xVWYtzbKJIGu4FdrTNYnwAExde8ol97B4+KdjOKSj/cEcnaFR51WI7zrzracyMhpI/jXnDV98TtLABXOWc9nGkckn82ZXY5NqQwl7KWfKJW8pZePxrauu/skDyX7WFLQErqt3B4zpnA/R4S5nINvIRPTyoottA7U4MRuuXSI9iN7Xt6KKi+MLqKYqpqH066SdWS1IO1uuTHwaSG1f83+cF9eb5W9uOI2QluW/b0C+tLheE7NSEyos/Eri1kQpzP1RzkwGyVSA86UdUznta4VjZP5MnxzJ6y1ibHMJ7T8yYQOyXGHVkQrVMUI36cPlla/iIuEjdymqtaI3Ihnmhgwq7vFjvkgNPaEWvO+xEUc3tf63m6dH5H30LJSo8E7oDdLYqOWExk/NeOunIonO00ZY6FWbOcZpveAT0W6R6nan6WTLYvoC65hQiykY8CDUI1DCCQTk4uGBkgK3Sc27XbkwGXSoR2qHqvungSzGs2SMBZTJI7srWq8aS4ps+IvEOUULyRanM0tKHTGYCazR1jieJ7qEZd2IsWO7U83pxz0FPWs+TYssMyXxGzsRn4rB7ApLjPjBECGqR1vUfhdXSbPlQP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41d01fba-adb8-43cc-1809-08db01c7778d X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2023 07:07:22.0944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ADEnG6cmfW7/1CMZ3PvWQyIbkbEwGxO7MuGFue3VQeXEHZ9mfNtZGK9EDKGqL83d2Oo6g6KNkdNIbrT1Jz8awQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8815 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The ON/OFF logic inside the BBNSM allows for connecting directly into a PMIC or other voltage regulator device. The module has an button input signal and a wakeup request input signal. It also has two interrupts (set_pwr_off_irq and set_pwr_on_irq) and an active-low PMIC enable (pmic_en_b) output. Add the power key support for the ON/OFF button function found in BBNSM module. Signed-off-by: Jacky Bai Reviewed-by: Peng Fan Reviewed-by: Mattijs Korpershoek --- - v2 changes: - use device_property_read_u32() to read the property - clean up the goto return, return directly - sort the header file alphabetically - rename the file to add 'nxp' prefix - v3 changes: - get the regmap directly from the parent node - v4 changes: - update the compatible string to align with binding file - fix the device_property_read_u32 as stated in v2. - add back the 'dev_warn' for 'dev_pm_set_wake_irq' return fail. --- drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 192 ++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 84490915ae4d..43827e34f276 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -456,6 +456,17 @@ config KEYBOARD_SNVS_PWRKEY To compile this driver as a module, choose M here; the module will be called snvs_pwrkey. +config KEYBOARD_BBNSM_PWRKEY + tristate "NXP BBNSM Power Key Driver" + depends on ARCH_MXC || COMPILE_TEST + depends on OF + help + This is the bbnsm powerkey driver for the NXP i.MX application + processors. + + To compile this driver as a module, choose M here; the + module will be called bbnsm_pwrkey. + config KEYBOARD_IMX tristate "IMX keypad support" depends on ARCH_MXC || COMPILE_TEST diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 5f67196bb2c1..e34dd65a34c3 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o +obj-$(CONFIG_KEYBOARD_BBNSM_PWRKEY) += nxp-bbnsm-pwrkey.o obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o diff --git a/drivers/input/keyboard/nxp-bbnsm-pwrkey.c b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c new file mode 100644 index 000000000000..154ce58b9d5a --- /dev/null +++ b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2022 NXP. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BBNSM_CTRL 0x8 +#define BBNSM_INT_EN 0x10 +#define BBNSM_EVENTS 0x14 +#define BBNSM_PAD_CTRL 0x24 + +#define BBNSM_BTN_PRESSED BIT(7) +#define BBNSM_PWR_ON BIT(6) +#define BBNSM_BTN_OFF BIT(5) +#define BBNSM_EMG_OFF BIT(4) +#define BBNSM_PWRKEY_EVENTS (BBNSM_PWR_ON | BBNSM_BTN_OFF | BBNSM_EMG_OFF) +#define BBNSM_DP_EN BIT(24) + +#define DEBOUNCE_TIME 30 +#define REPEAT_INTERVAL 60 + +struct bbnsm_pwrkey { + struct regmap *regmap; + int irq; + int keycode; + int keystate; /* 1:pressed */ + struct timer_list check_timer; + struct input_dev *input; +}; + +static void bbnsm_pwrkey_check_for_events(struct timer_list *t) +{ + struct bbnsm_pwrkey *bbnsm = from_timer(bbnsm, t, check_timer); + struct input_dev *input = bbnsm->input; + u32 state; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &state); + + state = state & BBNSM_BTN_PRESSED ? 1 : 0; + + /* only report new event if status changed */ + if (state ^ bbnsm->keystate) { + bbnsm->keystate = state; + input_event(input, EV_KEY, bbnsm->keycode, state); + input_sync(input); + pm_relax(bbnsm->input->dev.parent); + } + + /* repeat check if pressed long */ + if (state) { + mod_timer(&bbnsm->check_timer, + jiffies + msecs_to_jiffies(REPEAT_INTERVAL)); + } +} + +static irqreturn_t bbnsm_pwrkey_interrupt(int irq, void *dev_id) +{ + struct platform_device *pdev = dev_id; + struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev); + struct input_dev *input = bbnsm->input; + u32 event; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &event); + if (event & BBNSM_BTN_OFF) + mod_timer(&bbnsm->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME)); + else + return IRQ_NONE; + + pm_wakeup_event(input->dev.parent, 0); + + /* clear PWR OFF */ + regmap_write(bbnsm->regmap, BBNSM_EVENTS, BBNSM_BTN_OFF); + + return IRQ_HANDLED; +} + +static void bbnsm_pwrkey_act(void *pdata) +{ + struct bbnsm_pwrkey *bbnsm = pdata; + + del_timer_sync(&bbnsm->check_timer); +} + +static int bbnsm_pwrkey_probe(struct platform_device *pdev) +{ + struct bbnsm_pwrkey *bbnsm; + struct input_dev *input; + struct device_node *np = pdev->dev.of_node; + int error; + + bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + if (!bbnsm) + return -ENOMEM; + + bbnsm->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(bbnsm->regmap)) { + dev_err(&pdev->dev, "bbnsm pwerkey get regmap failed\n"); + return PTR_ERR(bbnsm->regmap); + } + + if (device_property_read_u32(&pdev->dev, "linux,code", &bbnsm->keycode)) { + bbnsm->keycode = KEY_POWER; + dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n"); + } + + bbnsm->irq = platform_get_irq(pdev, 0); + if (bbnsm->irq < 0) + return -EINVAL; + + /* config the BBNSM power related register */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, BBNSM_DP_EN, BBNSM_DP_EN); + + /* clear the unexpected interrupt before driver ready */ + regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, BBNSM_PWRKEY_EVENTS, BBNSM_PWRKEY_EVENTS); + + timer_setup(&bbnsm->check_timer, bbnsm_pwrkey_check_for_events, 0); + + input = devm_input_allocate_device(&pdev->dev); + if (!input) { + dev_err(&pdev->dev, "failed to allocate the input device\n"); + return -ENOMEM; + } + + input->name = pdev->name; + input->phys = "bbnsm-pwrkey/input0"; + input->id.bustype = BUS_HOST; + + input_set_capability(input, EV_KEY, bbnsm->keycode); + + /* input customer action to cancel release timer */ + error = devm_add_action(&pdev->dev, bbnsm_pwrkey_act, bbnsm); + if (error) { + dev_err(&pdev->dev, "failed to register remove action\n"); + return error; + } + + bbnsm->input = input; + platform_set_drvdata(pdev, bbnsm); + + error = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_pwrkey_interrupt, + IRQF_SHARED, pdev->name, pdev); + if (error) { + dev_err(&pdev->dev, "interrupt not available.\n"); + return error; + } + + error = input_register_device(input); + if (error < 0) { + dev_err(&pdev->dev, "failed to register input device\n"); + return error; + } + + device_init_wakeup(&pdev->dev, true); + error = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + if (error) + dev_warn(&pdev->dev, "irq wake enable failed.\n"); + + return 0; +} + +static const struct of_device_id bbnsm_pwrkey_ids[] = { + { .compatible = "nxp,imx93-bbnsm-pwrkey" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, bbnsm_pwrkey_ids); + +static struct platform_driver bbnsm_pwrkey_driver = { + .driver = { + .name = "bbnsm_pwrkey", + .of_match_table = bbnsm_pwrkey_ids, + }, + .probe = bbnsm_pwrkey_probe, +}; +module_platform_driver(bbnsm_pwrkey_driver); + +MODULE_AUTHOR("Jacky Bai "); +MODULE_DESCRIPTION("NXP bbnsm power key Driver"); +MODULE_LICENSE("GPL"); From patchwork Sun Jan 29 07:08:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13120032 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 5FB0CC636CC for ; Sun, 29 Jan 2023 07:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbjA2HHf (ORCPT ); Sun, 29 Jan 2023 02:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbjA2HHc (ORCPT ); Sun, 29 Jan 2023 02:07:32 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2072.outbound.protection.outlook.com [40.107.6.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED483227BD; Sat, 28 Jan 2023 23:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cOUIVAOxTcyBCgmg55CgiURkhrtIR/cwVVMu0wFmZfHTbR8y8WaC8BWLFUF5CaGQiHuIDEx5A+tuMzPzf3//ktjRPveqxq0MsAI5WLUg92iLPybZzCia12Tz76ysva8FjZre8zlyXQG3Ynl2YOIzv/YW+5EUQs9EEbQrmPVPKI4ZwpCR0Oa34lslZcJrpHqducHZjGgtSr3/haxhbONYtTN1tvNE8zDTmpCJr7IZeo8+9ealSwojMJGbmOAM8LfeHefPriJ5C0LCQkApABmt/cEJtmA0ENd+80Kqdq3z4scd990aBVeRsgOHCBQ3OPUlX+Yz0imPzzLsIcdoa9mV2A== 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=wM4isGeqmeO40sDjUlLM9GRjsoAHEu9VahTS+rmDxLI=; b=A/lRfyXu0MWrO7HTFfeBF8SOrw7ZaExO+DXMAkjbM60ir7Vzm7e+1Hnmk09eF9qD3FH7X565Ul1QFzBaoNX/qys+JChxppP5XtSRqnMt5pNwGINiMr47Zk82lQVEZbwVT+xvt/+/lgZCQ+A3LUwy/ZrQvPTJ6BCblwuEa/v+O8BwqWDPI6zI40u7kPEeOkHcfhce7VF7EZLXjsf3KtZGj0RoHZwMDiUiZuydlBj0SS7JUkDqLlDpHzIqMrMt/7lmBaTyeOW8i4iF5Vq/OAGVMsOZXX+0qnrtpnfb69FoYu+pNbB2wlL1Zm/cFw2f0RfeBqnNtiB2Wy62Y5t6UwaVQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wM4isGeqmeO40sDjUlLM9GRjsoAHEu9VahTS+rmDxLI=; b=gn7mA0XmOtQ9CJ2E6WUV3OVsgnYGav+CLDgsGuqhT4Z8GPDKdFHWpG6/Sw95LRXrlSHxNxCNhuRy7zGoUO6TfEKalM3SSRULhIpBlvN6XpLFH20HU0c0POtsrMxEy+yGgpCOtnVt+sNl/En9L8C/WbeO6RK/KStNdU23GUvG/mI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by PAXPR04MB8815.eurprd04.prod.outlook.com (2603:10a6:102:20e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Sun, 29 Jan 2023 07:07:27 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c%3]) with mapi id 15.20.6043.033; Sun, 29 Jan 2023 07:07:27 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v4 3/4] rtc: bbnsm: Add the bbnsm rtc support Date: Sun, 29 Jan 2023 15:08:22 +0800 Message-Id: <20230129070823.1945489-4-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com> References: <20230129070823.1945489-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0170.apcprd01.prod.exchangelabs.com (2603:1096:4:28::26) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|PAXPR04MB8815:EE_ X-MS-Office365-Filtering-Correlation-Id: f2666365-6b4d-4906-bdb1-08db01c77ac3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oYhWAm0zfeeXrjb850cxlhwjDwFfULbcs2Ydd1jjV9HkDLqNhkprrmNOTl1+lQdK0aMK5Iv8l+R8w+bdXXVSVVb1adYHSspeMe4F3numAAUDATi5H8d/0945VioGZzstYWJkM6ROKPdwldR5UJaah//zqqSADuQOVgNz8WINjXhsltrqL73kpo7DTK6t9hidnTBxECWu5K0d13yfA5EFsvQR/8o9G5VNd1Oc/NFDcO6eeiDhVCPauRMtJnpYL1d/aHSG3o77UVR64yZClpQsvlwfO4TlyIqzzWebyi/cQpYEOV2NL8RGIdSqM6ZFAIaCEbz/3p1JyC4x3xVDAihCg47pqByQ+yhNv67OJ4qdwO1amAIau0Dt9yvZ8XYO+byxE9YMRn9o26/8cT6wjZJcZOAtL9mI/rVNf08Kotaplfyv2+9FHBKg8zxCPpMCMGDHO8lx7k+I7SGxpw8hqnl0tneRHSMew1F/tjrAeJbLHqVrgjREp7PB2Qh2oFGoMJCQlR7ELH9vbH6UR3sIkGaQmMrffFrWed3g0pz+1FcfKTCVjuUfynXVt0RqIgZ2vxgbN2zgkxsenXcR4cU9pElzfdmdUMcywYqXWL9F/sUe8AB7ztDE79+NtbEmjVsrjUDmc4b2rN8O2v2tMDvp8Su/++FFfdO8H5v3d+BzVMSlS/OsWuqdsaMsYTwyMjHcjLRVaBY07YXvP3DV1JHPxPxC8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(451199018)(2906002)(36756003)(52116002)(6666004)(7416002)(478600001)(6486002)(38350700002)(86362001)(38100700002)(41300700001)(2616005)(1076003)(6506007)(66476007)(8676002)(66556008)(4326008)(66946007)(316002)(8936002)(5660300002)(26005)(186003)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4Fv+MgTYoYeJRz4LhJuZ0V4S109cCDX3ljfpT+4wsWy/25FRVRzMFLK9KvUfizkdWKjGD4eDCz9TF8T5zjr39MLqaIWgpepyxibBW5VqbskVR6UWYhTrD+lf2RPTe2QGgg+cCdmXzJ9bfjjzP7DOnFf9zFWzHwxF0zh9mi7zjklkqYA4U/x40BMg+9wI/ExME4XsuEP31SBEmgMBim8wH/aZm/ybEi9gqqH2RIs+h5S519iezKwuFq5NjsFMBJAkMdFZQvp5YKa+HAHGLrSC7hpoX0qpVNnpjuV3HH8s1UwqnrSlk3TZPmCquuv0tY6BD89XfMg06bAXXDEGeeGeFJevk5JUS1WJ51AMDrnO4//bi1dJSKMFuJZcaRFtRzNzihqd7oUTE9A0cAn47Cn0Gpk2Y+Edb1eQEJzLgYIID8m7dNH2yOTyEdQ/bFlorb1eBE97KH6fRcTkk3r8VpMXzeA+mbz6e1Tv0H4F4v2flVouD2/nGwWE3T1AQ+YatLjy7LgkjZXOVWh4dtZ+6kQawSkwnY4Fpu2BKSuasNNCc1kZ5f69hq9b9CeNWC2K3dz5igKcGlB8hmuosHuAqU3pKVBN5I+EbxGR5F+L9e6ttFdjfXpAfl/Re1IXFssr9DZC0O2YSU83/Ql8pkpNVC5wFXET5KnvF5l5BxiWBwlKb7/KmYU/b1rhOamBbqoTS6witu5t5SB54wIrJHE6emeLFVPk8n82Q5SFekM3XiPoiZ9gSuG+JTP2b5eF8nM2+E9qbsLf2+msEHlvApP58ThlVocz95y+1kMPKHI6Cg2iFmbKcH8kjDJo9KMNkwWFwPcIv5q+zn5aRuglgIEJIyGsBWgovPtPO1F6slpjB5BXi/FkpTr1nBTDn+jrN95nrfYyz25mSIJwcQEbwAti9Zmlo4zT06E1rJxLATDGaytC/WrfCZvBemiV2OBJpb4zipeHl0C/IG3nvzAIp5pnh6Vksq/+15FjecoNXDlGZcKEYdaafgN8NVZmYhMBRCiMndGzuXASlV2MqZxmTlQ6sa3/QQLuZxtazm9zAJyPG0yMmgtKmJn3IVtbda6n5Hem7KGv2B5E+P+ciFqVoxq5HuoCdGRQHXZhGmnpgWgFp2KF+j3CPGmZV6/yhG1xOCnG9tBJ57W/Hajwut4WiqTw+LwyI2fvWrzGv1eIhZyIvF9VEh2BSnCIqvxT2PA85bbMSps6YNRsKnIzGSKuY0KCKamiw5jbDYeBFvs/+sHafFmauCkG5/5cfbIy3GT1Dn9dzzTQIxH2wg6fFf+Z90/TK19iGMKWvHPJTsWTua3Piozs/dRUBMO0HN2xcOYvwF++9IKjqX2mNhsFhlt7nJStPmGa328xDdhEAfYrq4NTbxuoSxYRNfZCYG0yP1pkPlSZmpVW8aDJpLYX7c0w08/rM3v5VC/m1TXN22+u+dpH7zKE6FNb6ETCtFu+3+vpcT2gKgoxXDRGBVfT5fi4DSJZ9xvd8NG2EGyu2AMwximcskBahPhQ4P9w+dQYYe56winaeY6RMjov763k/ttVE7LMFsXcLxgrIndGnIUrYXa6imys06suRcnjnvyvRrUQETAI/rpU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2666365-6b4d-4906-bdb1-08db01c77ac3 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2023 07:07:27.5481 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F/DZ5I+pGFS2Bx7aw+hRlShECBlgiKvD57rOuJ1mw/g+bwp1MGPNHnwgFWgNFVkhbMiaUnB+59iGRz1KFLNOJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8815 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The BBNSM module includes a real time counter with alarm. Add a RTC driver for this function. Signed-off-by: Jacky Bai Reviewed-by: Peng Fan --- - v2 changes: - sort the header file alphabetically - rename the file to add 'nxp' prefix - refine bbnsm_rtc_irq_handler function, remove the unnecessary event variable - add rtc enable check in .read_time, remove rtc enable in probe function - remove unnecessary dev_err log in probe function - v3 changes: - get the regmap directly from parent node - remove unnecessary dev_err log print - v4 changes: - update the compatible string to align with binding file --- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-nxp-bbnsm.c | 226 ++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 677d2601d305..1b9e8395d118 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1786,6 +1786,18 @@ config RTC_DRV_SNVS This driver can also be built as a module, if so, the module will be called "rtc-snvs". +config RTC_DRV_BBNSM + tristate "NXP BBNSM RTC support" + select REGMAP_MMIO + depends on ARCH_MXC || COMPILE_TEST + depends on HAS_IOMEM + depends on OF + help + If you say yes here you get support for the NXP BBNSM RTC module. + + This driver can also be built as a module, if so, the module + will be called "rtc-bbnsm". + config RTC_DRV_IMX_SC depends on IMX_SCU depends on HAVE_ARM_SMCCC diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index d3c042dcbc73..0f11027a7388 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_RTC_DRV_ASPEED) += rtc-aspeed.o obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o +obj-$(CONFIG_RTC_DRV_BBNSM) += rtc-nxp-bbnsm.o obj-$(CONFIG_RTC_DRV_BD70528) += rtc-bd70528.o obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c new file mode 100644 index 000000000000..1009388b635e --- /dev/null +++ b/drivers/rtc/rtc-nxp-bbnsm.c @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2022 NXP. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BBNSM_CTRL 0x8 +#define BBNSM_INT_EN 0x10 +#define BBNSM_EVENTS 0x14 +#define BBNSM_RTC_LS 0x40 +#define BBNSM_RTC_MS 0x44 +#define BBNSM_TA 0x50 + +#define RTC_EN 0x2 +#define RTC_EN_MSK 0x3 +#define TA_EN (0x2 << 2) +#define TA_DIS (0x1 << 2) +#define TA_EN_MSK (0x3 << 2) +#define RTC_INT_EN 0x2 +#define TA_INT_EN (0x2 << 2) + +#define BBNSM_EVENT_TA (0x2 << 2) + +#define CNTR_TO_SECS_SH 15 + +struct bbnsm_rtc { + struct rtc_device *rtc; + struct regmap *regmap; + int irq; + struct clk *clk; +}; + +static u32 bbnsm_read_counter(struct bbnsm_rtc *bbnsm) +{ + u32 rtc_msb, rtc_lsb; + unsigned int timeout = 100; + u32 time; + u32 tmp = 0; + + do { + time = tmp; + /* read the msb */ + regmap_read(bbnsm->regmap, BBNSM_RTC_MS, &rtc_msb); + /* read the lsb */ + regmap_read(bbnsm->regmap, BBNSM_RTC_LS, &rtc_lsb); + /* convert to seconds */ + tmp = (rtc_msb << 17) | (rtc_lsb >> 15); + } while (tmp != time && --timeout); + + return time; +} + +static int bbnsm_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time; + u32 val; + + regmap_read(bbnsm->regmap, BBNSM_CTRL, &val); + if ((val & RTC_EN_MSK) != RTC_EN) + return -EINVAL; + + time = bbnsm_read_counter(bbnsm); + rtc_time64_to_tm(time, tm); + + return 0; +} + +static int bbnsm_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time = rtc_tm_to_time64(tm); + + /* disable the RTC first */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, 0); + + /* write the 32bit sec time to 47 bit timer counter, leaving 15 LSBs blank */ + regmap_write(bbnsm->regmap, BBNSM_RTC_LS, time << CNTR_TO_SECS_SH); + regmap_write(bbnsm->regmap, BBNSM_RTC_MS, time >> (32 - CNTR_TO_SECS_SH)); + + /* Enable the RTC again */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, RTC_EN); + + return 0; +} + +static int bbnsm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + u32 bbnsm_events, bbnsm_ta; + + regmap_read(bbnsm->regmap, BBNSM_TA, &bbnsm_ta); + rtc_time64_to_tm(bbnsm_ta, &alrm->time); + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &bbnsm_events); + alrm->pending = (bbnsm_events & BBNSM_EVENT_TA) ? 1 : 0; + + return 0; +} + +static int bbnsm_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + + /* enable the alarm event */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN_MSK, enable ? TA_EN : TA_DIS); + /* enable the alarm interrupt */ + regmap_update_bits(bbnsm->regmap, BBNSM_INT_EN, TA_EN_MSK, enable ? TA_EN : TA_DIS); + + return 0; +} + +static int bbnsm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time = rtc_tm_to_time64(&alrm->time); + + /* disable the alarm */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN, TA_EN); + + /* write the seconds to TA */ + regmap_write(bbnsm->regmap, BBNSM_TA, time); + + return bbnsm_rtc_alarm_irq_enable(dev, alrm->enabled); +} + +static const struct rtc_class_ops bbnsm_rtc_ops = { + .read_time = bbnsm_rtc_read_time, + .set_time = bbnsm_rtc_set_time, + .read_alarm = bbnsm_rtc_read_alarm, + .set_alarm = bbnsm_rtc_set_alarm, + .alarm_irq_enable = bbnsm_rtc_alarm_irq_enable, +}; + +static irqreturn_t bbnsm_rtc_irq_handler(int irq, void *dev_id) +{ + struct device *dev = dev_id; + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + u32 val; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &val); + if (val & BBNSM_EVENT_TA) { + bbnsm_rtc_alarm_irq_enable(dev, false); + /* clear the alarm event */ + regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, TA_EN_MSK, BBNSM_EVENT_TA); + rtc_update_irq(bbnsm->rtc, 1, RTC_AF | RTC_IRQF); + + return IRQ_HANDLED; + } + + return IRQ_NONE; +} + +static int bbnsm_rtc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct bbnsm_rtc *bbnsm; + int ret; + + bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + if (!bbnsm) + return -ENOMEM; + + bbnsm->rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(bbnsm->rtc)) + return PTR_ERR(bbnsm->rtc); + + bbnsm->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(bbnsm->regmap)) { + dev_dbg(&pdev->dev, "bbnsm get regmap failed\n"); + return PTR_ERR(bbnsm->regmap); + } + + bbnsm->irq = platform_get_irq(pdev, 0); + if (bbnsm->irq < 0) + return bbnsm->irq; + + platform_set_drvdata(pdev, bbnsm); + + /* clear all the pending events */ + regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A); + + device_init_wakeup(&pdev->dev, true); + dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + + ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler, + IRQF_SHARED, "rtc alarm", &pdev->dev); + if (ret) { + dev_err(&pdev->dev, "failed to request irq %d: %d\n", + bbnsm->irq, ret); + return ret; + } + + bbnsm->rtc->ops = &bbnsm_rtc_ops; + bbnsm->rtc->range_max = U32_MAX; + + return devm_rtc_register_device(bbnsm->rtc); +} + +static const struct of_device_id bbnsm_dt_ids[] = { + { .compatible = "nxp,imx93-bbnsm-rtc" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, bbnsm_dt_ids); + +static struct platform_driver bbnsm_rtc_driver = { + .driver = { + .name = "bbnsm_rtc", + .of_match_table = bbnsm_dt_ids, + }, + .probe = bbnsm_rtc_probe, +}; +module_platform_driver(bbnsm_rtc_driver); + +MODULE_AUTHOR("Jacky Bai "); +MODULE_DESCRIPTION("NXP BBNSM RTC Driver"); +MODULE_LICENSE("GPL"); From patchwork Sun Jan 29 07:08:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13120033 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 E6DF8C636D3 for ; Sun, 29 Jan 2023 07:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbjA2HHh (ORCPT ); Sun, 29 Jan 2023 02:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjA2HHf (ORCPT ); Sun, 29 Jan 2023 02:07:35 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2082.outbound.protection.outlook.com [40.107.6.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF14227BD; Sat, 28 Jan 2023 23:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGcBABGjR66i7cZHZ0agmXxaotrmQsWXLVnYhQrRBvCStmF5XpzOWD7D8SriCL8E+cj7sYLjyB+hBtDWse+KNTD7rhmPEXN/dZVgADZPbpa7Fdk3fnZ4SHgH/uDM/9dhHmQD1ERFNVRfz9z5zoQw+2q16lox8h1bSSdGfzdmdbgascbGzP34UfzDX2bCG2c05CeU3rQ1QfJINBSA3kwz3PWtTrEO2hmm3jsm2yt8dcIIvW/VQO+/INocPV0xwo46cCgGNEV+yP2c3DFwkhOfwxTYL2ECp9Jl+nSELEkUFn08RMChu1tgCqtYNd85xPgVFGoCGn7ZJTREFAJX7idlig== 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=08XpzoY6MDmMWUCcTtlYSXKj84FTUn8gfyKsjDO9Cwg=; b=kZYlNxeC/MIm+5UDi5sYU+IJpdmK85dKCIyKQMvQ9DVmf1FQHEWF5P1cz7tbIvGXy1hhNvOVT/wFBIFQc0sFsAN1uNEr6C8HgMcoW0r33V2iIpr3Z/rxaik2eoQI5r9+Xu8BppDmEeejEYvJxlaX5HCkfvx+J7Zx50xgAjgyCTvqElwtze6DDhR2zpu3La3/55oaqYi1jYcWQIu6pmXJ/8SWiHSezAy57GAuiFsWQj6Y2mbP7qQWfv1xlvqMcLpnRm/nO/ATRdQXj1HU0W7fPaAdZNJ3FrnFMMyYkWqnhiUGKpMkr/CKmTw/42ziMR7cLqDOxhsipkwvVrU2lzpEbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=08XpzoY6MDmMWUCcTtlYSXKj84FTUn8gfyKsjDO9Cwg=; b=WPw8OOh3XTgBpWx0bkGv7lmDqvMQTqmK2fhqT+ouk8weyGHSggOp3gxRDmShZBXUgAZ2yP/siHXXBmwwQjGdDx35EkiO/7m+CtOqIClYpfKxDshg9QVwPnFtjvQyugBXo3OVMjF84ahzPcz+/2ch1coPfF1DdOaZHekz4MneZAg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by PAXPR04MB8815.eurprd04.prod.outlook.com (2603:10a6:102:20e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Sun, 29 Jan 2023 07:07:33 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::4ca4:bfde:62dc:4b2c%3]) with mapi id 15.20.6043.033; Sun, 29 Jan 2023 07:07:33 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v4 4/4] arm64: dts: imx93: Add the bbnsm dts node Date: Sun, 29 Jan 2023 15:08:23 +0800 Message-Id: <20230129070823.1945489-5-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230129070823.1945489-1-ping.bai@nxp.com> References: <20230129070823.1945489-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0170.apcprd01.prod.exchangelabs.com (2603:1096:4:28::26) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|PAXPR04MB8815:EE_ X-MS-Office365-Filtering-Correlation-Id: 042c1dc9-a74c-43f5-b970-08db01c77dfc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oklzy3Aahay+yCwXm6xwyD5VjyppZFF6JlPOXCQjD6/ZoCvvT43yIgK/nYGL1//HUDX9pKkEFMzW9L+vmXou7ha2u7kuSo3gD5co8ptFG2Tu+Mt18N+BD7Jf2oHwFlcDHW7EBs1zxo6ciQHP+dmVMtGxQouXm5yq8y4Q10QU5i+XCgFYIWVlM1jy6uxSd683Un6Ct5XYYml7+2cNYsN1mKlyTaFdSO5cLyXVOBnHIZv7VHmm7NADJK/SjZwP7d9O9X7KirOaVQ+ZEVpP40h7qHoB63NQexTZEOLTSqwb5cWqwTSk+6IhOjjo0OqT4mCOH74aO3Hv0sqqk3jmgTSgTJ/xjR3of2zZOVUyDAvm1UeKjGy+bTAFJ9s3Lw6X5hpswSN4hfGUWgZnYC56JhIHmGeZPE0A/+Gech1sYraVpXN0tDJorZFC8JdBlGedU2K3d17IuTHJMkWIdRVGs9MbD5b6SI54C7APFt/emt7D8XrzgOlMRcQV4BYFzdNDuo8y0rEyNU3JYnyr9bve/+1UNKBmLKnLf8VlhjO5fzJa3rjojz0FmW8ojjHAapdak1D5SX3rvl2mep+8ooJ169DXKUIc11uSCwBkG0CEQ00XU8b1+eA77LF/Nd5KnaoQ8Y/fdybP72gNYk8PNZFGk23NhluczgBIqRJ4W1K36qxghv4cjFbBVDeXvemKuqBxBsHElHRmZzjqtMp6lZPkIZVz1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(451199018)(2906002)(36756003)(52116002)(6666004)(7416002)(478600001)(6486002)(38350700002)(86362001)(38100700002)(41300700001)(2616005)(1076003)(6506007)(66476007)(8676002)(66556008)(4326008)(66946007)(316002)(8936002)(5660300002)(26005)(186003)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l0mY3QV3TfAcxmbCWhxYdp2ETotrBOfOXvLTJBBCOOkRZ/ijBIPHUD5F1DBaNkNfCO/B52RsRAFPtXRXf6a6UGdyVvDfyWOHKt2Pj6dNrGTx8o6QdyeVmUZYXheDQoUIJ9dVUvLBNlcUX/xtFtyASJmU8nKOuQeLkeTY4woIrZCYXvI49KJuvnfQ+eoiFJyiLKqi3MgOJtYr7HXLH31Y9CBnyMdTiSBZG4uHVDZ++AvGQUO4XSOhwm0HcWfylv9HvbnuGdYtKaGAN0jT/XO+QWycZ5jMOU0Z3o2deIoL1qw97FRP/P+xVzh3JbKAeadQbACEgMa/U7aCP0O26spIeiWSmhBnLToQIXDkzEjkDpbK6lIqeX9w0ex46dTDIBoRNbC0jHzmDZVirsKaocZ6dTfRZgoV/pniu/Y1U3wWzxSa7ZtkFtbjhICgZtGFhYiliYAelZfEpScnonznWu2D/Erp4aznVwWc9RWBFtIqgkcD0F8hlybmd231bRFpFQxCoatNjKvrncsRQ/a5JXDlCHdAd1tzr2Woypy8NsHT8dplprEuz7lGNHpvZ8hRblZJsiJCyWIm7rjitf/IyW/ntygXs6Z/7LBUfTqPAE1atJhBrgDpSDt/Ck4ogOZ9b6w0lz4NXbdJYeSR20IF3VpNtIWaFQviMi+RvSM6ug2ndBii69/qcwha8LLYJLjou5DzXvVIRVhnPWrNXrGHBNPHyisWKTNtG4vg74I0BEaeE9kG6YqQ+vlcRpn3eKnzyBl/rhPMIXh00YMpAq3lsq2/1p2qFe/mDlDVIinyWyEzvIsmW8eVRqCHqCOrrIxhkKh5b38vIryxVahprwNYY5NudaFBOGaRAzdVXzcIZd5SjStk/4deBWmFmHo21CEb4WWtu5CnCLZG9THwNS0ujQkdJRjkr9s+JRHOAbkcbRMFGXm9uwk6eVoLZKxk5D7OEFNeCGMAXt/1k9D+slQUg94bCVCha5anjcP5kfFY2YB7lPVyk8oeu/sjtB07cZRXoOU5LzhrJTfiYqIBQfHk60bxJ9XcC0WoNxfro1D/iB0syK2aXdr6FDYG/WqkfL3gz/KeJh3u+p+9Gr+j52kNjMPyGgaA/MaF+PUktChqtSqOYJFsfOC9vz5gT9BKgOAUWOxbeMjDeNmjKz1y8QqOmalqMBx65/YoWVOUXVfvkq/h2bpltPI+601HvX1o21K+4oXkFpc/NUgLyHKDHUMfmcuI99b9DJmAUAEyGa+Ya/eRfTKdj1Thye18oPr+JJrhOhKea7E+tTysLr8lVDkjCNqyIz3oTqwcatsYMhPonzZZJYzQTNT+m+eEL3NdkLRbiwkaVsxDZTd9L4K7w2HuRo+uR1FYXt85KaehhGeYp1CluM5yMTOUe0eLjkq1TkjQ6TS84fOyStDqhjEmk2FmnFhkdccMbMcPBjMJdUBePNgpSdsI6XdeZ+DMRjQUFG9UfxeOsv+/M5FghNUlyIcRymeL3bqZn4Wn0A/YTe6cs9N9nHdAQKHes9lpZeDnZCnXY9irgZVTv3xts4kFCUO34lfEiQfFbMN4SKViBVuYAPgAVZEQaK+B8CtJOKb/ueqhs1vw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 042c1dc9-a74c-43f5-b970-08db01c77dfc X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2023 07:07:33.0306 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xFBlP48vYFHMN86xm4MMlTDgtTyP8AVqNw7RHMWRVkN+UgJqpP3K+g+GvHgu7J43i9Q4Cb3xT0iM0h5v/u3APQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8815 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add the bbnsm node for RTC & ON/OFF button support Signed-off-by: Jacky Bai --- - v2 changes: - update the regmap property to align with binding doc - v3 changes: - remove 'nxp,bbnsm-regmap' property to align with binding doc - v4 changes: - update the compatible string to align with binding file --- arch/arm64/boot/dts/freescale/imx93.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 5d79663b3b84..36be18165d4b 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -229,6 +229,22 @@ iomuxc: pinctrl@443c0000 { status = "okay"; }; + bbnsm: bbnsm@44440000 { + compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,imx93-bbnsm-rtc"; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,imx93-bbnsm-pwrkey"; + interrupts = ; + linux,code = ; + }; + }; + clk: clock-controller@44450000 { compatible = "fsl,imx93-ccm"; reg = <0x44450000 0x10000>;