Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Chi-Wen Weng <cwweng.linux@gmail.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	cwweng@nuvoton.com
Subject: Re: [PATCH v6 2/2] pwm: Add Nuvoton MA35D1 PWM controller support
Date: Fri, 20 Nov 2026 16:45:11 +0100	[thread overview]
Message-ID: <awBfa9jMlhCTR5xV@monoceros> (raw)
In-Reply-To: <20260914110739.203479-3-cwweng.linux@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

Hello,

just some nitpicking left ...

On Mon, Sep 14, 2026 at 07:07:39PM +0800, Chi-Wen Weng wrote:
> +#include <linux/bits.h>
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/errno.h>
> +#include <linux/io.h>
> +#include <linux/math64.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/pwm.h>
> +
> +#define MA35D1_REG_PWM_CTL0			0x00

The manual calls this EPWM_CTL0, so I suggest to name this:

	MA35D1_REG_EPWM_CTL0

> +#define MA35D1_REG_PWM_CTL1			0x04
> +#define MA35D1_REG_PWM_CLKPSC(ch)		(0x14 + 4 * ((ch) / 2))
> +#define MA35D1_REG_PWM_CNTEN			0x20
> +#define MA35D1_REG_PWM_PERIOD(ch)		(0x30 + 4 * (ch))
> +#define MA35D1_REG_PWM_CMPDAT(ch)		(0x50 + 4 * (ch))
> +#define MA35D1_REG_PWM_WGCTL0			0xb0
> +#define MA35D1_REG_PWM_WGCTL1			0xb4
> +#define MA35D1_REG_PWM_POLCTL			0xd4
> +#define MA35D1_REG_PWM_POEN			0xd8
> +
> +#define MA35D1_PWM_CTL0_CTRLD(ch)		BIT(ch)

I like it if the register this bit field is defined for is a proper
prefix of the name, so please rename to MA35D1_REG_EPWM_CTL0_CTRLD().

> +#define MA35D1_PWM_CTL0_WINLDEN(ch)		BIT(8 + (ch))
> +#define MA35D1_PWM_CTL0_IMMLDEN(ch)		BIT(16 + (ch))
> +
> +#define MA35D1_PWM_CTL1_CNTTYPE_MASK(ch)	(0x3 << (2 * (ch)))

The reference manual calls this CNTTYPEx, so please rename to

	MA35D1_EPWM_CTL1_CNTTYPE(ch)

> [...]
> +static int nuvoton_pwm_config_channel(struct nuvoton_pwm *nvtpwm,
> +				      unsigned int ch)
> +{
> [...]
> +	nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_CTL0, ctl0_mask, 0);
> +	nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_CTL1, ctl1_mask, 0);
> +	nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_WGCTL0,
> +			wgctl0_mask, wgctl0_val);
> +	nuvoton_pwm_rmw(nvtpwm, MA35D1_REG_PWM_WGCTL1,
> +			wgctl1_mask, wgctl1_val);

I think these lines are short enough to not break them.

> +	return 0;
> +}

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2026-11-20 15:45 UTC|newest]

Thread overview: 4+ 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-11-20 15:45   ` Uwe Kleine-König [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=awBfa9jMlhCTR5xV@monoceros \
    --to=ukleinek@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cwweng.linux@gmail.com \
    --cc=cwweng@nuvoton.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robh@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