From: sashiko-bot@kernel.org
To: "Chi-Wen Weng" <cwweng.linux@gmail.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 2/2] pwm: Add Nuvoton MA35D1 PWM controller support
Date: Mon, 14 Sep 2026 11:17:42 +0000 [thread overview]
Message-ID: <20260914111742.85BF01F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914110739.203479-3-cwweng.linux@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The driver relies on the bootloader-configured CLKPSC (prescaler) register but does not cache its value, which will cause incorrect period calculations after a system suspend/resume cycle.
--
commit b9ac3c051c5908fe946a0ef1c7b809030aa32933
Author: Chi-Wen Weng <cwweng@nuvoton.com>
pwm: Add Nuvoton MA35D1 PWM controller support
This commit adds a generic PWM framework driver for the Nuvoton MA35D1 PWM
controller. The initial driver supports 6 channels in up-counting,
auto-reload, independent output, and period loading modes.
> diff --git a/drivers/pwm/pwm-ma35d1.c b/drivers/pwm/pwm-ma35d1.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/pwm/pwm-ma35d1.c
[ ... ]
> +static u32 nuvoton_pwm_get_prescale(struct nuvoton_pwm *nvtpwm,
> + unsigned int ch)
> +{
> + return nuvoton_pwm_readl(nvtpwm, MA35D1_REG_PWM_CLKPSC(ch)) &
> + MA35D1_PWM_CLKPSC_MASK;
> +}
[Severity: Medium]
Does reading the hardware register directly here make the driver vulnerable
to hardware state loss during system suspend?
If the controller loses power during suspend, the clock prescaler register
might reset to its default value. When the system resumes and a consumer
subsequently calls into the apply callback, this function will return the
reset value instead of the bootloader-configured value. This could result
in drastically altered PWM output frequencies.
Would it be safer to cache the prescaler value during probe?
[ ... ]
> +static struct platform_driver nuvoton_pwm_driver = {
> + .probe = nuvoton_pwm_probe,
> + .driver = {
> + .name = "nuvoton-pwm",
> + .of_match_table = nuvoton_pwm_of_match,
> + },
> +};
[Severity: Medium]
Should this driver include PM callbacks to handle saving and restoring the
hardware state?
Currently, there are no suspend/resume hooks provided. If the platform
powers down the PWM domain during system suspend, the controller state
will be lost upon resume and might not be appropriately reconfigured before
the next state application.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914110739.203479-1-cwweng.linux@gmail.com?part=2
next prev parent reply other threads:[~2026-09-14 11:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 11:07 [PATCH v6 0/2] pwm: Add Nuvoton MA35D1 PWM controller support Chi-Wen Weng
2026-09-14 11:07 ` [PATCH v6 1/2] dt-bindings: pwm: Add Nuvoton MA35D1 PWM controller Chi-Wen Weng
2026-09-14 11:07 ` [PATCH v6 2/2] pwm: Add Nuvoton MA35D1 PWM controller support Chi-Wen Weng
2026-09-14 11:17 ` sashiko-bot [this message]
2026-09-16 4:26 ` Chi-Wen Weng
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=20260914111742.85BF01F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=cwweng.linux@gmail.com \
--cc=devicetree@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.