[PATCH v6 2/2] pwm: Add Nuvoton MA35D1 PWM controller support
Uwe Kleine-König
ukleinek at kernel.org
Fri Nov 20 07:45:11 PST 2026
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261120/b511b5b5/attachment-0001.sig>
More information about the linux-arm-kernel
mailing list