]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pwm: imx-tpm: Use correct MODULO value for EPWM mode
authorErik Schumacher <erik.schumacher@iris-sensing.com>
Fri, 25 Oct 2024 08:37:00 +0000 (08:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Nov 2024 12:13:38 +0000 (13:13 +0100)
commit51488ee3562c12c79c5fceacc1f43bd2cca27cd3
tree7eaa07592241a69bdca00e962e5b0818e6ee038e
parent282ad7124652728818ed2d82ddcac6279c446a5a
pwm: imx-tpm: Use correct MODULO value for EPWM mode

commit cc6a931d1f3b412263d515fd93b21fc0ca5147fe upstream.

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. Return -EINVAL if the calculated length is
already zero.
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 <erik.schumacher@iris-sensing.com>
Link: https://lore.kernel.org/r/1a3890966d68b9f800d457cbf095746627495e18.camel@iris-sensing.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pwm/pwm-imx-tpm.c