[PATCH] pwm: imx-tpm: reset counter if CMOD is 0
Uwe Kleine-König
ukleinek at kernel.org
Tue Jul 8 23:05:04 PDT 2025
Hello Laurentiu,
On Wed, Jul 02, 2025 at 11:31:28AM +0300, Laurentiu Mihalcea wrote:
> On 7/2/2025 8:51 AM, Uwe Kleine-König wrote:
> > On Tue, Jul 01, 2025 at 06:01:47PM -0400, Laurentiu Mihalcea wrote:
> >> + * MOD will NOT reset the value of the TPM counter.
> >> + *
> >> + * Therefore, if CNT.COUNT > MOD.MOD, the counter will reset
> >> + * after UINT32_MAX - CNT.COUNT + MOD.MOD cycles, which is
> >> + * incorrect.
> >> + *
> >> + * To avoid this, we need to force a reset of the
> >> + * counter before writing the new MOD value.
> >> + */
> > Without the reference manual at hand or a deeper understanding of the
> > hardware this isn't understandable. What is MOD? What is CMOD?
>
> so, MOD is the reference value for the counter. The counter needs to
> count until this value is reached, at which point the counter value
> gets reset to 0 and the output signal is driven HIGH or LOW (depends
> on the configured polarity). This value is used to define the period
> of the PWM.
>
> CMOD, on the other hand, is a clocking-related configuration option.
> I'd say what we're most interested in here is the fact that if CMOD is
> 0 then the counter will be disabled. Otherwise, it will be enabled.
JFTR: I marked your patch as "changes requested" now in patchwork and my
inbox and expect an updated patch, but without holding my breath :-)
Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250709/b4216b14/attachment.sig>
More information about the linux-arm-kernel
mailing list