All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chi-Wen Weng" <cwweng.linux@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v5 2/2] pwm: Add Nuvoton MA35D1 PWM controller support
Date: Tue, 21 Jul 2026 06:33:43 +0000	[thread overview]
Message-ID: <20260721063343.9C6561F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721062308.536947-3-cwweng.linux@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The apply callback returns early when !state->enabled, dropping updates to polarity, period, and duty_cycle.
--

--- Patch [2]: [PATCH v5 2/2] pwm: Add Nuvoton MA35D1 PWM controller support ---
commit cacbb01a99a86c07f6c67c4f1ef4d561c3481e94
Author: Chi-Wen Weng <cwweng@nuvoton.com>

pwm: Add Nuvoton MA35D1 PWM controller support

Adds a PWM framework driver for the Nuvoton MA35D1 EPWM controller.
The driver supports 6 PWM channels, utilizing up-counting, auto-reload,
and independent output modes.

> diff --git a/drivers/pwm/pwm-ma35d1.c b/drivers/pwm/pwm-ma35d1.c
> new file mode 100644
> index 0000000000000..4073cb72054a2
> --- /dev/null
> +++ b/drivers/pwm/pwm-ma35d1.c

[ ... ]

> +static int nuvoton_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> +			     const struct pwm_state *state)
> +{
> +	struct nuvoton_pwm *nvtpwm = nuvoton_pwm_from_chip(chip);
> +	unsigned int ch = pwm->hwpwm;
> +	u64 duty_cycles, period_cycles;
> +	u64 divisor;
> +	u32 cmpdat, period, prescale;
> +	int ret;
> +
> +	if (!state->enabled) {
> +		nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_POEN,
> +				MA35D1_PWM_POEN_EN(ch), 0);
> +		nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_CNTEN,
> +				MA35D1_PWM_CNTEN_EN(ch), 0);
> +
> +		return 0;
> +	}

[Severity: Medium]
Does this early return violate the PWM framework API contract by failing to
apply the full requested state?

If a consumer calls pwm_apply_state() with state->enabled = false but includes
updated polarity, period, or duty_cycle parameters, those changes appear to
be silently dropped because of this early return.

Since nuvoton_pwm_get_state() reads the configuration directly from hardware
registers, wouldn't subsequent state reads return stale values and desynchronize
the PWM core's cached state from the actual hardware configuration?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721062308.536947-1-cwweng.linux@gmail.com?part=2

      reply	other threads:[~2026-07-21  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  6:23 [PATCH v5 0/2] pwm: Add Nuvoton MA35D1 PWM controller support Chi-Wen Weng
2026-07-21  6:23 ` [PATCH v5 1/2] dt-bindings: pwm: Add Nuvoton MA35D1 PWM controller Chi-Wen Weng
2026-07-21  6:23 ` [PATCH v5 2/2] pwm: Add Nuvoton MA35D1 PWM controller support Chi-Wen Weng
2026-07-21  6:33   ` sashiko-bot [this message]

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=20260721063343.9C6561F00A3A@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.