|
|
Log in / Subscribe / Register

Add OpenCores PTC PWM support

From:  Hal Feng <hal.feng-AT-starfivetech.com>
To:  Uwe Kleine-König <ukleinek-AT-kernel.org>, Philipp Zabel <p.zabel-AT-pengutronix.de>, Rob Herring <robh-AT-kernel.org>, Krzysztof Kozlowski <krzk+dt-AT-kernel.org>, Conor Dooley <conor-AT-kernel.org>, Emil Renner Berthing <emil.renner.berthing-AT-canonical.com>, Palmer Dabbelt <palmer-AT-dabbelt.com>, Paul Walmsley <pjw-AT-kernel.org>, Albert Ou <aou-AT-eecs.berkeley.edu>
Subject:  [PATCH v19 0/3] Add OpenCores PTC PWM support
Date:  Mon, 15 Jun 2026 23:57:56 +0800
Message-ID:  <20260615155759.129210-1-hal.feng@starfivetech.com>
Cc:  Hal Feng <hal.feng-AT-starfivetech.com>, linux-pwm-AT-vger.kernel.org, devicetree-AT-vger.kernel.org, linux-riscv-AT-lists.infradead.org, linux-kernel-AT-vger.kernel.org
Archive-link:  Article

Add OpenCores PTC PWM driver which is used in StarFive
JH7100/JH7110/JHB100 SoC.

I will maintain this pwm module in place of William.

Changes since v18:
- Address Sashiko AI review comments for the OpenCores PWM driver.
- Fix runtime PM usage count handling on probe, error paths, PWM release
  and driver teardown.
- Reject period or duty cycle values below the hardware minimum.
- Restore PWM registers across system sleep resume.
- Return the real error from devm_pwmchip_alloc().
- Preserve bootloader-configured PWM state during probe and keep runtime
  PM active if the PWM is already enabled.
- Use synchronous runtime PM put before possible teardown.

Changes since v17:
- Simplify the code. Make it more readable.
- Restructure the driver to register the pwm chip for one pwm channel,
  because each OpenCores PTC IP core only supports one PWM channel.
  Drop starfive compatibles.
  Add patches to fix the dt-bindings and device tree.
- Support runtime pm and system sleep pm.
- Disable the pwm module and reset the pwm counter before updating the
  period and duty cycle.
- Improve the descriptions.
- Update the dt-bindings maintainer to Hal Feng.

History:
v18: https://lore.kernel.org/all/20260515054723.25024-1-hal.fe...
v17: https://lore.kernel.org/all/20250106103540.10079-1-willia...

Hal Feng (3):
  dt-bindings: pwm: opencores: Update compatibles, examples and
    maintainers
  riscv: dts: starfive: Correct pwm nodes
  pwm: Add OpenCores PTC PWM driver

 .../bindings/pwm/opencores,pwm.yaml           |  16 +-
 MAINTAINERS                                   |   6 +
 .../boot/dts/starfive/jh7100-common.dtsi      |  28 +-
 arch/riscv/boot/dts/starfive/jh7100.dtsi      |  67 +++-
 .../boot/dts/starfive/jh7110-common.dtsi      |  27 +-
 .../boot/dts/starfive/jh7110-milkv-mars.dts   |   6 +-
 .../dts/starfive/jh7110-milkv-marscm.dtsi     |   6 +-
 .../dts/starfive/jh7110-pine64-star64.dts     |   6 +-
 .../jh7110-starfive-visionfive-2-lite.dtsi    |   6 +-
 .../jh7110-starfive-visionfive-2.dtsi         |   6 +-
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  67 +++-
 drivers/pwm/Kconfig                           |  12 +
 drivers/pwm/Makefile                          |   1 +
 drivers/pwm/pwm-ocores.c                      | 312 ++++++++++++++++++
 14 files changed, 538 insertions(+), 28 deletions(-)
 create mode 100644 drivers/pwm/pwm-ocores.c


base-commit: 95e56f0f293ef797123eb032f78f5b5d56a035a6
-- 
2.43.2




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds