Re: [PATCH 2/2] pwm: loongson: Reload PWM configuration through counter reset

From: Uwe Kleine-König

Date: Wed Jun 17 2026 - 12:29:41 EST


Hello,

On Tue, Jun 16, 2026 at 07:13:18PM +0800, Keguang Zhang via B4 Relay wrote:
> From: Keguang Zhang <keguang.zhang@xxxxxxxxx>
>
> By default, the Loongson PWM controller latches the LOW and PERIOD
> registers only at the start of each PWM period, causing configuration
> updates to be delayed until the next period.
>
> Reset the PWM counter when disabling the PWM and release it when enabling
> the PWM to force the controller to re-latch the updated LOW and PERIOD
> values, allowing configuration changes to take effect immediately.

To get this right, so if the hardware runs with PERIOD = 17 and then is
disabled with say the counter at 4, and later restarted with PERIOD =
12, the counter first goes up to 17 before the 12 becomes active, right?

I think the commit log is a bit irritating, because (IIUC) you only
change the behaviour when the PWM is disabled and then reenabled. If the
configuration is changed while the PWM is running, the effect is still
delayed until the current period ends (which is complete fine and even
preferred).

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature