From patchwork Tue Sep 10 19:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13799283 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB222EDE9AB for ; Tue, 10 Sep 2024 19:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RpQmdIpW1nEf/t8itYF7d7iwzZIIlNVQvBzSUpk1TFU=; b=Z8bAVWPT6AQ83M/wu37/7Ai2jD KVO8QXLZ7KIr+l7jROzsQNL10kYDa+g/PzJA98tx1vQwrfJGM5RK9OtQ8XJQgvlo3wHTWNs/oqkB1 e5+pnvwelK86QDl8Bad8s3a4kRjLZ+9ooubaKNXcUuZ5rUsbO3j7EI1tMrQKAT4kODmLN/GY4hqZY rzRF8V0as3PEjSLhuFSkelbw/Q6xfHfRSppTJabwLU8s1yPVDjV8fxsSSJoLpr5nRqbyil6gQ2uV0 fm7c68jpx0HpJus8Fg0U+ag7jk67OEsZX7qePvYjq6vPflTluXEvj7HY/hfrA5VRREqdQaZRG4jUd wA8eCaSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so6Hf-00000006raC-3AyG; Tue, 10 Sep 2024 19:12:15 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so6DW-00000006qOT-2lgO for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 19:07:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C6Cl1NEwZSpvSftV4Jq+hjyPDgC0R320BL6DKaO6pkDUcIhXsuUbxOsURcCxGs6jiTZrC4zJEqBQgPPBEuS57MVpbvjkEKXiAV002hQrKmK84Gy99505LHezVfcF650rT+O5HNK78N1VyXqYNoLiXKkIREHa5++yo4/zP8fUoMBjaHlF2GCETVA90mZl53Y+16HJShAExXhHS41iZTiUeSS8dGJd7AJdJTDBxbNJnZqiObuxN94DIdbgUU2Mls79SmtJ53TYMepZPhz8X4kqW4SZDN6IyC72cvduVEgnJvgLnZHVAUGm+Qo2WiwflL4AC6fIHWUrKaO6Ohpare3ONA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RpQmdIpW1nEf/t8itYF7d7iwzZIIlNVQvBzSUpk1TFU=; b=kESMwTh3vpGTPrT2+3VPRWdwLPMWyhdn/sg7d8PVS1/P7nb1GgUb8emI3PFX6uz4nNjUJ89Hk9goXv/VRr4EpNMUy3NK0XqD1wUWfrOU8Na1AxZPitpA2pIatzl8B5+eLUAPS7j3oNgDkGR2JozDJO41hTOfIIeXEVjauWjzg6AVxSMyqiX3rI2zqQwtpX8GnFZEUxP+5abhJwMrJHp2aAnmb4YZVyaHeMT+f9/KNu6YOVFodzVCx+9OrXioImPOWodKnZMD/5u+vmL6g5/L3CUJexHJ6hwL8KgVzFhwLdIxmTAcqJzdDrzpQayghtGHgLpeCOT+zbMSAYKFcSejLg== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RpQmdIpW1nEf/t8itYF7d7iwzZIIlNVQvBzSUpk1TFU=; b=c3UjM5OJNtXG/VTMw6/meZCCVPoNahXHOkJ4UJFAYeB9f8D+pF0dD0CfYyYbgH78Xrr1tg8w7LvRXSE7PPe5fggSMGhjv22B3gNqYOT6EMvP2Nwoi4v/Jpdtn1jz9jZl4DfShv7lhYflmY/T4tC0lJ9IpS+QutUsrzRzxEjF6cko8KZb5s6G4h8c3Ma+ECcaf/1d+1Zryen+WiLndfnEapWViGNX0DA73VNoOs/7Myepj1/uMc/JsMyYDQ/LvReooG+j++YQ/aJDJXYfC7tD/YT85+Gs4pY6TXWcrMQC/6k/j8QfPbbozSWAOm5/UsisUPBcKHfhD4RO4Hr3t2CI1w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI2PR04MB10115.eurprd04.prod.outlook.com (2603:10a6:800:21d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Tue, 10 Sep 2024 19:07:56 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7939.022; Tue, 10 Sep 2024 19:07:56 +0000 From: Frank Li Date: Tue, 10 Sep 2024 15:07:20 -0400 Subject: [PATCH v3 3/3] pwm: imx27: Add optional 32k clock for pwm in i.MX8QXP MIPI subsystem Message-Id: <20240910-pwm-v3-3-fbb047896618@nxp.com> References: <20240910-pwm-v3-0-fbb047896618@nxp.com> In-Reply-To: <20240910-pwm-v3-0-fbb047896618@nxp.com> To: Marek Vasut , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Philipp Zabel Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pratikmanvar09@gmail.com, francesco@dolcini.it, Frank Li , Liu Ying X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1725995258; l=1677; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=L/XPTHuau3NF7c+XW7u38Kz5DmqTCXnWMscgXXRISiw=; b=3OAc+pyLPshIlPRvYlJxzCzQT5iymtxjjZlMgi2MYCbWOLWkSC6fLCzcIH7YuUwpsE8vhjLPw Jha9yD8YRN7BkboLQX8tgXsBK2FKzHwr1WjV14yeqo0pMeTWbp5pM/v X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0145.namprd13.prod.outlook.com (2603:10b6:a03:2c6::30) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI2PR04MB10115:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ae88040-9e20-4c45-b046-08dcd1cbe117 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|52116014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?UloGRQzHsBHGJDfztFnWMWC5se61Eap?= =?utf-8?q?XS0BwwnLvpcgcIeiZCRnREp1JySNIpyYDGjVFA+n7JvQmGKDFatkRMD8RdrSk5CJx?= =?utf-8?q?fTZtcqGc+10UjAw+o0BRNyfQfM2pazuXSGeFtZEW8E7tBUXmpY2sd1YIQmVUUvDSr?= =?utf-8?q?gpx/gQsMTeVBuWOiZoD6QboZChnEA2YXZG4zpQWD6kGidhRMZztrRuCJiWrJJRKFd?= =?utf-8?q?prbplh5LCy96VASLpPYI6EOn1OH0MA+4/DMWrqZfX1bH0UcOkgMUEvRPEn1uLO32o?= =?utf-8?q?w5hAnwMW+oDEcT/9D60mEWTB5H0uFn3KsISEleVKwYifpxjgN9WTYN+tT4WckKG7R?= =?utf-8?q?Fjr6Fq3W2gflr7dknZK8A+MRn/bCfStwi0XJaSGjEWy5IiCm2uh1PSsOzeFLmBTSl?= =?utf-8?q?hd8Z3O3AXrDflmWNAJ/tQrp4tmUi5qGlonzH84iPhKnLMSrTD06jJP22nBEknQ/Q7?= =?utf-8?q?/vjaIDDfkiSE66buP/gKGT8gj/2Gau5NXkVobWRXd3QdwxaDmrNvCm9iHVjOYAQtE?= =?utf-8?q?RmoErS0jHpAn0W1KOYsdGph+aIVSSOtTjnyonRdeNUzcCz/3U7Ty6FB0BRojbF0zN?= =?utf-8?q?baUp6Cf5RpmGbZKwc7eW9sxIhkwZgf+SAOxths/RQ7miI1BFEj/pZ4Ff7jiyXC0NY?= =?utf-8?q?hrtHyTQuvhcYvU6OrHAsCEWHXs6qoRadu1xM3NIvxMwIc4suO9edY7igHMW5C9OqY?= =?utf-8?q?zj4b7tH9CbZMO87MUP/9DOTNXAQVp3KL9iJySS4gdKkKmoGZ5gHzLF1QKXM+p7Z1p?= =?utf-8?q?5uasv2C0pmSBGpSF2nLEJ623HItoHqgAgti86EewUjcqmtGM8NaFCK/SDTQ+4GrlU?= =?utf-8?q?buiW9VpcvONKBRcNsqWybtwomD4aw2W/9fpZTl5RdnQwQpM5gANcfM8UJZt7DRaGx?= =?utf-8?q?OCFFjm+31rIgZHDYdfpCj9YruSPe/Jl6BBNR4iNakPunoaX/Mz6A6XA34LLEgdEQk?= =?utf-8?q?LScCI+H/hvdO8q7oWjRS9KnPiAtA7lmytYEMx39i6U5Ugn8MoViBbDVGOUw1F03Um?= =?utf-8?q?UFqDsyVVy+NpdyNPwI4eOZkdp6ExllnnU3tyVG8LmGRe3PuxCcuJXFsmLq6cH18d+?= =?utf-8?q?757Ex0GcDLzo+8r/HFPKJlHietjq4PCOkucwqtcDKj+YKUEk84Gwbr8InGKvWJPkw?= =?utf-8?q?qqGtuwVQrDHfvbWucH3h71Ga2E7ygh1A1wcKxvHKaGF6sxdICVwJK5QHGYZXaoP0A?= =?utf-8?q?ccwxdudI0ddPWb1O3AihPE4LQxlibFWpJOcWWxN+xZ9TW3oPyabELlPLIGLJ+e8KI?= =?utf-8?q?7rOyQS350NVpWqGYujY2d/KHMsrhMXn+GdCSpZv7aVB4vfh7smWjhcijX9gNIvcDK?= =?utf-8?q?NKE5ElpNV7hRj2yuas5sKA1Cd7TyJ+ins48/JGgbZmewCZQqt13E1Dc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(52116014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?QaX/jAM5vRe4dWeJ2r35/f4WRoLJ?= =?utf-8?q?ZdUG7T3CQ8oQFc3uZyGGycyt9j88h+G2FTZc3lbiGGmRnbbHEsA4YLMWRUSXk/xze?= =?utf-8?q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VrIIMhssfb3eHJpEWwWlYmpSCxrVM0rWtZNeJI03F7/eP+gwKL6BPxsQj5Nu6ytSU?= =?utf-8?q?7TbAz9ybJVsEF11yqqEO6tr7sVhY75zCYubGrKvM+VIJndheevjbGlIJWPHGdv+rG?= =?utf-8?q?0s6YwbrIJiXZqIAYYYpzzjNOjiR8aXkSJcfrC4JJ7hIVuloaCFyPS6qA3wVa4/773?= =?utf-8?q?e4NUlD4tGB9+NGSvezfJy3qS+lLwbSNLHR2rqhPkkCjQfmyoKghCCfowPwYT0FJmH?= =?utf-8?q?DtnFHmM25QDvs/KJySgdwzjIcYIuQpBtAIVKFzQUKBv7jD5dvZm6nK3fWPYgoP4DH?= =?utf-8?q?F5jm36IbHgl2EPAZ7K+LpFxK2Cn3+1AyuqvdS1OJBwClZizy4ropZhkcELROWQaIn?= =?utf-8?q?fQtExlqVLi0ud02wqIhISTTetSaHOHNUhbGym2oT2A1yXuLHzlr/xK6L6LTeX1UFI?= =?utf-8?q?M0QRq+Zgs7WhdlkzhsVb+IBE2wI4/QGsai4p5691JCIqVmkZwmeB+MyFki3FhzGq3?= =?utf-8?q?xL5eNudvpYOSpJMrhDUc7w4HzwF7vlPAY24y71e/xoTUH5kok35DGPlQ=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ae88040-9e20-4c45-b046-08dcd1cbe117 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2024 19:07:56.5704 (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: XbROQMiS5Nuq1wRXo9P8nNoeqfXBgrLIvMBa36/6lZ3pWoLVBxxuCh4Q64KaCb3LcXYwKsV9fpVTMrcD9VL4fA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB10115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_120758_744399_ED090BA2 X-CRM114-Status: GOOD ( 16.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Liu Ying PWM in i.MX8QXP MIPI subsystem needs the clock '32k'. Use it if the DTS provides that. Signed-off-by: Liu Ying Signed-off-by: Frank Li --- Change from v2 to v3 - use buck clk API Change from v1 to v2 - remove if check for clk - use dev_err_probe - remove int val --- drivers/pwm/pwm-imx27.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index ce9208540f1b8..2a9fba6f9d0a8 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -81,10 +81,11 @@ #define MX3_PWMPR_MAX 0xfffe static const char * const pwm_imx27_clks[] = {"ipg", "per"}; +static const char * const pwm_imx27_opt_clks[] = {"32k"}; #define PWM_IMX27_PER 1 struct pwm_imx27_chip { - struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks)]; + struct clk_bulk_data clks[ARRAY_SIZE(pwm_imx27_clks) + ARRAY_SIZE(pwm_imx27_opt_clks)]; int clks_cnt; void __iomem *mmio_base; @@ -371,6 +372,16 @@ static int pwm_imx27_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, ret, "getting clocks failed\n"); + for (i = 0; i < ARRAY_SIZE(pwm_imx27_opt_clks); i++) + imx->clks[i + imx->clks_cnt].id = pwm_imx27_opt_clks[i]; + + ret = devm_clk_bulk_get_optional(&pdev->dev, ARRAY_SIZE(pwm_imx27_opt_clks), + imx->clks + imx->clks_cnt); + if (ret) + return dev_err_probe(&pdev->dev, ret, "get optional clocks failed\n"); + + imx->clks_cnt += ARRAY_SIZE(pwm_imx27_opt_clks); + chip->ops = &pwm_imx27_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);