From patchwork Mon Jul 15 20:29:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13733890 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 B8FC6C3DA59 for ; Mon, 15 Jul 2024 20:31:34 +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=loNrToPQ8nRsb22SQtIOJcLAmRrMeT5PdyVjK7RVd9w=; b=P04Qcb7uKSFD8sEJnpyvyeqh4Z teE3VWh29d7ijU4dK8cdJkrr+HMPtXM0XErKFbKnUlP19N6p+/1F6Gt/1OSF0VSVyoHAr15G2URKK BQQDKtaiLFkEV92vPjnaWQiqGE7KixlNd+iE/f6qv/0Y8QZl6zPMy2JccvTuVKPvLKLUW1pHMWAZQ ILcMLpGlsO+GLKkJBRA63V3ZmpI73reesAvQXzbp1nxZlRXEnSqmWgE1pX1MLAzhwLExzoImyfkFk DCAF0kNTSFav2EODfICR8QEqCmnX7LVqaS9sqjhYcwzeCRQ6v601tQAieRIG7a5ha4IiKp6R6vW1r hDenX9lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTSLz-00000008IfL-27TE; Mon, 15 Jul 2024 20:31:23 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTSL1-00000008IEZ-49Kc for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 20:30:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EBwZ0dU0KbaMNduewoph/lroLJBy/tjdJvh2qXTenegmPOWg0vqvx8O6Qqpe1DrD6F1vnoVB8QRn4QvFRorwGMHrcXGM6YJPGIVjvDw0SlXqkNkQervekZKuDIB52vQUJejwR7hCyZRGWNF9F85YKVFb80RxDTXGsWsCXxuVANMfIKPkxdh+KoI+RVdeb8cMShhKgQpbUhhqwPv1d7H2bHNz47Ul3ePKAsFjR7yf7Nyt7Mg80hTiK74E30npBamL4f89p4ESSkZBRGeYYyZ2AGqwKFsJqSPRWE2+NGTiFS6FWMfBrqgYF1uLJBP2mbCM1isZ9x7H9UL6fXDocLI9lg== 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=loNrToPQ8nRsb22SQtIOJcLAmRrMeT5PdyVjK7RVd9w=; b=vYsn8O9oYoowPqxDPla4OtOgYGFRD/3+MDACuviXQqIHtki55g5QrS2bP7lUpdyYWKMl+jqrJHB+JsBA29yGJljHcSNX2pRGDIbSPmQzh5Uzn0mj1IGPA003O2Lw8qEWwwZl6R5ST31shca4glkx5tHCjkigGeJ0vO3ZI1VHXX1CvVBXgTHzURviomHh3ar9ge5ZOSSc2E7n7Irj4ikQMjxq4ekNLEnjfLWdiTKZTt4fb8YI6voYiNB16nMX9UnMrE2E0H0rLm5YodDdMeML0nONhT8zFsNcnr9OyY0517D/e4tW/n+4n4f86ArlN3cznvkTfzS8FXwN39kIfOMkkw== 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=loNrToPQ8nRsb22SQtIOJcLAmRrMeT5PdyVjK7RVd9w=; b=gI68IYMroWvdX6WxXRHQTpmiQ6cXvnLCXWtK49LtJi8XQ6qQ/1YwYMEBcafBIlSw+tBU7RHeRtBEyrxBOK10RpRKljKo5Isjr4o1BwHji3ZUnzOAmD1Npl8FuvEf0vjQQBiq4EnaQhEqk9LspK/9GyV/2Ylwn0kTS2dw1Fl0eoU= 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 PAXPR04MB9253.eurprd04.prod.outlook.com (2603:10a6:102:2bd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Mon, 15 Jul 2024 20:30:20 +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.7762.027; Mon, 15 Jul 2024 20:30:20 +0000 From: Frank Li Date: Mon, 15 Jul 2024 16:29:51 -0400 Subject: [PATCH v2 2/3] pwm: imx27: Add 32k clock for pwm in i.MX8QXP MIPI subsystem Message-Id: <20240715-pwm-v2-2-ff3eece83cbb@nxp.com> References: <20240715-pwm-v2-0-ff3eece83cbb@nxp.com> In-Reply-To: <20240715-pwm-v2-0-ff3eece83cbb@nxp.com> To: =?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=1721075406; l=2230; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=8yBI5EIYzxRTzuANn9Ot3THiqvcs2WYhNhHWeOps8hY=; b=9W8dQzaH/wpxantqymPObtuegzGNviX6HqCOqhUR306/oXEerxfMke0+ZUgzegKSJok5btyQ7 aEBj8gM518sBtzkqYZJOWfGrA3uRLxVtawfGjgHQQUJD1s08PradoE9 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR03CA0166.namprd03.prod.outlook.com (2603:10b6:a03:338::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB9253:EE_ X-MS-Office365-Filtering-Correlation-Id: a87b1f8a-8637-4132-d4a1-08dca50cf239 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7bSg2OyxKFKUTzlKHlzI03/FdeA8oX+?= =?utf-8?q?lqLt9T7VWTtzWXhs7goY+QsjXNVhsdm4jBlieVREwU8qqi0+6ftUrjkJNXAP+eVJ8?= =?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?= =?utf-8?q?hOL3GohQ3Ijtg82sEdA6BkxIMbhwrfSoMHuA9PRAMYdsNDPNH9fznmzrUON9qL5q/?= =?utf-8?q?92kyR9DEF3ISXLhkBn2oR9kW9kTG/ZwWkNjJRnQSXVL2FvvuZ91v01mgLZUo5kdge?= =?utf-8?q?/pltCQJByIrzQiwW9Q5RuxoK6tMzH8FzLowK6mt9i8smp8XHOdt2T/WoRQSnE8k6a?= =?utf-8?q?k1pMSQ7i1vC4FVDed+cAlmfuZ7v5FyxWp96EkHplDyOKivK/BC/xSUgmdCJ22NYDG?= =?utf-8?q?w6wJl8//4TLHXArhVic8qIQ/HDRBoxbhEu0f0zi21W8oYPRvEzjGMo9NCJDXvyUfl?= =?utf-8?q?uQPtj6YaCJnz6US5JQmsPI4YA44q6uDVEJtipU2K+THZ4G8A5XsGZKnBPNKj+uOkq?= =?utf-8?q?O+DAEXf6nWORCHK7IHV/Ln1/ycyB9wXiLQ=3D=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)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YL0fOEX/JYQe4354qR55UGkHil9C?= =?utf-8?q?TsvgNQl0Aln99rk4pYXpmFyuI+elwf2dWQxrbH8ebjEt7x/SVPQfzP/HDIBQo9f4Q?= =?utf-8?q?Ipqu0gIVTzILju3+hsnMcu7FE777aOtjxQaDKOXYf9a60WUTRcYt5JdC5HBC68y+G?= =?utf-8?q?BdP5jvzcyIu+Y0nxbXaMrwJfuCb9YCyTPfVctpAIV7pwuMkO0Xp1dgVxVMqmBl4/s?= =?utf-8?q?sK0YShqDxmnxRlANoO4c0z998URRxpgtYYG3Rva643ViKPtke82f6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5YM+X?= =?utf-8?q?8NbuO9IxVnneJhRQh1ygJizHCFTNIoZTyUVdiepcDOfJz7IkgOYbwkPCVYhWv6VFT?= =?utf-8?q?MduPsyhSzuYUtUTtPkdcwgFunzYR3sbDbaPa2yDg/xlyXZI3Ihb+6ezptpzhibUWW?= =?utf-8?q?AO+zyPmTGNAiSKUK4ghmx9R5KrrSGyauGIfpBoPg3+CI+HdMyjf0V4y0H69leeijk?= =?utf-8?q?rPSstB18JjCAAqDhYjDrhWklwg/HKoi9l9Y0SwQzABGAlDqVILeHOdOL5pSEcsyow?= =?utf-8?q?+ewe8CIb9BkAW65ULJtSj0E2/HLBYGwum3MsLmIvmPC7yigxFPC8RquvgNenSGmse?= =?utf-8?q?M5EmYWPeT5MCqZfSJ0F9fgC11Mr0006ybDRXdMytRgbhKl0Tnxwbq/YE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a87b1f8a-8637-4132-d4a1-08dca50cf239 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2024 20:30:20.2595 (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: OLdr77y7B1KU35zSzVtSm6Qp2l160YqK/Y1Q71ZzS6PGZlsHImQU/xPEDOyylpWjljHWXTQhtwNkYQeAYmu00Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9253 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_133024_220549_7E066F9A X-CRM114-Status: GOOD ( 16.06 ) 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 v1 to v2 - remove if check for clk - use dev_err_probe - remove int val --- drivers/pwm/pwm-imx27.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 9e2bbf5b4a8ce..253afe94c4776 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ struct pwm_imx27_chip { struct clk *clk_ipg; struct clk *clk_per; + struct clk *clk_32k; void __iomem *mmio_base; /* @@ -101,23 +103,32 @@ static int pwm_imx27_clk_prepare_enable(struct pwm_imx27_chip *imx) { int ret; + ret = clk_prepare_enable(imx->clk_32k); + if (ret) + goto err1; + ret = clk_prepare_enable(imx->clk_ipg); if (ret) - return ret; + goto err2; ret = clk_prepare_enable(imx->clk_per); - if (ret) { - clk_disable_unprepare(imx->clk_ipg); - return ret; - } + if (ret) + goto err3; return 0; +err3: + clk_disable_unprepare(imx->clk_ipg); +err2: + clk_disable_unprepare(imx->clk_32k); +err1: + return ret; } static void pwm_imx27_clk_disable_unprepare(struct pwm_imx27_chip *imx) { clk_disable_unprepare(imx->clk_per); clk_disable_unprepare(imx->clk_ipg); + clk_disable_unprepare(imx->clk_32k); } static int pwm_imx27_get_state(struct pwm_chip *chip, @@ -325,6 +336,11 @@ static int pwm_imx27_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per), "failed to get peripheral clock\n"); + imx->clk_32k = devm_clk_get_optional(&pdev->dev, "32k"); + if (IS_ERR(imx->clk_32k)) + return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_32k), + "failed to get 32k clock\n"); + chip->ops = &pwm_imx27_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);