[PATCH v2 0/2] pwm: loongson: Fix PWM configuration handling

From: Keguang Zhang via B4 Relay

Date: Fri Jun 26 2026 - 08:26:11 EST


This series fixes two issues in the Loongson PWM driver:

- Fix the handling of the Low Pulse Buffer Register, which was
incorrectly treated as a duty-cycle register.

- Reset the PWM counter when disabling the PWM and release it when
enabling the PWM so that updated LOW and PERIOD values are latched
before the PWM starts running again.

The fixes were verified on LS1B, LS1C, and LS2K0300 boards.

Signed-off-by: Keguang Zhang <keguang.zhang@xxxxxxxxx>
---
Changes in v2:
- Drop the -ERANGE return change and restore the original behavior.
- Use mul_u64_u64_div_u64_roundup() to calculate the low pulse width.
- Update the commit message accordingly.
- Link to v1: https://lore.kernel.org/r/20260616-pwm-loongson-fix-v1-0-491dbf260a7f@xxxxxxxxx

---
Keguang Zhang (2):
pwm: loongson: Fix low pulse buffer register handling
pwm: loongson: Reload PWM configuration through counter reset

drivers/pwm/pwm-loongson.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
---
base-commit: 8d6dbbbe3ba62de0a63e962ee004afb848c8e3ac
change-id: 20260612-pwm-loongson-fix-183763451e93

Best regards,
--
Keguang Zhang <keguang.zhang@xxxxxxxxx>