From nobody Mon Nov 25 21:46:01 2024 Received: from FR6P281CU001.outbound.protection.outlook.com (mail-germanywestcentralazon11020076.outbound.protection.outlook.com [52.101.171.76]) (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 C0F62189BA9; Thu, 24 Oct 2024 06:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.171.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729752074; cv=fail; b=LjZp6qdB0MTtauL7WcIX2QyaS1c2iv2ov4nNztMx4sFUvzITj8ZdJRbcR373ShhCMqSH/58H8T8pZLxQxcJpg3Fyq1IeJnERVEMEAYEJ5daLknBqRPhGhAhPAq9omu7JxqyTyOaYUw1RQidu9lD8i3HhDUnBtmPJvAyCVftA51Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729752074; c=relaxed/simple; bh=hRNOL5XpGlVSzOq3QI/vy8MF5IWP9GTtd1XVNTAOl1w=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=pC5twX4F/ZCQlP1M1YQqQkF1ULTyeWQ+EsmQD8VPNVWReNANl/IlLEzRpSD0uhm9tUe75bAlTfwv4hN4y/7QpGt6Fb23xhfp0VnjwFmEebO9GHBS5XorJMD0KJ2T/t4bpDC52zI307Ooinuna3FG3JV6UauSVFPYvDNH/lT5VWY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iris-sensing.com; spf=pass smtp.mailfrom=iris-sensing.com; dkim=pass (2048-bit key) header.d=iris-sensing.com header.i=@iris-sensing.com header.b=XpOnYsYS; arc=fail smtp.client-ip=52.101.171.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=iris-sensing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iris-sensing.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=iris-sensing.com header.i=@iris-sensing.com header.b="XpOnYsYS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FHkFj/kc2U91aJZXN+K6cS8cucX2qQm1v9TvU9EgH77IUjk6oeR+SQdXTaLKenzvPzM+nzT2VEkfxvujVInP7CF5wqGBhfkiPok27w/k7fJ2ku1+MK9v98wMSFCZfK/DkfLnuAEBydE5OCckij9Dqvtl03Ao4NBr5SMcMXnG5DX5a7HdgGcQS6rEAfOJjFSa4fgWVDfMB19U/HM9ts6BY9icpDSc95kKARgrxmLh+yatyl2j+M9xSt7rAA+eYwd6P7mVRTtgBjec7YvnqJgX24iHuC30Orc5Hy0eZbbBeyYP6IMx99HWfjF0g6FNAxx+D0c40KGyokdSNRq0+3Peuw== 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=hRNOL5XpGlVSzOq3QI/vy8MF5IWP9GTtd1XVNTAOl1w=; b=iSdUt6ZjMlTKfuhPEYX6Zsxd0ULjScFGSSN2ZlNb4Dp8I5iCWh6ifRYruTz17QeZ5JmqxObl/ygxWQTGS1Wr1HK8M1eRMRAWc/nNYmjMkk4Q6mK+TME6XFSDUdPrOHLee9VsrCp5eKONx2L3lnrzULM1p2IWfJwQKJzETsj8ztHbekC6HqzoMCjl2QZ2cHRJbp1ZXu2o76xclG2O8+Dx/BaK4bR1+45DSgxt5gRRUhgKH6MgRVPjPuuy3xx55jkcdEaDY7EgP23dB5pyEMA92m6J5G7L2JEfSoFdfKvWyp3EGH7zZC3zjPP7s+GCy+OHDvJICSkFXaBr2ol6sioWqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=iris-sensing.com; dmarc=pass action=none header.from=iris-sensing.com; dkim=pass header.d=iris-sensing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iris-sensing.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hRNOL5XpGlVSzOq3QI/vy8MF5IWP9GTtd1XVNTAOl1w=; b=XpOnYsYSAzzgfn+tNLGAMTWyLIRcjrBAGCaIiKA3FAM0RMa7n1psUOeAiMUPyXlBY7JW3qM41C4xv0V3sLcyQahsE/FbU46/1WfuO84xgdyj3+q6pkWMsU8PdlJt8uFaKrZ6oQanrsTaPbcttEafrPHmahYrUAlTjGPw3ud4Rvd3/rIUR3+rMWNBRmjM0oKx/L4BEEoXoyhQD5wX4Z7ZXciBI17FQCJTuT5K3EUbY3unm6om26OAaOr45uUt+fmekWsiEJpvx8WTTvFVqfhf+5jZGpEP0Sx1vndRuKle5amsAOMbFyVfHbJFp9Av5dPLZ/aS2IXL9wZVg6dERPWsFA== Received: from FR0P281MB2809.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:23::8) by BE1PPFAE0A1427F.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b18::68d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.19; Thu, 24 Oct 2024 06:41:09 +0000 Received: from FR0P281MB2809.DEUP281.PROD.OUTLOOK.COM ([fe80::d685:f312:e114:519e]) by FR0P281MB2809.DEUP281.PROD.OUTLOOK.COM ([fe80::d685:f312:e114:519e%4]) with mapi id 15.20.8093.018; Thu, 24 Oct 2024 06:41:09 +0000 From: Erik Schumacher To: "ukleinek@kernel.org" CC: "anson.huang@nxp.com" , "kernel@pengutronix.de" , "thierry.reding@gmail.com" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "shawnguo@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "imx@lists.linux.dev" , "linux-pwm@vger.kernel.org" Subject: [PATCH v2] pwm: imx-tpm: Use correct MODULO value for EPWM mode Thread-Topic: [PATCH v2] pwm: imx-tpm: Use correct MODULO value for EPWM mode Thread-Index: AQHbJd+0DCsBjEpWYE6MZa3vNXpdIQ== Date: Thu, 24 Oct 2024 06:41:07 +0000 Message-ID: <91bfd0c1726d2e6d10c96a3f2e141a7315b08467.camel@iris-sensing.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=iris-sensing.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: FR0P281MB2809:EE_|BE1PPFAE0A1427F:EE_ x-ms-office365-filtering-correlation-id: 76c87cdb-900f-4eab-b3b5-08dcf3f6d80e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|10070799003|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?enVsNTRVTmFob2FZaE52ck8vaS91ZTJxei9qOVhtWXhNbkdYbVVpRXlORWVs?= =?utf-8?B?SEloU2p6VEFBNUZTbm9YWnBhSW5oRXNtcS9GYkFydXB4YVRaV0h5cXFWNmhj?= =?utf-8?B?aTF0T0hnaEVLSDViUHN2eTg3Rnd4eUlOUndNY3VNNlh2MUhBVFZRaVN4NkxC?= =?utf-8?B?cXIxcURPTldZT0VTWVU3SGs4NlNZb0xROHhWTGxJMTZpdXhnUlY1cElla2la?= =?utf-8?B?VmxLU0lGQnhmMkpsZkNRbnkyV0lNNjEveG91K1dNaE9TVXBQalBuZ1daZENX?= =?utf-8?B?UVpqM09EL05tQmhWQjBPOFVPbmtrZnJIYzJUaHdPU1o3UnlndUdWVTVPVXBv?= =?utf-8?B?SnQwWVZPR0lJVVI5T2ovTmJYZUR2RU1JR2NzMjdlOUF0bjhEbU0yW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2Z6MWVwT0Y2SXFlbGFJdmRnTnRSTTZI?= =?utf-8?B?RlcxelpwalU1aDBiT2lkdHJJVWdlTDU2ZUptRFhPV1dwcjcxMms1T2V0ZGVu?= =?utf-8?B?YjEram8xSW1OazYraWEyYkFqVTcrL0xjWnd5RWRTM3VOcXIxZGZRUVhaVjI4?= =?utf-8?B?aGR0QlJKUXdJeE1UTTV1eEdVM2dPMFdLSE9LeGVRK0Fnbzc0U1ZpYU5FQWp1?= =?utf-8?B?MElQemw4TjlwK1psRTBHQVMyaTF1UkJnS1pNbUd1aHk0RE1taEV6bVYybTJN?= =?utf-8?B?QUdkdy9DbzRNWVFzem5vRmVVdzlSemRQM2NwbzdOMUtPblZ6ZGdZdXJPdkxE?= =?utf-8?B?NHM3YnprcXB5eUNrbmE3U2RaTVVYcmRFM3ZUYVp0bGxMSlNMN1JVM2I3eXJH?= =?utf-8?B?NW10SjJZY0FtVjd3VGVYZENDUitYaE9xUHlwcllqdDZTU0lrYlQ1MVR1SVlE?= =?utf-8?B?a1ZPRm9FWEZtcExRazdwWlhBQ3pCcjg3TUE4QjZzV3hlREZsNE55RW9SSG91?= =?utf-8?Q?sOhHP3OVgcWXlD/+yrniy9sc0BQxt2r//boBg=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:FR0P281MB2809.DEUP281.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(10070799003)(366016)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?VllMYkV4ZEFDNHRGSVpQRVhQeVZncnJIeUZrMlQySFNDWWJNUlFSSjVwL1Zk?= =?utf-8?B?SkZlRFh3VzYzSXF4OHRmbUs4WVhMOHN1Z2VjS0ljVmF1dGhzZnNNZXc2dk4y?= =?utf-8?B?QllDdCtpTVpyWXZOZVcrMjNxT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utf-8?B?MkZybkMzckdCN1g4ZCtlTHNzbmFENlhkd2g0OVJXa29Fcnk1S3VZNVB6Umlx?= =?utf-8?B?YVk5VmpLZEZKZVpiQU51My9Tc1JuTUtvZGtIUDZWQjNHaUs2K0hpWHltYmda?= =?utf-8?B?MmFYdmFJcVJQUTkrYUNXb1ZvbWp3TGlYcG1VRS9qTUFjNlhBUVZ5dTUwU2Er?= =?utf-8?B?WnJ5aUpiOS9ZUjBKdjhSTzRtb0ZWQjExd2hWeUl4a0d0blN3S05lTzNKMzFx?= =?utf-8?B?ZklxcE5pU1NwZmpPbFVhY1NwWVpEUng5TTc0V2s4d05GZ0x2YVRZcEZPNUVs?= =?utf-8?Q?rGbMUzippEtUnzmqkR9qF4rBDqG7hoFisIwmJVE9hM=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <823BAD78B6D4ED45AA53C8796679AC56@DEUP281.PROD.OUTLOOK.COM> Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: iris-sensing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: FR0P281MB2809.DEUP281.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 76c87cdb-900f-4eab-b3b5-08dcf3f6d80e X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2024 06:41:09.1616 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 963f3913-ffae-43fd-856b-2dfd3f6604e3 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eUOJBSIrCYGvkB4sCYB5I9j2j72ABeVaQOwEEs8fe88dW3SDrH6arXlb2dNerCsdFlcFqs2HvY/xcK87huBkTLHhkzTdSKUvZGhRcUd5JBXQ0xGbRssKfZsn7GM7ol0L X-MS-Exchange-Transport-CrossTenantHeadersStamped: BE1PPFAE0A1427F The modulo register defines the period of the edge-aligned PWM mode (which is the only mode implemented). The reference manual states: "The EPWM period is determined by (MOD + 0001h) ..." So the value that is written to the MOD register must therefore be one less than the calculated period length. A correct MODULO value is particularly relevant if the PWM has to output a high frequency due to a low period value. Fixes: 738a1cfec2ed ("pwm: Add i.MX TPM PWM driver support") Cc: stable@vger.kernel.org Signed-off-by: Erik Schumacher --- v2: - Add Fixes: and Cc: tags drivers/pwm/pwm-imx-tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c index 96ea343856f0..a05b66ffe208 100644 --- a/drivers/pwm/pwm-imx-tpm.c +++ b/drivers/pwm/pwm-imx-tpm.c @@ -106,7 +106,7 @@ static int pwm_imx_tpm_round_state(struct pwm_chip *chi= p, p->prescale =3D prescale; =20 period_count =3D (clock_unit + ((1 << prescale) >> 1)) >> prescale; - p->mod =3D period_count; + p->mod =3D period_count - 1; =20 /* calculate real period HW can support */ tmp =3D (u64)period_count << prescale; --=20 2.47.0