From patchwork Thu Jul 11 21:08:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 1959533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=W5xEZhXh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-pwm+bounces-2767-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WKnRR5kv7z1xqx for ; Fri, 12 Jul 2024 07:09:39 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0FAE42822E1 for ; Thu, 11 Jul 2024 21:09:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ACAC19F470; Thu, 11 Jul 2024 21:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="W5xEZhXh" X-Original-To: linux-pwm@vger.kernel.org Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011027.outbound.protection.outlook.com [52.101.65.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C5F019EECD; Thu, 11 Jul 2024 21:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.27 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732171; cv=fail; b=k67EvO4VIx3SoGY8stx9LOJlKVGYW2Z2RbwLO/xZYzcaQCvybbZmnWc6snpdzqLCX61vs7lZhxl/esZsByBKBu07cQe/uhSNkiqkPAjJJGsnKmQHvCicEIBb+K8dRN3N8E2mU9M2DQFQxLppt13CTzueIEw72G2/3MqZb+L9rtE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732171; c=relaxed/simple; bh=SukjBIaNSW/e729qbf5JpQTbMYwCFShTM/ToQZP4/UA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bLD87y7FFNHuKMkInEeL2viX785PrjmVsDicXvRxbEPb+eNxc+PwNdBROxzpzghjvnVQA4jsK0xxMSKUCq/of1k49C0EKyI24shOgWv+Q9EwPeusQ6bHQvpTFSREjY92asu11TxXw+/mf/a/4z8+IqZHEQsD6o1q59y2eCyirGI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=W5xEZhXh; arc=fail smtp.client-ip=52.101.65.27 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zj0pzInf2o9YSUOWgwSjns8wZpG3iIrVheAfiTY8zsk70ApWstYp0ui3/gwJxRdrprnsfU+nGbYx9FBbie1ATfBxBJAC7mol6F2siy6sBolfyQSJhjMY7SbmO0KTrGQUMY72D0n/8Vztz1r1iatqJq065VyEDJAWJh6gFcoXRH/thkhzYc1aydiJVHFjkqjDRMAuocp22AkwfNRHJ+EL0DmehzpEb/r9NLHFrMMmXa8opznqp4KtXjWyoRNd9VI7wJcg7DJCvwfJII3DhuVmLHVvXa4c9HcOZ5j/mlFWgSXdxtW9L07VeRN2kb8+Dj6f6qxSjsIfvdbPB7OUdPqYaw== 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=N3wgiv55bGTfOHOPNaZ8OcwIniNnhTra6dIIEaOh+IM=; b=NnNLGAl2tYH976XKuqTjjm/SeR2OjuyDD/E/8MjT5AfwIgET7M646kBxoTDwpEcpk/kTmEKiuGzLXd+g1QXdI+8fVasE0/NPyLwJmgcv/8CXPlSbe+gCAWNxby8zcAHxhOblpY7eteq6nr4QctUiRqQQtgjzwJpcGoy0YJ5AfgK/eM7+jiW6x18uvNpgyWsTpkFASNGWr6iJnPDklINcOAOVdw5QskD25Sun6/294O0zGx3LvoduXPbE6hWOskcXnr5wb0weSCeC3k5OsYWz//dRu4ECqgBfZHYugZkdZnbEcZA7i/z9crnIxD5edf++CBdRCSL3hbHhbjtVaiGE3g== 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=N3wgiv55bGTfOHOPNaZ8OcwIniNnhTra6dIIEaOh+IM=; b=W5xEZhXhMOdE5yNM3ZyI2CLEvwvBwwlMpYdc1tofl/ECXgZ/abdMDyyZDWxh8z3LeR0Y9BcT503I3SxvIQ9+957I6JeYhXIpftYaRbZklvXFKp7H/9Hmr0gtshvtRAJDTDAcruaSPWtXIF0g34zWbZvHFx2TNmreqwVF3QKolrI= 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 AS8PR04MB8753.eurprd04.prod.outlook.com (2603:10a6:20b:42c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Thu, 11 Jul 2024 21:09:26 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7741.033; Thu, 11 Jul 2024 21:09:26 +0000 From: Frank Li Date: Thu, 11 Jul 2024 17:08:56 -0400 Subject: [PATCH 1/3] dt-bindings: pwm: imx: Add compatible string imx8qxp-mipi-pwm Message-Id: <20240711-pwm-v1-1-4d5766f99b8b@nxp.com> References: <20240711-pwm-v1-0-4d5766f99b8b@nxp.com> In-Reply-To: <20240711-pwm-v1-0-4d5766f99b8b@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, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1720732158; l=1980; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=SukjBIaNSW/e729qbf5JpQTbMYwCFShTM/ToQZP4/UA=; b=zpZN2XpE/CiIXIIAELnRcV+y+Rz6xSiVsQo2IWWefHTbBaWyiRnnmaXoLo2cBiRS08bYonl1H KqhBTJOQ6PRBbTEYfqsRVR8YQMIAbZPogXmQ4hHVfMSkEddIa9QLoxS X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0234.namprd13.prod.outlook.com (2603:10b6:a03:2c1::29) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8753:EE_ X-MS-Office365-Filtering-Correlation-Id: f006fd3c-5fc1-4604-c85c-08dca1edbecd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KSVE3EH2OC3Mbe1Vhm6zQRY2FmF/jCE?= =?utf-8?q?TbpBdxAZa+Dw05DwQhx7jIg0ftdVnRYHaAzhCpywASEChjMmNWU1OjRfX0IDstQOJ?= =?utf-8?q?mqWpUJxfz8x4PjDOkK/VG7Ck6At7vghyWX2jtMWaoIRL0HiVsCGZ4yMTU7ICJW7aI?= =?utf-8?q?G/cY6kLK9cpPtrXJiTmLlRHxnomNIoksSY0PPBViymZVubrPvZDNr3BvEy10Lgstc?= =?utf-8?q?/w1y7FxFJlGqzzAoy8dFpJj2eq40rsVZWI+G82vppUrF8lbOrF2a1fv1xgVPki8Yx?= =?utf-8?q?KabU/L55mQzhIQacB51Xir+TQ7n0Jn3MjB75QCE/pieKKXmBHVB7ashu9Y590vea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AkncW?= =?utf-8?q?FgVVDcPyDlTa0lukk6xnq+8EIT1Gfdj044Swghnqs+mCHWTtiW7uukJxwmSTpzhgS?= =?utf-8?q?0Gqf4x5+Mqs+25Q/AmnQf0CYjnDDYp8z09wly0ZPMYpJdA38gJ2Am3wJFr1ZNukVk?= =?utf-8?q?DetzEoe4gXf/0CdbtevrKxRfMbvLNP6OrQ=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)(376014)(1800799024)(366016)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nT2Uz+FmqMcPjKRKjWAoW2oVtN3c?= =?utf-8?q?/mLA5yiIY7ttj0zcUuKc6d74sROsdS6z0n1xS42QYu4nToYcF8JdjTvUVN1geSkmN?= =?utf-8?q?GNKGTRmV/fmEXsv4MUizV1IDM3r89RzaSjj11sw+jlDEnDRki5cJm2ddM7pedUvuz?= =?utf-8?q?3qsfUPcN0BfE+xEQqbIm7DNal84yA+VDuWF1atE4x89QwMeOsNkU5SlTHhL0mTLlu?= =?utf-8?q?Z6SI1FavYofbKSCyZDZIPQV/C8YN5wxaJ1YTM8aT5eysvYByA5iHkeNPawgMkaGTU?= =?utf-8?q?RMuGJNti61V8zYU2Wjcn+cr/p4uD1DOiES0mnnUmK3NXQSbORyiqtzTwhYfHIVcOI?= =?utf-8?q?dTwqzoZLNPViFpHwUJrIeJvOt61QUxmSHJNjt11DQncu9AkcR+UR+wbM0/OI4Ybn8?= =?utf-8?q?ySuYYUv5VYHVqN92zuvsO3m9VUIO07a7o9zJzGp72TsSzYDWOLefOpREkyIFE4XEM?= =?utf-8?q?MPfcYX0w/oi+32IRSINIBOW0k2Sj0zUucGIrgzeKF0TMjMd2p3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ekm7j27jYqS+C?= =?utf-8?q?yS34Z//7vWaqKevQBcdBSzo5kN2twWjYlELLgJ/xgbACS7EB9/ifV79tTGFZBamAV?= =?utf-8?q?zavuMPu2j2rIjCo+BUg9CvOu9QBwVbFX9+V+puHdCKDK+nHdGpozRLEoNGluyQFKu?= =?utf-8?q?lhig5nNbhqO3?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f006fd3c-5fc1-4604-c85c-08dca1edbecd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 21:09:26.0934 (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: cX6RiFVI1fM6anXixAK2+KJPZ98pjJzqhB8LNXHNYHEmJkvm5yqV1ItiCKWvU7MCNYfaq0z1j3Ms0HzXWS9X4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8753 The pwm in imx8qxp mipi subsystem require one extra '32k' clock. So add compatible string 'imx8qxp-mipi-pwm'. Increase maxItems for clock and clock-names. Add allOf check to make sure other compatible string keep the same restriction. Signed-off-by: Frank Li --- Documentation/devicetree/bindings/pwm/imx-pwm.yaml | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/imx-pwm.yaml b/Documentation/devicetree/bindings/pwm/imx-pwm.yaml index 04148198e34d0..750636985f937 100644 --- a/Documentation/devicetree/bindings/pwm/imx-pwm.yaml +++ b/Documentation/devicetree/bindings/pwm/imx-pwm.yaml @@ -9,9 +9,6 @@ title: Freescale i.MX PWM controller maintainers: - Philipp Zabel -allOf: - - $ref: pwm.yaml# - properties: "#pwm-cells": description: @@ -42,6 +39,7 @@ properties: - fsl,imx8mp-pwm - fsl,imx8mq-pwm - fsl,imx8qxp-pwm + - fsl,imx8qxp-mipi-pwm - const: fsl,imx27-pwm reg: @@ -51,11 +49,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 @@ -69,6 +71,27 @@ required: - clocks - clock-names +allOf: + - $ref: pwm.yaml# + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8qxp-mipi-pwm + then: + properties: + clock: + minItems: 3 + clock-names: + minItems: 3 + else: + properties: + clock: + maxItems: 2 + clock-name: + maxItems: 2 + additionalProperties: false examples: From patchwork Thu Jul 11 21:08:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 1959535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=Sme1C5gM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pwm+bounces-2768-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WKnRr4fjJz1xqx for ; Fri, 12 Jul 2024 07:10:00 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 49F191F225C1 for ; Thu, 11 Jul 2024 21:09:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD5EE19FA6B; Thu, 11 Jul 2024 21:09:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Sme1C5gM" X-Original-To: linux-pwm@vger.kernel.org Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3D3E19EEC7; Thu, 11 Jul 2024 21:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732175; cv=fail; b=P7otinCBsdCmvKUHF1XKcyL6/k9HtxSKjdXbHW+T1jizwh5JQW2o08rkWnwf3ZgED69SIe4uNI4QhTPM6SGEyLwWeH3g2NNKH87Khlfh0GNblmP/SJNRAtEGewn9Aeikn0gBVXZoW/j5sosaO7OQiiRF+vazyghZj0wu406QgA8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732175; c=relaxed/simple; bh=V4/JiROHKoMNNWNqxA5q5eMS/NJIj1fiSgLqTWOjo8Q=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=eYw/lvuJ0S9XyvgWVunuF6T6f8688XALQ19e0ZO75YPZ2ymMM6SzDtgpdytB0hx3E5eOIAcCQDUhyxiSEP83zEkI65s4S6mrz2qSxpSx62+UA3B1En6mcnmi57CNyJjTjfbq16VIjBNNgEBagBsqJTkiHTqgkoOM7t0fNx05XI0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Sme1C5gM; arc=fail smtp.client-ip=52.101.66.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xVJavxpesJrK65FZXb8CkWYStoP4zVCwKnwnuaVqudF9tTIlIVANT9cgV4pXeKIgf1DsPh/m5omKFwH6f5LY/Hw53fX7DMjrw4TUMKo8FzNiEiHphlQm2vCGev3dfCR9hGQt+YPCOQWu20yOwo0wTUiLRWzdzn/wYCvDZKWjOgKu3CTOhRs9+003OYttNlMEmfXxJStafMU15XddICSkC19Lr+X1LJDPTzwFkQqeI8hEfFxwkm3DVeL5Dn4Ti1sRd4rKDlEduhbWkpoURxI6XjqKMer/aTnLMDrLjFA/sc1zgCDu8U5rGDGkIAPR0hKQx2D1cJ/fZvbsUBhePo+sHg== 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=m0Rf+LL0Y+RBJFlfxKtCUFtRbaOB6chigoL7jGW+ZHA=; b=qbrY8yxrYdRbZeRBaDuPkJINLgv54MWLE8bYocsWpms6V4gPrYiqTyk0cq5SSBqISs0y1nntL2NEL7UmB+SX2NBeVpan1eJ29LRDdcAerGbP3CNdLYeuYDBE8K6/3l4NxBGhVTXiEAXjLRcvt6swYLT+P8U/H0f+iyY1ScS8V/0M/BXrITLQGHRUD51sgu18aOtbIylLi5z3P6aaFzinyXwiD8F8d75TeNYEbtZdRMTQFUogsNpiDdnlSjwIBJmWyLrTHv8ctux0nLLTHahzLJlWSNVTzaQardsI2unObHeWHPCF9MieC1QodFY22ESyfvmtwgo1vjU0wACJsAdnyQ== 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=m0Rf+LL0Y+RBJFlfxKtCUFtRbaOB6chigoL7jGW+ZHA=; b=Sme1C5gMxtnKhr4afQPD8HmJsMYYLJtzP62lIiH7053Zes6uu2D3CcbXXP6ZBznUmdGigzZjgKojSqJKPTO5c83ox/QFwstqRUbvV9np9F/MQSrnPHLs4XxdVC0m7ObjmxcfUv9wTNBOBhxeW0cdk6A/FfnyhRCehnD561vED0E= 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 DBBPR04MB7915.eurprd04.prod.outlook.com (2603:10a6:10:1ea::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Thu, 11 Jul 2024 21:09:30 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7741.033; Thu, 11 Jul 2024 21:09:30 +0000 From: Frank Li Date: Thu, 11 Jul 2024 17:08:57 -0400 Subject: [PATCH 2/3] pwm: imx27: Add 32k clock for pwm in i.MX8QXP MIPI subsystem Message-Id: <20240711-pwm-v1-2-4d5766f99b8b@nxp.com> References: <20240711-pwm-v1-0-4d5766f99b8b@nxp.com> In-Reply-To: <20240711-pwm-v1-0-4d5766f99b8b@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, Frank Li , Liu Ying X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1720732158; l=2498; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=T8sTYpfSEeBY2/knCkc7BNYVCAkGkq10MM1DGu+SsPQ=; b=laVB2GjlhPvVez/dCnHfiC5J2Pd70yiRPMxc+6YKUpfyC8+AuOQuegC1xFUA2oIZDMFgyEpGo M/Fx/nzRQg/DtvkeFX17voA+4+JvrNHYGOKavnjPAEMZGGWSglnUCJ8 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0234.namprd13.prod.outlook.com (2603:10b6:a03:2c1::29) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7915:EE_ X-MS-Office365-Filtering-Correlation-Id: d6248656-b608-4b00-cda4-08dca1edc111 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|366016|376014|1800799024|38350700014; X-Microsoft-Antispam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EDNEmZ+zXbG26YuCU0PrbHUivJFiZX8z5opIIvVDow?= =?utf-8?q?1OL9ZMeG+WcpdQAw+LcQh2jepMD9nVbvPZZ+vBAWUf3FbgM+lyQdcMEsrio8YEONK?= =?utf-8?q?iaYXtevMBtn76xTljtXROkaKbOJxSaOES/0Zu67GcD8qnGHPAewpfbwHQ0CEm2dzg?= =?utf-8?q?/x8xabX2WFuJ96TPZa4yDQ6qIR1GAMWnrv28KiC6pNDFaFTJyzgjqeS4wSEaFezjm?= =?utf-8?q?y4YXlmvopV+suQTuBiqRtoDZ+Sji8L/B5oWPFwX/XqmoFbIfcgP++3AQA8JcA4SDO?= =?utf-8?q?hgiR13xje2T4nGH5O2CdDIpNn/jb2E+LMZbSCEpPsj8upc0kXuUEsChaVTYeB2WdO?= =?utf-8?q?vYB8VvBuTemCyS0/nnSY0swU5iNltpS9jt2qSf1m9Iv0pSfdXEJAtlgxHla5I7eIS?= =?utf-8?q?1z2HMvP+tdUkPAhPBV1eRRwEXQ7kqw9mn5AgesWLqXCC1Qx5Jl1q9FvA1/lHqsfBl?= =?utf-8?q?I1pbVpHRpI1dZCwQuCHGI30FJoHS4o7izg=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)(52116014)(7416014)(366016)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?RXo78MiIXHvTphFlyVmF9moMzYuF?= =?utf-8?q?5sRPNDcBs8ZGDTdAsSB2m/6DH18mTcHBljET/C3OcoTGWT+nSMGcQyNJIyVW0U7jH?= =?utf-8?q?A4//AffX2PfcWSLOxzyHpn4z1Ns5pYzIl1vmM0AGem60N489r9pJc+285iKptzvXc?= =?utf-8?q?6Em5AbnMjMUb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N9McJAfv2x8rvXRP9h2amQrgCO4V/eMYeqNkTvhg0kdrS+4bNNZonvor+rA?= =?utf-8?q?TeBgxsLbpJtQ4Mfaue99ifqhv5/J6B2YpAGVmoiVUa80J4nQTWcMCJzmn4Su6ngMJ?= =?utf-8?q?HliSuGH0FzgpMsE0+dETAcHqrXnyKbOcnnJ0UXHqYvhZ0hBtj25tKblgV/mLgBjmb?= =?utf-8?q?YXU2ZJGZB6ApiTXCU9SsomueW5qf0ax5rn1utdPKHVr/0D+jthsw5JKdkx5H4kEFf?= =?utf-8?q?mDXk8IfRWdnV2vBFaMdoS2cRysX0MoKGyWzG65iY7aTRQKGx1I6bydpidFLEwmQri?= =?utf-8?q?neoGvNw5LaEF++6D1k1FcmUdHj8y4qq6XPy17XW+uB6CbJ4KosL7RMHVE1iH9lbHL?= =?utf-8?q?YRV545dUBFIdTG4lH9N4DILNFecPyUJns2pwmIiQqhtWjHFUh2cWNZxWveLXVuYj0?= =?utf-8?q?Z5oE/zZ4hO7RXGCZo9WXV6t2pPc7d2w7O+VUJjb72k8dWgNZn4DEmRHHbEbfNWHeU?= =?utf-8?q?BfyaeyRW8gPq?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6248656-b608-4b00-cda4-08dca1edc111 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 21:09:29.9523 (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: H9UB1DH+Gf1E2j91kgjYbn7bARr8SPzCTrIiqzGcC01EEahQ1BdrlVCaPf9mEPJ+56pDsApbP4w4Bj1Jyg05Ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7915 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 --- drivers/pwm/pwm-imx27.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 9e2bbf5b4a8ce..032bce7d1fdd3 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,36 @@ static int pwm_imx27_clk_prepare_enable(struct pwm_imx27_chip *imx) { int ret; + if (imx->clk_32k) { + 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: + if (imx->clk_32k) + 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); + if (imx->clk_32k) + clk_disable_unprepare(imx->clk_32k); } static int pwm_imx27_get_state(struct pwm_chip *chip, @@ -223,6 +238,7 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); unsigned long long c; unsigned long long clkrate; + int val; int ret; u32 cr; @@ -325,6 +341,13 @@ 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)) { + dev_err(&pdev->dev, "getting 32k clock failed with %ld\n", + PTR_ERR(imx->clk_32k)); + return PTR_ERR(imx->clk_32k); + } + chip->ops = &pwm_imx27_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0); From patchwork Thu Jul 11 21:08:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 1959536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=fe/Xt865; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pwm+bounces-2769-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WKnRw6R88z1xqx for ; Fri, 12 Jul 2024 07:10:04 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EDCDA1C20B1E for ; Thu, 11 Jul 2024 21:10:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D3C819FA80; Thu, 11 Jul 2024 21:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fe/Xt865" X-Original-To: linux-pwm@vger.kernel.org Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012009.outbound.protection.outlook.com [52.101.66.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 029D919FA6F; Thu, 11 Jul 2024 21:09:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732177; cv=fail; b=pJgfDScwDAlqgXaMsjkhgSGLBQeUafnmzv6UDnB4zEG2iMEkpWdF+UEpd748GCGCyUTJVSL+E2eak1Vc/01/KnN3F2Q2ed830xJ0+qLgYkKhjSnTd9Tz4Lj294wVQLM6ezi5/DhDVWEcorl/4dEzDvrwLGcPc0CTEbTnbsfYGkY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720732177; c=relaxed/simple; bh=pT8hto8jasxqRR1wnXTN31s31kljdhdkKl0kbKVulDI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=BwRrjfe83KFgNFcmLo++145xTao4b6wwEhzLrGf1sqaDwVDryXuRsEg71TmRoqx+BHDP+9mwTTAiJgyJqAqoocuuTzllP1Ega4iQTCrubfu0myBNlHUEVwwirYcSp5Qw0wI0FXI1EFu5MtVj/q90YxKP68feaF4H8SFaUYbcXo8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=fe/Xt865; arc=fail smtp.client-ip=52.101.66.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KafeuTAR3LbqXJKi44CtsyP8K2Z+XsnHCtWADwaj8O5VjpeVO7S8ZhVKXL21SgkGuJLALlom0YjnXsElR1pSx2PFER1AoASxTUxz3gDeLFaHtukMNDDeT8ysueBWgvGXODV71bwfdUG9sUaSHeq0HNng96xrO7T6btYHq/oyyyEvluwR3kaXF8rtVdrbfLFgvTiFC32JrdmdZrw2RtxbXM0O7TxnnpwyYqhkhbftxH73nAWTFkLQVIdF5ZNyGHTGhSqF9z0101qwlqdR9H6Ehi0MqvEQRbrT79/xcdle91pOz1W4xsOPR6KYeyKgNDSzAzDaQ+h1sgdi2Wbe1Ao8qQ== 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=0HgHy2L/wkqbtzM2UW4DFT752rOoDt7Q/Ojbriar/5k=; b=TWn3njzPQD8NVT4UlgHYzkBZgbMpZsyxGoc2Uy1gyeppivBoduVZKNqr1pxLMUdugwmfD+qUhGT9ML6WU4Z2GZt5Kqh1aCZEsQ9pv0Y0keGnEmcJKulYjESjPYWZ3V1xhGwY7MS6Mzzwu3M4leIgWVTJc4hyuB6yopsZ2e89wdWMmOOh0G1gJNsleWj8GW1Mxj3+AeAWmAE/rPS7hQqT0pq4ozXauKuSCcbvH68craSy1pddAyptM6gFIyQygeqTv5C5++c19y/+YlxXRvRmYSh1zKFrNeTpvOpeMIoPr6Au65SLSrjVhlHiIwLetlldKqpqIuWdKwp0wD1bFpO53Q== 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=0HgHy2L/wkqbtzM2UW4DFT752rOoDt7Q/Ojbriar/5k=; b=fe/Xt865OxgoRvns35VmkeEu0fVuZMZFDisRgtSU8TkYmc3Bc0kwAsQor+ZBHsCDBl+MKIzOW+IsRidFHyddTeBzWaiWSmQiTeB9/lEYWSXxneHNSfqKSI8j1He96Hc/QjI8Rifre7r6opbRoKBKr2/FaqX0yXZJ+TfWBcEvRyo= 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 DBBPR04MB7915.eurprd04.prod.outlook.com (2603:10a6:10:1ea::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.22; Thu, 11 Jul 2024 21:09:34 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7741.033; Thu, 11 Jul 2024 21:09:34 +0000 From: Frank Li Date: Thu, 11 Jul 2024 17:08:58 -0400 Subject: [PATCH 3/3] pwm: imx27: workaround of the pwm output bug when decrease the duty cycle Message-Id: <20240711-pwm-v1-3-4d5766f99b8b@nxp.com> References: <20240711-pwm-v1-0-4d5766f99b8b@nxp.com> In-Reply-To: <20240711-pwm-v1-0-4d5766f99b8b@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, Frank Li , Clark Wang , Jun Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1720732158; l=5043; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mKhhcEUhL7+dNPFdxDqp7YsAYZUKeNxwZ1WZHGuoG1Y=; b=QTOealos7b6dRVB6aSMOlrsvAtwiqbzE/chmVcBvhFVbo4TLav0qni2MX1J6zWcpUjURCLv3z JB4fdwQheo/Baup9p9Z5V7F6cPm8JdQ+Kv6zaHVl3UyY/KQRjQSG+Zw X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0234.namprd13.prod.outlook.com (2603:10b6:a03:2c1::29) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7915:EE_ X-MS-Office365-Filtering-Correlation-Id: 33ec8b9d-b783-4451-5505-08dca1edc37b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|366016|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?pevQEVSIjRYyO/1G4u9WmTp4JRPW6b2?= =?utf-8?q?wincgEIGTqaBiWPkHr58w/+WVZUT4KqhLf5dewLNqyeFhdiq1vDtfY63GrCR2h5Va?= =?utf-8?q?/mmpiyQm8+HFn74+zI4z3mFrES8eWSymUmUk42QkTelG1LnW9+XQoql2KOSi225ck?= =?utf-8?q?r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xq3RstDbCK03h6eYnOsA6KMWuYQfFRdwp6KLOZAGo0TJwBI9qvCdsgPQPcEyXH?= =?utf-8?q?YAa47GvogUdGOIoGbLFbIpxudmslMPydc2hqH/b/NoIq4f7xdqhMj5N4t0W/oWCtA?= =?utf-8?q?qpDAucVT9UY976NCvg/jCJV/vZLjkXSemF7AgrFriuYM78Agu/WwHbPuOEv+9zEtl?= =?utf-8?q?8RHPyeBIWrFrrGJ7hsjOd5UYFJkFBZrCotJiiOQwq9SVhNANHqDft/6z/g1O3GfYC?= =?utf-8?q?h1CZftmszzGNoLtpcY59iRE2AEWJgav2OBhnbiie+E68dMjSq0LsPuhwF3zlOEOgs?= =?utf-8?q?KdXRBf65/Wo4bezdl1vqD6sQr2gXKb74Eg=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)(52116014)(7416014)(366016)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4cHbg+ZeU7Eitt0k3nY2A+vNvAeC?= =?utf-8?q?SfE6nSdZo/+KDWeQG/N4TXxJW82op5/pvkcyYUJJgp76aVvNa2zlrpDqPVPWZSikF?= =?utf-8?q?AMwrS0QTwmTBNrEBu2AIjbyEz8W0pqXSckfVf08OJM2p98zojVKlh4S2o4wiVEYfm?= =?utf-8?q?SZcivZzHnN4KLWcoPzNsvyBmUH9gWjGFNOTr1WrtRx4u5rao0To3KbzNO/klCzAev?= =?utf-8?q?tGL1me9NJSsO2q4UYqmCfwmUqV+ZMN4BFXgNR0diRzZcnfVoIxXNTn+T1/qGQ4QAe?= =?utf-8?q?LLrbR4Fr+MXlClRvp7C0uog76tByCMgzmuUCdm/hv9enIL3soNwIdGFHzoVjQAEvf?= =?utf-8?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RmgNyFTRzyv7Fjm1PUsWDxWN4UmoyiHx0UeyYJW/K4nLeFk6iUXzqk0xtnJR+YNM6?= =?utf-8?q?tt+RJmAGJz9LIqStrbfS/FoWm66EbjfYwubXxVn87kTNbkVMY1LhT8uZP2Z/LJy6S?= =?utf-8?q?9ascVj+6mRWJYld01KzfZl7As+i6RoEF6C8IhHxdmxVGklod3vTXPVZAKTehJ2ZwK?= =?utf-8?q?Dw6Da6zp0ckxM7aVCpygbkn+mJfs+vP44kmqYJlFEO+o2V7ZeZfk9FYx3mchQKuNP?= =?utf-8?q?Epu+ME3ia8CS4PR/O8hs0XND4QTZLGkrJAPyI/XtdzeE4C24c+NAKyJItNwy4Yn2G?= =?utf-8?q?4zVJFELGx+tc?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33ec8b9d-b783-4451-5505-08dca1edc37b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 21:09:33.9473 (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: BI1YD+Ndd9oUiXpTmVf9U5Hfi0CAQn7kJEJlC5sgkK2QG7dgy2wp9Eh2eUU9CYolrUfTAVO/whprv6hSOeXbEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7915 From: Clark Wang When the SAR FIFO is empty, the write value is directly applied to SAR even though 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 flip the level. This result in a pulse with a 100% duty cycle. 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. Reviewed-by: Jun Li Signed-off-by: Clark Wang Signed-off-by: Frank Li --- drivers/pwm/pwm-imx27.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c index 032bce7d1fdd3..b817d73effc93 100644 --- a/drivers/pwm/pwm-imx27.c +++ b/drivers/pwm/pwm-imx27.c @@ -22,11 +22,13 @@ #include #include #include +#include #define MX3_PWMCR 0x00 /* PWM Control Register */ #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) @@ -92,6 +94,7 @@ struct pwm_imx27_chip { * value to return in that case. */ unsigned int duty_cycle; + spinlock_t lock; }; static inline struct pwm_imx27_chip *to_pwm_imx27_chip(struct pwm_chip *chip) @@ -220,10 +223,10 @@ static void pwm_imx27_wait_fifo_slot(struct pwm_chip *chip, sr = readl(imx->mmio_base + MX3_PWMSR); fifoav = FIELD_GET(MX3_PWMSR_FIFOAV, sr); - if (fifoav == MX3_PWMSR_FIFOAV_4WORDS) { + if (fifoav >= MX3_PWMSR_FIFOAV_3WORDS) { period_ms = DIV_ROUND_UP_ULL(pwm->state.period, NSEC_PER_MSEC); - msleep(period_ms); + msleep(period_ms * 2); sr = readl(imx->mmio_base + MX3_PWMSR); if (fifoav == FIELD_GET(MX3_PWMSR_FIFOAV, sr)) @@ -236,8 +239,10 @@ 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; @@ -279,7 +284,50 @@ 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. + */ + if (duty_cycles < imx->duty_cycle) { + c = clkrate * 1500; + do_div(c, NSEC_PER_SEC); + + spin_lock_irqsave(&imx->lock, flags); + if (state->period >= 2000) + readl_poll_timeout_atomic(imx->mmio_base + MX3_PWMCNR, val, + period_cycles - val >= c, 0, 10); + + if (!(MX3_PWMSR_FIFOAV & readl_relaxed(imx->mmio_base + MX3_PWMSR))) + __raw_writel(imx->duty_cycle, reg_sar); + __raw_writel(duty_cycles, reg_sar); + spin_unlock_irqrestore(&imx->lock, flags); + } else + writel(duty_cycles, reg_sar); + writel(period_cycles, imx->mmio_base + MX3_PWMPR); /* @@ -348,6 +396,7 @@ static int pwm_imx27_probe(struct platform_device *pdev) return PTR_ERR(imx->clk_32k); } + spin_lock_init(&imx->lock); chip->ops = &pwm_imx27_ops; imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);