From: sashiko-bot@kernel.org
To: "Mikko Perttunen" <mperttunen@nvidia.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v5 6/7] pwm: tegra: Add support for Tegra264
Date: Fri, 29 May 2026 04:30:58 +0000 [thread overview]
Message-ID: <20260529043059.845D71F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260529-t264-pwm-v5-6-7bf9e405a96a@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The driver assumes a fixed PWM depth of 256 but fails to initialize the new configurable DEPTH register field on Tegra264, risking incorrect PWM frequency and duty cycle.
--
commit a215267521de0fbfc0019ea87d4d0d3a5d3250ea
Author: Mikko Perttunen <mperttunen@nvidia.com>
pwm: tegra: Add support for Tegra264
This patch adds support for the Tegra264 PWM controller. It introduces
an enable_reg field to handle the relocated PWM_ENABLE bit in the new
CSR_1 register for Tegra264 devices.
> diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
> index 7c7b884d44363..50e72139cbc34 100644
> --- a/drivers/pwm/pwm-tegra.c
> +++ b/drivers/pwm/pwm-tegra.c
[ ... ]
> @@ -215,6 +257,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
>
> static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> {
> + struct tegra_pwm_chip *pc = to_tegra_pwm_chip(chip);
> int rc = 0;
> u32 val;
>
> @@ -222,20 +265,21 @@ static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> if (rc)
> return rc;
>
> - val = tegra_pwm_readl(pwm, TEGRA_PWM_CSR_0);
> + val = tegra_pwm_readl(pwm, pc->soc->enable_reg);
> val |= TEGRA_PWM_ENABLE;
> - tegra_pwm_writel(pwm, TEGRA_PWM_CSR_0, val);
> + tegra_pwm_writel(pwm, pc->soc->enable_reg, val);
[Severity: High]
Could this cause a regression where the PWM output is left in a broken state
if the hardware resets the DEPTH field to 0?
The commit message notes that configurable depth will be supported in a
later patch, and tegra_pwm_config() continues to use a hardcoded
TEGRA_PWM_DEPTH of 256 for duty cycle and clock rate calculations.
Since this read-modify-write only updates the ENB bit, if the CSR_1.DEPTH
field defaults to 0 after a device reset, wouldn't the hardware divide by 1
instead of 256?
This seems like it would cause the PWM to operate at 256x the intended
frequency, and any calculated duty cycle value would exceed the hardware's
maximum depth. Should CSR_1.DEPTH be explicitly initialized to 255 here to
safely match the software's TEGRA_PWM_DEPTH assumption?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260529-t264-pwm-v5-0-7bf9e405a96a@nvidia.com?part=6
next prev parent reply other threads:[~2026-05-29 4:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 2:47 [PATCH v5 0/7] Tegra264 PWM support Mikko Perttunen
2026-05-29 2:47 ` [PATCH v5 1/7] dt-bindings: pwm: Document Tegra264 controller Mikko Perttunen
2026-05-29 2:47 ` [PATCH v5 2/7] pwm: tegra: Prefix driver-local macros and functions Mikko Perttunen
2026-05-29 2:47 ` [PATCH v5 3/7] pwm: tegra: Avoid hard-coded max clock frequency Mikko Perttunen
2026-05-29 3:28 ` sashiko-bot
2026-05-29 2:47 ` [PATCH v5 4/7] pwm: tegra: Modify read/write accessors for multi-register channel Mikko Perttunen
2026-05-29 2:47 ` [PATCH v5 5/7] pwm: tegra: Parametrize duty and scale field widths Mikko Perttunen
2026-05-29 4:05 ` sashiko-bot
2026-05-29 2:47 ` [PATCH v5 6/7] pwm: tegra: Add support for Tegra264 Mikko Perttunen
2026-05-29 4:30 ` sashiko-bot [this message]
2026-05-29 2:47 ` [PATCH v5 7/7] arm64: tegra: Add PWM controllers on Tegra264 Mikko Perttunen
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=20260529043059.845D71F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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