From patchwork Mon Jul 15 20:29:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13733888 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 C0441C3DA59 for ; Mon, 15 Jul 2024 20:31:01 +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=ObxXzQFhjjaq1HSh3InarSZnaei1qz4Q8BQ8Pedp2rY=; b=jsdvRoRQ6jmNOE8Z88p6sdrrxQ nBkPOmXAiDL490oShWfl29v5T2/gqmImqs7BEp8KQPoGMBndorXQNWn7aHPcMLQjUOQnpsVSbTl1O FuMSd/u7HBB84sU4QjuZ0wk/nJsZ6SPKFv+89G9K3c8h5DE+2f9FdzldyRusE9SECrg9AOCtPBECC vyEHudGMH+V/LaTfVRh2oT66Y5NmdcSM6fmQbli1sVzhs5+D1EEMFI74XuGKSXjpnlUK2FDWijzZg mFiBef0OtJ2jROptqU53MNgOFwKyuLztElZrtosbcdi/sfjDxhNSF50FS5Uc7vkh1zcW6gLXaOA/b PYMvLSAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTSLO-00000008IRW-37z7; Mon, 15 Jul 2024 20:30:46 +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 1sTSKy-00000008IEZ-0O3u for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 20:30:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e5ikpfqFV/zlYuZQ9T6diNOHOMn7/tJ9kQAux3rebzH9/LUW46bu8vU6Yq1LmH5dC1lC1ngys7UZZnk/8+tPnPuGRyZvofEIGSutIQJWrEkZrqKnlz4ILVuEJF0XIP/mInJriyiewFeqF5tEuoD1T5lDEz8zdOkjNy01I3RP7kqQWMlO3+A1NU+zptLuHH/8tl+2OYg7TmhATif27G6XOzFophMHZTbAvbCWzTL7di/QE1OQniSXkaF0IajcxLZT+5zgkxUfFWsOXC3p6cEZBQi7A0PwgMteXw6agUQgFkA1RyqCmzjI9XtG07zawS5hyQ4NjykgTXSsCH9usKIlRQ== 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=ObxXzQFhjjaq1HSh3InarSZnaei1qz4Q8BQ8Pedp2rY=; b=OvfCt5aj/r936Pf5piQIhkZRXAAWvPnsWmqEKplzazCsdn4WUYHWYkPtQcD7p5hIDou2VQjlic2cv9wZsok/j9Ff4DnJNzAVbP7FAKKt0WSyIkkAnVPL6g4CtlR0BiszDlOrXxpa7zOYV3BgsrJCmO72W/1efmy2qyli7WnB+0I/b5X1tjEq7gjOQhBMAmIi+TeNmPIMvhelztmZ0RCFLtN76O95X9OIYRyiGITqCl8L1Zm/15wofmwfUVvNQNVJwkNFnI5ElOrnT5TDWNLlUEcYEOVbPGoStzyzKEi6soMyZULfjyX/WDQOItbH9AuSRh9Pkt6WTkPEFp+3jUSUPw== 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=ObxXzQFhjjaq1HSh3InarSZnaei1qz4Q8BQ8Pedp2rY=; b=PEnu84LmDHhqsymqY2ym1EDwDTRfxgnbK0hzPVTH2aSFKhEw1IyJs0lpaU6t1hmMbiV14ZYY3Z/gJN445Z1TE/kEUFxHPSIrijbZuV7Y1Z2szUMzacslM+cQPtNDJbn50bsKcGdheVcdu6qgU+WKrbv/3Kpf5dBukgdiawSKyuE= 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:16 +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:16 +0000 From: Frank Li Date: Mon, 15 Jul 2024 16:29:50 -0400 Subject: [PATCH v2 1/3] dt-bindings: pwm: imx: Add optional clock '32k' Message-Id: <20240715-pwm-v2-1-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 X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721075406; l=962; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=N92j78PF7Ri+PngaXFFDMFFV6SHAvWi7UZCRPNN3Jsc=; b=sb8L0+kcfVcFhT6/BqjkO2Vsduepsk0r9dTSApE9oKrhLUT17iTIpAN1JMJssq1A4MIg7Aq3j Ha6VlMf/uTPA+HAX/ZRVzt8Cywjd88a+koKK5mHmAR5JX6+DgoJKiPR 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: 08769747-cba9-45d6-47d2-08dca50cefb4 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?+U2PqdkVUwb2hS/Mldu5yKQtupCAFT5?= =?utf-8?q?RwMsjdfNvCLrbX3dWN0PCSRTEOloZZYoAH5Br436ogO2l35Wkg5OYywX/h/Zn2RN8?= =?utf-8?q?M5ll0L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+FUA5i320w+UzGFRpJzsgVmUfyCYjuUMArJPpbxYPDojntJ8fP6dv?= =?utf-8?q?cBytpfDBxrmvDQ/uQPBXqq7J8XP4M0e1kaybLl3nO4MXaDbnxGoTy+SDOb9YWoxQ6?= =?utf-8?q?oQOPdP+Xk71ETOq3J7tyMrBcJhr7t1B2QDf5QXNbwtqae2MPqpFctmH55BBt1DusS?= =?utf-8?q?Un2gEGBP/WIlQkowlljOF+Cn2DeWfLjoS/NlowAOCNre73kSDBtcmgif3TbMMkaTu?= =?utf-8?q?qsCCExKm+R8xwRvWPSEwJe10d+4jgdB5SgPjIbUyRDc0FDCgkKBpUdHI5Px5c7Y/z?= =?utf-8?q?REhPXa7IIZI2IePrJdHUQxZtgWF64m8994uprqc7Y9pP0Sp6U/vE0+ynqNqm4wjEB?= =?utf-8?q?lZRwX+XzYbNzxTkwd9JTuSSTFmqQGzZ7Uw=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?xuzOco00xlhgKcK30kQjD161b+v+?= =?utf-8?q?69MjfE7Ecmt/cgw8NhzlfNdHHDVq3y7BlqAiKQxaVFDBKh0iW/rtSGWCOBhweLyyF?= =?utf-8?q?Dh8cKXCHxzx2SiFvHFTJinADhg3jBF9LcCTTfuSAJBkr3XEDax4iPJrqUBdDksFXR?= =?utf-8?q?fZW237qwS8POvrN2kL4RAQImHg46mO0zjzdtkcAK93ZR3HPKnAAr1+GWPTo7C3O10?= =?utf-8?q?sSsfWVjVzXSlwYxdirjLYlszvKPMSqcCfLdnn7SMvHlywJQlEOafRxaEp+OFI66x2?= =?utf-8?q?S9ag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GxyJbhYgn/vFOCzPRWNYU0ccMVrAzwDNJynhyEhoCb6vklOxPJUuEerj?= =?utf-8?q?rql9jYnxFey9Y1kVMOBT73jWdVZJjFBamxzZwQzbq+f+pXzoA6UJ4HPerOAK8RAvq?= =?utf-8?q?puwEy1AtHrSBK/2DE/ZUj22M0skAFAHfijaTE4LKQQfBDi4ApEnQMohBO/biAEFEu?= =?utf-8?q?T6tdQ7zc8P3Ut7jE5Eh1WPxS+0J0DM9bArWKNgLH1UOIm+wPxT49vKuqC7KoAKxPO?= =?utf-8?q?Oh2PStm1kcLalHQjEGswS6/CdNuGrz5t9kbnSbctqWFESX6w1Qz7phqPoBm9BXrL6?= =?utf-8?q?oqFxxr7QdKaIOxuRxRZmzqf3VktSJ6pd2By2+9rvAKnPgJVNEqw4XV0c=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08769747-cba9-45d6-47d2-08dca50cefb4 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:16.0426 (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: Ht6rOyTDca03yTcHbb4LR3M4X6USDW5a635Q9ct3JAOoBRP8dGkelDvOLRzRgN2WG5wWmE+uJwlGa7dejWn0FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9253 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_133020_215446_305A8C50 X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. 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 The pwm in imx8qxp mipi subsystem require one extra '32k' clock. So increase maxItems for clock and clock-names. Signed-off-by: Frank Li Acked-by: Conor Dooley --- Change from v1 to v2 - remove compatible string fsl,imx8qxp-mipi-pwm --- Documentation/devicetree/bindings/pwm/imx-pwm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/imx-pwm.yaml b/Documentation/devicetree/bindings/pwm/imx-pwm.yaml index 04148198e34d0..bc6991bd466e1 100644 --- a/Documentation/devicetree/bindings/pwm/imx-pwm.yaml +++ b/Documentation/devicetree/bindings/pwm/imx-pwm.yaml @@ -51,11 +51,15 @@ properties: items: - description: SoC PWM ipg clock - description: SoC PWM per clock + - description: 32k clock + minItems: 2 clock-names: items: - const: ipg - const: per + - const: 32k + minItems: 2 interrupts: maxItems: 1 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?= =?utf-8?q?CErI3ZSN7c8pyuFVqxhjg+ufl9jLoNVkx6LlwNSuLi8MpYpJaDR+8d1mwqRLV8jq/?= =?utf-8?q?I3Ip/+b/d1edH/QdiP66VJTi0K9EbP1kNqILwcE0jADHRMRRIdqWat/NXPGb2oUhK?= =?utf-8?q?Ix6lGyIFPRf9x9YU/Gy2R2YiBF/VVPuEGomJqM49536OKnon5tefBXk31qL4V4hye?= =?utf-8?q?T6F0OFN/bywuB4raPwgiEbGNaC4eE5aKQhIDGGrcDWb2r9MC6oLAQFAiTDKirSzo9?= =?utf-8?q?c3DlvwmDAQx0XWaBoPBmUxMV2qBPeu19i8MOIVsHoZn0SSvZh//PxI4vSn7pO4id3?= =?utf-8?q?O0Q1bW6+urG2UmqMOO0ZHlRoUxpLH3HzryCiCeS3PRWBnKa8ejpKS9b1Cx3bVBV6U?= =?utf-8?q?p5G0z6eHE7mjg+wAo8+0kPQOBb5O7SvA5wS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iLQ=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?sK0YShqDxmnxRlANoO4c0z998URRxpgtYYG3Rva643ViKPtke82f6TXUZFoq3H6in?= =?utf-8?q?KQxvyO9ayq6GabyGeObgJKy/eu6F9hboss6HmF+WJUZbtjopKRp7xM3ZyI1+ERsql?= =?utf-8?q?gC9y/eaOkD6/C82LXJT1u0uqh4fGZYQLUDV6g4Ba4fEzrxfJ1JbZTnH0EZdrUvMCT?= =?utf-8?q?XA8vIVIpxQrTD4T09kJa9XvQC2fdmZnBO0VjuTJln6OTRnCzZKEi6UNkEOCwryYpp?= =?utf-8?q?OfymmvTNOc6VkiYRPe9IL/wAYHvsef0rvagOu8GeXI1YJO97g5jAT9+ICBNwU/bzP?= =?utf-8?q?K9oGCuxgmJbAu1SU/lmS1g//UXNFIqXavxLQfLei9760EFoIrYFAGnTmL1SbWgt1Z?= =?utf-8?q?HPPJB3i4uJ+6qo9e0jKMKpz3bZsyX5qYi6jmD597zXmAYjtNnXl1ADI/PI7hJcipy?= =?utf-8?q?IsyczOHtau1GYavLvPOWDu+1gR9+eJsKmnWYAV1c+huKjlNSYIt7IY3nPnxqRsmxA?= =?utf-8?q?tDtThCJNolPFgcXgqSUVlYkupHOoldUrVTvYY44aRpfCqIkSJ3/S4u/4X1Pa/uk7C?= =?utf-8?q?dtWCDKytoDeZUzM2u2/AtF4QHGYTy52elbtKUXcTioyq9UtJ6egY5ij1ov7Pm1a3p?= =?utf-8?q?PMa1wvPIxzj0+tpTTGpumQiiIP3I4QKHrBPwjKQq2oWjk27pfXE33QfgDfn4Slr5B?= =?utf-8?q?S41WmkzV0UbOkHbqR1kiqgvu1dHUwxeg8j/UEYAl401fn4prttpePze2lhuAA2+q2?= =?utf-8?q?hRD0JntBLtg1PkJ1zp29XlQ2umOZlqHmXgBw/m+FvK53E/yMDEn83WWne1ZO0oCOe?= =?utf-8?q?GwrsioAc8WoA2ImfJSXjOWo96UBerOf3TvLtsDE4tMujSfXLStBPwgpUuSxZ5FCRb?= =?utf-8?q?uj4yAlkz8YAFPO6mIrEQ7LKjy9irO1qtuOR/fJYRihbypv2DMA4qrUCf5CQr5YM+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); From patchwork Mon Jul 15 20:29:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13733891 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 A18E9C3DA4B for ; Mon, 15 Jul 2024 20:31:58 +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=Jjq23hHJmyANEWygqMGhoMyEohbY3TN4P17gWnY6onw=; b=qqvGx0b5X4OTL2ujXJdmpn9L6h PhUAA7CFjp/yifbFby2GsX2p7DW0fQKc+UpIFolCxlsORtWk/LIUsGMIkxWWjKM3rq/I5zleZG3bW LqTaFkunMEKP6akb6l1CbeN+rP8Xh8PasozIx2jzMRZBHJDlUMZRk5IQ9cpq88McMGWQHo/g+pu0H MBW+WAxTc4Mu7bJ2UaDAeBcG6q8t1VbRFLS3TH2Yb7siOND5Vsk7aZc8ECMth5Pzd4g3dINbOOlTt ZIK8AtX+V+20e+R7lYsQ0/qPhbwmoItFe7M2fJZVkn1EOx9vfHRR4yMxBAB8rniTEsuGdJHZb5Wbw dOXxOBVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTSMJ-00000008Io6-1GQO; Mon, 15 Jul 2024 20:31:43 +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 1sTSLD-00000008IEZ-2zRQ for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 20:30:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=swz8MBfOq6o1lSmvHfl1orzhaOWLweivMWKZc9mn2/CjQzpbpwgAGngV/Mm0ZjE5qAJ+rLkzt5YJkH3QHu/HriTL0drC/Kmc9sA57MOXl1eJj/vxblgL+ORk0sMpy6i02NasPJfnZFLz++DwtK3BaKn+ca1MA61OWd4dp3+jZoZG03ETzPinzchC85LQBkoTLGUjPFGI7fPawBcRMnx0P1mUSSlwR5DvOZ5PS5lKSouFmZ7VDeh+8mvAqLLnpNb1DMS4w6x8zNgP4c5zcR2L72dCYgzixWJI/SD3fdfvmPLMVdyWib6UZFO3+e0IcfrVBFCm13eNFG0zt79QL6EIDg== 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=Jjq23hHJmyANEWygqMGhoMyEohbY3TN4P17gWnY6onw=; b=T5+E0UC73IGv2w+Hs4ClRrnXf4vwgkpRSIgV5cUdud8Y+Q1lBMTitfdw+RDO5X9nRg3do0yKp4IxcIeVi4nRmHqvt6J2ZSDv9luG2Q3ird2cnTgOwTdg78bKHGSYu8S3TGVD0UTmNeEJoPGIHv5RyEHs2ARHBrF2jPv95g4y8vRdMBedeVboUNx5IR2imTv/ydC4jb2qnf5DG9F/X03Ctw4MfpZLrdDecgQVQizzhaw/ma8CL0Z/KDJS483FCRz4YfevrAThU5iy9MElcq+YfsQ0Snrmp0dlsneWoKjMBCbPv4g995G7cjz2Ok0AzVmNjOd/uHeuaS5V3t9igUqKNA== 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=Jjq23hHJmyANEWygqMGhoMyEohbY3TN4P17gWnY6onw=; b=f7oHbCkR4SIjbcBiTw42ln5vBr5BePME3nkJT0ptpAp1iOwcCbx0Tg4A3wSeBz703W2mGfDChmmuBHH9181FdFL81kgnyvW/6x4W3t+eqwaIITa9+ppTuiZGSFT6hwSrwFaoU3Z9b8LtBVbW3SPEYQYKbtUhK9WJTIZDime5MVw= 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:24 +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:24 +0000 From: Frank Li Date: Mon, 15 Jul 2024 16:29:52 -0400 Subject: [PATCH v2 3/3] pwm: imx27: workaround of the pwm output bug when decrease the duty cycle Message-Id: <20240715-pwm-v2-3-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 , Clark Wang , Jun Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1721075406; l=5471; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=2Fx4wXwCrUhiTONLxXSADi3uaxoZ+vACq4nDfpp5ot0=; b=DkA4Cq/DwLbRv7Lq8zNAJMA/ORNaYhHBbvql7FyI/3BKsWbbeYyq1iGI8D7aHfcDDhUHuTpX0 Ywb7pJ1+n3VCXJb7qScGhF+KBbbZUi/VLwNrHOR+du2qZSTXgbUXTOJ 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: 7e38e6e6-af66-4821-0051-08dca50cf4df 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?ME/YN/ljdzVpKo8xh6Vu6UsCJRU9D9L?= =?utf-8?q?aJ8kV74eEV4SPNzEBkKw9dpet6GnxIKnF0EhRAs9xNFLtkq/mxAbZho6r39/vzdkV?= =?utf-8?q?GUznVu7EEi5BAJUgIBiLr3zxnwSsMvIxxqlr3KJscn+IPC1Ce/4CtmuvGiquFAbP6?= =?utf-8?q?QEMu1T43VqkdIi4CdDXIYyRGPoAKBwAORBg5WdOc7vfLywnWWwFHEuXrZmhePizT6?= =?utf-8?q?q/df3nUXQjG7BtydebwP3OeYJNbpIRGpUt8vPJTTnmzXD9Al8ZB+ktpmEhGA14YYC?= =?utf-8?q?PJU2RM0O+V4P8G0+dU0oAX22pFN8FyoRIHYhcFcpRs29Cl3cUrHxh3UX7LhMwPMH6?= =?utf-8?q?2sBQos9vFxuSyk0GkVE+KABBZM8jdavU2ChPTkH6LR9kiW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Y3lt2m?= =?utf-8?q?bINURgUPMJzzKu2zBFj3PreaUZ/jxdt3cjeHIolAVVG9fymcC22eg8vw=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?gJ09xudpznL8UAZF0V56lgOan0BV?= =?utf-8?q?L6IRdOhCa219I0fL1kF+fZB/AKP73S0CUZL7kF6ajG7CAMHCbb9rJ489Yj4PISMiB?= =?utf-8?q?4TTaOkhaD+P7hwSowNvUUrk7Ceq3zBWX2LbxyJd+BRqI+Sw4c40ik1HEs1Jwq4Ef5?= =?utf-8?q?EF23/fUjOT5UkykVg2XQfaJwkZ5k0BqLZF1eXjtNW28D3eMENfZS/e9PYs7xY7izu?= =?utf-8?q?J2MH/YH2COFodoxZ6P++1y7kRRiwfkK24uvhaR+fDtAhWbsiBQ60NYEyC2JbrlPXR?= =?utf-8?q?HKZQQSLniSpiz9VZp1T4dlQW9YnUkRA2Ob305RyMO+UamRsouZ0Pyf+qPylyIk1eL?= =?utf-8?q?cUfsEJq9FQpeuTT/fIsOl8ljLMz823wVXPinnd/M2Ad3rcwCTkxa41i6xE7sRoPyS?= =?utf-8?q?bn+TPsXgKWk5cw1Ql1ha152L87xFruwv+7hdx5xunQp0rFdWFnYTR/fL7C4bkWhbE?= =?utf-8?q?nVs0XhsGwB9YYtYQf6tx9vq3bWqRI0QWTDsnSdSj3BT/QxCJD+L3glGPPqDA/toI4?= =?utf-8?q?GAQ28Fc3UxrP1L9spQl7JPSSLni740l5ZLoW33a/1g+IC8x7vJA7bB/E19LKve5kV?= =?utf-8?q?iu0cIamYYT4zS2z85BoTP3zOGU+gEkbJ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BTFbMjnE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e38e6e6-af66-4821-0051-08dca50cf4df 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:24.7227 (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: ph5i0N4E7n7ByiALahESR+KlS6Otes+TLC5jyUrszfPjbKb7liT1ckUe2nYjunndnWkUvIc6kkkY2m/0B9gnCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9253 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_133035_851802_CCBCCF04 X-CRM114-Status: GOOD ( 26.56 ) 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: Clark Wang Implement workaround for ERR051198 (https://www.nxp.com/docs/en/errata/IMX8MN_0N14Y.pdf) PWM output may not function correctly if the FIFO is empty when a new SAR value is programmed Description: When the PWM FIFO is empty, a new value programmed to the PWM Sample register (PWM_PWMSAR) will be directly applied even if the current timer period has not expired. If the new SAMPLE value programmed in the PWM_PWMSAR register is less than the previous value, and the PWM counter register (PWM_PWMCNR) that contains the current COUNT value is greater than the new programmed SAMPLE value, the current period will not flip the level. This may result in an output pulse with a duty cycle of 100%. Workaround: Program the current SAMPLE value in the PWM_PWMSAR register before updating the new duty cycle to the SAMPLE value in the PWM_PWMSAR register. This will ensure that the new SAMPLE value is modified during a non-empty FIFO, and can be successfully updated after the period expires. Write the old SAR value before updating the new duty cycle to SAR. This avoids writing the new value into an empty FIFO. This only resolves the issue when the PWM period is longer than 2us (or <500KHz) because write register is not quick enough when PWM period is very short. Fixes: 166091b1894d ("[ARM] MXC: add pwm driver for i.MX SoCs") Reviewed-by: Jun Li Signed-off-by: Clark Wang Signed-off-by: Frank Li --- Change from v1 to v2 - address comments in https://lore.kernel.org/linux-pwm/20211221095053.uz4qbnhdqziftymw@pengutronix.de/ About disable/enable pwm instead of disable/enable irq: Some pmw periphal may sensitive to period. Disable/enable pwm will increase period, althouhg it is okay for most case, such as LED backlight or FAN speed. But some device such servo may require strict period. - address comments in https://lore.kernel.org/linux-pwm/d72d1ae5-0378-4bac-8b77-0bb69f55accd@gmx.net/ Using official errata number fix typo 'filp' add {} for else I supposed fixed all previous issues, let me know if I missed one. --- drivers/pwm/pwm-imx27.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 253afe94c4776..e12eaaebe3499 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -27,6 +27,7 @@ #define MX3_PWMSR 0x04 /* PWM Status Register */ #define MX3_PWMSAR 0x0C /* PWM Sample Register */ #define MX3_PWMPR 0x10 /* PWM Period Register */ +#define MX3_PWMCNR 0x14 /* PWM Counter Register */ #define MX3_PWMCR_FWM GENMASK(27, 26) #define MX3_PWMCR_STOPEN BIT(25) @@ -232,8 +233,11 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, { unsigned long period_cycles, duty_cycles, prescale; struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); + void __iomem *reg_sar = imx->mmio_base + MX3_PWMSAR; unsigned long long c; unsigned long long clkrate; + unsigned long flags; + int val; int ret; u32 cr; @@ -274,7 +278,53 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, pwm_imx27_sw_reset(chip); } - writel(duty_cycles, imx->mmio_base + MX3_PWMSAR); + /* + * This is a limited workaround. When the SAR FIFO is empty, the new + * write value will be directly applied to SAR even the current period + * is not over. + * + * If the new SAR value is less than the old one, and the counter is + * greater than the new SAR value, the current period will not filp + * the level. This will result in a pulse with a duty cycle of 100%. + * So, writing the current value of the SAR to SAR here before updating + * the new SAR value can avoid this issue. + * + * Add a spin lock and turn off the interrupt to ensure that the + * real-time performance can be guaranteed as much as possible when + * operating the following operations. + * + * 1. Add a threshold of 1.5us. If the time T between the read current + * count value CNR and the end of the cycle is less than 1.5us, wait + * for T to be longer than 1.5us before updating the SAR register. + * This is to avoid the situation that when the first SAR is written, + * the current cycle just ends and the SAR FIFO that just be written + * is emptied again. + * + * 2. Use __raw_writel() to minimize the interval between two writes to + * the SAR register to increase the fastest pwm frequency supported. + * + * When the PWM period is longer than 2us(or <500KHz), this workaround + * can solve this problem. + */ + val = FIELD_GET(MX3_PWMSR_FIFOAV, readl_relaxed(imx->mmio_base + MX3_PWMSR)); + if (duty_cycles < imx->duty_cycle && val < MX3_PWMSR_FIFOAV_2WORDS) { + c = clkrate * 1500; + do_div(c, NSEC_PER_SEC); + + local_irq_save(flags); + if (state->period >= 2000) + readl_poll_timeout_atomic(imx->mmio_base + MX3_PWMCNR, val, + period_cycles - val >= c, 0, 10); + + val = FIELD_GET(MX3_PWMSR_FIFOAV, readl_relaxed(imx->mmio_base + MX3_PWMSR)); + if (!val) + writel_relaxed(imx->duty_cycle, reg_sar); + writel_relaxed(duty_cycles, reg_sar); + local_irq_restore(flags); + } else { + writel_relaxed(duty_cycles, reg_sar); + } + writel(period_cycles, imx->mmio_base + MX3_PWMPR); /*