From: Frank Li <Frank.li@nxp.com>
To: Erik Schumacher <erik.schumacher@iris-sensing.com>
Cc: "ukleinek@kernel.org" <ukleinek@kernel.org>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"festevam@gmail.com" <festevam@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH] pwm: imx-tpm: Use correct MODULO value for EPWM mode
Date: Wed, 23 Oct 2024 11:35:29 -0400 [thread overview]
Message-ID: <ZxkXwTXwfkC9W5C3@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <349a25ddce02d55cf5a321f27133cae1f34f1962.camel@iris-sensing.com>
On Wed, Oct 23, 2024 at 12:33:53PM +0000, Erik Schumacher wrote:
> 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.
>
This is bug fix, add fix tag and cc stable
Frank
> Signed-off-by: Erik Schumacher <erik.schumacher@iris-sensing.com>
> ---
> 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 *chip,
> p->prescale = prescale;
>
> period_count = (clock_unit + ((1 << prescale) >> 1)) >> prescale;
> - p->mod = period_count;
> + p->mod = period_count - 1;
>
> /* calculate real period HW can support */
> tmp = (u64)period_count << prescale;
> --
> 2.47.0
>
next prev parent reply other threads:[~2024-10-23 18:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 12:33 [PATCH] pwm: imx-tpm: Use correct MODULO value for EPWM mode Erik Schumacher
2024-10-23 15:35 ` Frank Li [this message]
2024-10-24 6:11 ` Erik Schumacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZxkXwTXwfkC9W5C3@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=erik.schumacher@iris-sensing.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox