Skip to contentSkip to conversation

Add OpenCores PTC PWM support

PATCH RESEND Applied Hal Feng 6 participants 15 messages Aug 10 – Nov 7

Subsystems (4)

v22 of 25 Applied 1/3 Latest is v25 →

lore
Share & tools
lore

Hal Feng

author
#0 lore raw

v22 cover Add OpenCores PTC PWM support

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 v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

Changes since v20:
- Fix 0% duty cycle support.

Changes since v19:
- Drop the oneOf construct in dt-bindings.
- Address Sashiko AI review comments for the OpenCores PWM driver. In ocores_pwm_apply(), handling disable requests first, then calculating and validating period/duty for enable requests before taking a runtime PM reference or touching the hardware registers.

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:
v21: https://lore.kernel.org/all/[email protected]/
v20: https://lore.kernel.org/all/[email protected]/
v19: https://lore.kernel.org/all/[email protected]/
v18: https://lore.kernel.org/all/[email protected]/
v17: https://lore.kernel.org/all/[email protected]/

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           |   6 +-
 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                      | 298 ++++++++++++++++++
 14 files changed, 518 insertions(+), 24 deletions(-)
 create mode 100644 drivers/pwm/pwm-ocores.c

base-commit: db2ddb87143519e20a95aa36c60b36107b736a58

Signature · 1 line
2.43.2
author
#1 lore raw

PATCH RESEND v22 1/3 dt-bindings: pwm: opencores: Update compatibles, examples and maintainers

Remove the jh8100 compatible since the JH8100 SoC has been canceled and will not be released. Add the jhb100 compatible to replace it.

Change the register size in examples to 0x10, since an OpenCores PTC IP has only 4 32-bit registers: CNTR, HRC, LRC and CTRL.

I will maintain this pwm module in place of William.

Fixes 2529085831b0 ("dt-bindings: pwm: Add bindings for OpenCores PWM Controller")
---
 Documentation/devicetree/bindings/pwm/opencores,pwm.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pwm/opencores,pwm.yaml +3 -3
index 52a59d245cdb..42c5d2b6326d 100644
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: OpenCores PWM controller
 
 maintainers:
-  - William Qiu <[email protected]>
+  - Hal Feng <[email protected]>
 
 description:
   The OpenCores PTC ip core contains a PWM controller. When operating in PWM
@@ -23,7 +23,7 @@ properties:
       - enum:
           - starfive,jh7100-pwm
           - starfive,jh7110-pwm
-          - starfive,jh8100-pwm
+          - starfive,jhb100-pwm
       - const: opencores,pwm-v1
 
   reg:
@@ -49,7 +49,7 @@ examples:
   - |
     pwm@12490000 {
         compatible = "starfive,jh7110-pwm", "opencores,pwm-v1";
-        reg = <0x12490000 0x10000>;
+        reg = <0x12490000 0x10>;
         clocks = <&clkgen 181>;
         resets = <&rstgen 109>;
         #pwm-cells = <3>;
Signature · 1 line
2.43.2
#2 lore raw

PATCH RESEND v22 1/3 dt-bindings: pwm: opencores: Update compatibles, examples and maintainers

Hello Conor,

Sorry to bother you. I discussed it with Hal, and I will pick up this series later to add PWM support for JHB100.

Quoted 29 lines

Remove the jh8100 compatible since the JH8100 SoC has been canceled and will not be released. Add the jhb100 compatible to replace it.

Change the register size in examples to 0x10, since an OpenCores PTC IP has only 4 32-bit registers: CNTR, HRC, LRC and CTRL.

I will maintain this pwm module in place of William.

Fixes 2529085831b0 ("dt-bindings: pwm: Add bindings for OpenCores PWM Controller")
---
 Documentation/devicetree/bindings/pwm/opencores,pwm.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pwm/opencores,pwm.yaml +1 -1
index 52a59d245cdb..42c5d2b6326d 100644
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: OpenCores PWM controller
 
 maintainers:
-  - William Qiu <[email protected]>
+  - Hal Feng <[email protected]>
 
 description:
   The OpenCores PTC ip core contains a PWM controller. When operating in PWM

Documentation/devicetree/bindings/pwm/opencores,pwm.yaml properties: · line 28

Quoted 7 lines
Documentation/devicetree/bindings/pwm/opencores,pwm.yaml +1 -1
@@ -23,7 +23,7 @@ properties:
       - enum:
           - starfive,jh7100-pwm
           - starfive,jh7110-pwm
-          - starfive,jh8100-pwm
+          - starfive,jhb100-pwm
       - const: opencores,pwm-v1
 

Compared with the JH7110 PWM, the JHB100 PWM has been modified. The JH7110 PWM is inverted polarity by default, which is consistent with the design of opencores,pwm-v1, but the JHB100 PWM has been modified to normal polarity, so it no longer conforms to the design of opencores,pwm-v1. Therefore, I plan to revise the binding here again:

properties:
compatible:
oneOf:
- items:
- enum:
- starfive,jh7100-pwm
- starfive,jh7110-pwm
- const: opencores,pwm-v1
- const: starfive,jhb100-pwm

Do you think this makes sense?

Documentation/devicetree/bindings/pwm/opencores,pwm.yaml examples:

Quoted 11 lines
Documentation/devicetree/bindings/pwm/opencores,pwm.yaml +1 -2
   reg:
@@ -49,7 +49,7 @@ examples:
   - |
     pwm@12490000 {
         compatible = "starfive,jh7110-pwm", "opencores,pwm-v1";
-        reg = <0x12490000 0x10000>;
+        reg = <0x12490000 0x10>;
         clocks = <&clkgen 181>;
         resets = <&rstgen 109>;
         #pwm-cells = <3>;
--

Best Regards,
Changhuang

author
#3 lore raw

PATCH RESEND v22 2/3 riscv: dts: starfive: Correct pwm nodes

In reply to Hal Feng

Each of the StarFive JH7100/JH7110 SoCs has 8 OpenCores PTC IP cores. One OpenCores PTC IP core can output one PWM channel. Change the register size to 0x10, since an OpenCores PTC IP has only 4 32-bit registers: CNTR, HRC, LRC and CTRL.

Fixes 8d01f741a046 ("riscv: dts: starfive: jh7110: Add PWM node and pins configuration")
Fixes 5e598b99fedf ("riscv: dts: starfive: jh7100: Add PWM node and pins configuration")
---
 .../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 ++++++++++++++++++-
 9 files changed, 198 insertions(+), 21 deletions(-)
arch/riscv/boot/dts/starfive/jh7100-common.dtsi +22 -6
index ae1a6aeb0aea..85106545090e 100644
@@ -199,13 +199,23 @@ GPO_I2C2_PAD_SDA_OEN,
 		};
 	};
 
-	pwm_pins: pwm-0 {
-		pwm-pins {
+	pwm0_pins: pwm0-0 {
+		pwm0-pins {
 			pinmux = <GPIOMUX(7,
 				  GPO_PWM_PAD_OUT_BIT0,
 				  GPO_PWM_PAD_OE_N_BIT0,
-				  GPI_NONE)>,
-				 <GPIOMUX(5,
+				  GPI_NONE)>;
+			bias-disable;
+			drive-strength = <35>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
+	pwm1_pins: pwm1-0 {
+		pwm1-pins {
+			pinmux =  <GPIOMUX(5,
 				  GPO_PWM_PAD_OUT_BIT1,
 				  GPO_PWM_PAD_OE_N_BIT1,
 				  GPI_NONE)>;
@@ -359,9 +369,15 @@ &osc_aud {
 	clock-frequency = <27000000>;
 };
 
-&pwm {
+&pwm0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_pins>;
+	status = "okay";
+};
+
+&pwm1 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pwm_pins>;
+	pinctrl-0 = <&pwm1_pins>;
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7100.dtsi +65 -2

74 lines not on this page · raw message

arch/riscv/boot/dts/starfive/jh7110-common.dtsi +21 -6
index a7a1c09a2c90..64de468f2c31 100644
@@ -326,9 +326,14 @@ uboot@100000 {
 	};
 };
 
-&pwm {
+&pwm0 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&pwm_pins>;
+	pinctrl-0 = <&pwm0_pins>;
+};
+
+&pwm1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm1_pins>;
 };
 
 &spi0 {
@@ -528,12 +533,22 @@ GPOEN_ENABLE,
 		};
 	};
 
-	pwm_pins: pwm-0 {
-		pwm-pins {
+	pwm0_pins: pwm0-0 {
+		pwm0-pins {
 			pinmux = <GPIOMUX(46, GPOUT_SYS_PWM_CHANNEL0,
 					      GPOEN_SYS_PWM0_CHANNEL0,
-					      GPI_NONE)>,
-				 <GPIOMUX(59, GPOUT_SYS_PWM_CHANNEL1,
+					      GPI_NONE)>;
+			bias-disable;
+			drive-strength = <12>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
+	pwm1_pins: pwm1-0 {
+		pwm1-pins {
+			pinmux = <GPIOMUX(59, GPOUT_SYS_PWM_CHANNEL1,
 					      GPOEN_SYS_PWM0_CHANNEL1,
 					      GPI_NONE)>;
 			bias-disable;
arch/riscv/boot/dts/starfive/jh7110-milkv-mars.dts +5 -1
index 21873612d993..54013c70f4b4 100644
@@ -68,7 +68,11 @@ &phy0 {
 	motorcomm,tx-clk-adj-enabled;
 };
 
-&pwm {
+&pwm0 {
+	status = "okay";
+};
+
+&pwm1 {
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7110-milkv-marscm.dtsi +5 -1
index 025471061d43..31afac27b86d 100644
@@ -87,7 +87,11 @@ &phy0 {
 	motorcomm,tx-clk-adj-enabled;
 };
 
-&pwm {
+&pwm0 {
+	status = "okay";
+};
+
+&pwm1 {
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7110-pine64-star64.dts +5 -1
index aec7ae3d1f5b..a9e82f25efde 100644
@@ -95,7 +95,11 @@ &phy1 {
 	motorcomm,tx-clk-100-inverted;
 };
 
-&pwm {
+&pwm0 {
+	status = "okay";
+};
+
+&pwm1 {
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-lite.dtsi +5 -1
index f8797a666dbf..85b56a72dff7 100644
@@ -74,7 +74,11 @@ &phy0 {
 	tx-internal-delay-ps = <1500>;
 };
 
-&pwm {
+&pwm0 {
+	status = "okay";
+};
+
+&pwm1 {
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +5 -1
index edc8f4588133..35208f95cd3d 100644
@@ -73,7 +73,11 @@ &pcie1 {
 	status = "okay";
 };
 
-&pwm {
+&pwm0 {
+	status = "okay";
+};
+
+&pwm1 {
 	status = "okay";
 };
 
arch/riscv/boot/dts/starfive/jh7110.dtsi +65 -2

74 lines not on this page · raw message

Signature · 1 line
2.43.2
author
#4 lore raw

PATCH RESEND v22 3/3 pwm: Add OpenCores PTC PWM driver

In reply to Hal Feng

Add PWM driver for OpenCores PTC IP core.

---
 MAINTAINERS              |   6 +
 drivers/pwm/Kconfig      |  12 ++
 drivers/pwm/Makefile     |   1 +
 drivers/pwm/pwm-ocores.c | 298 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 317 insertions(+)
 create mode 100644 drivers/pwm/pwm-ocores.c
MAINTAINERS +6 -0
index 8014b9f8253e..7886fd9a4ac0 100644
@@ -20273,6 +20273,12 @@ F:	Documentation/i2c/busses/i2c-ocores.rst
 F:	drivers/i2c/busses/i2c-ocores.c
 F:	include/linux/platform_data/i2c-ocores.h
 
+OPENCORES PWM DRIVER
+M:	Hal Feng <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/pwm/opencores,pwm.yaml
+F:	drivers/pwm/pwm-ocores.c
+
 OPENRISC ARCHITECTURE
 M:	Jonas Bonn <[email protected]>
 M:	Stefan Kristiansson <[email protected]>
drivers/pwm/Kconfig +12 -0
index e8886a9b64d9..1268c07d07f1 100644
@@ -546,6 +546,18 @@ config PWM_NTXEC
 	  controller found in certain e-book readers designed by the original
 	  design manufacturer Netronix.
 
+config PWM_OCORES
+	tristate "OpenCores PTC PWM support"
+	depends on HAS_IOMEM && OF
+	depends on COMMON_CLK
+	depends on ARCH_STARFIVE || COMPILE_TEST
+	help
+	  PWM driver for OpenCores PTC IP core.
+	  For details see https://opencores.org/projects/ptc.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-ocores.
+
 config PWM_OMAP_DMTIMER
 	tristate "OMAP Dual-Mode Timer PWM support"
 	depends on OF
drivers/pwm/Makefile +1 -0
index 5630a521a7cf..4d2d14c4852f 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_PWM_MICROCHIP_CORE)	+= pwm-microchip-core.o
 obj-$(CONFIG_PWM_MTK_DISP)	+= pwm-mtk-disp.o
 obj-$(CONFIG_PWM_MXS)		+= pwm-mxs.o
 obj-$(CONFIG_PWM_NTXEC)		+= pwm-ntxec.o
+obj-$(CONFIG_PWM_OCORES)	+= pwm-ocores.o
 obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
 obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
 obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
drivers/pwm/pwm-ocores.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
2.43.2
author
#5 lore raw

RE: [RESEND v22 3/3] pwm: Add OpenCores PTC PWM driver

Quoted 5 lines · Hal Feng

Add PWM driver for OpenCores PTC IP core.

Hi, Uwe,

As all AI comments have been addressed, could you please help review this series? @Uwe Kleine-König

Best regards,
Hal

Quoted 364 lines
---
 MAINTAINERS              |   6 +
 drivers/pwm/Kconfig      |  12 ++
 drivers/pwm/Makefile     |   1 +
 drivers/pwm/pwm-ocores.c | 298
+++++++++++++++++++++++++++++++++++++++
 4 files changed, 317 insertions(+)
 create mode 100644 drivers/pwm/pwm-ocores.c
MAINTAINERS +6 -0
index 8014b9f8253e..7886fd9a4ac0 100644
@@ -20273,6 +20273,12 @@ F:	Documentation/i2c/busses/i2c-ocores.rst
 F:	drivers/i2c/busses/i2c-ocores.c
 F:	include/linux/platform_data/i2c-ocores.h
 
+OPENCORES PWM DRIVER
+M:	Hal Feng <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/pwm/opencores,pwm.yaml
+F:	drivers/pwm/pwm-ocores.c
+
 OPENRISC ARCHITECTURE
 M:	Jonas Bonn <[email protected]>
 M:	Stefan Kristiansson <[email protected]>
drivers/pwm/Kconfig index renamed from drivers/pwm/Kconfig +0 -0

e8886a9b64d9..1268c07d07f1 100644

drivers/pwm/Kconfig +12 -0
@@ -546,6 +546,18 @@ config PWM_NTXEC
 	  controller found in certain e-book readers designed by the original
 	  design manufacturer Netronix.
 
+config PWM_OCORES
+	tristate "OpenCores PTC PWM support"
+	depends on HAS_IOMEM && OF
+	depends on COMMON_CLK
+	depends on ARCH_STARFIVE || COMPILE_TEST
+	help
+	  PWM driver for OpenCores PTC IP core.
+	  For details see https://opencores.org/projects/ptc.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-ocores.
+
 config PWM_OMAP_DMTIMER
 	tristate "OMAP Dual-Mode Timer PWM support"
 	depends on OF
drivers/pwm/Makefile index renamed from drivers/pwm/Makefile +0 -0

5630a521a7cf..4d2d14c4852f 100644

drivers/pwm/Makefile +0 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_PWM_MICROCHIP_CORE)	+=

pwm-microchip-core.o
obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o
obj-$(CONFIG_PWM_MXS) += pwm-mxs.o
obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o

drivers/pwm/Makefile +1 -0
+obj-$(CONFIG_PWM_OCORES)	+= pwm-ocores.o
 obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
 obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
 obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
drivers/pwm/pwm-ocores.c new renamed from drivers/pwm/pwm-ocores.c +0 -0

file mode 100644 index 000000000000..f873089a385b

drivers/pwm/pwm-ocores.c new file +11 -0
@@ -0,0 +1,298 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * OpenCores PTC PWM Driver
+ *
+ * https://opencores.org/projects/ptc
+ *
+ * Copyright (C) 2018-2026 StarFive Technology Co., Ltd.
+ *
+ * Limitations:
+ * - The hardware only supports inverted polarity.
+ * - The hardware minimum period / non-zero duty_cycle is (1 / pwm_apb

clock frequency).
+ * - The hardware maximum period / duty_cycle of PWM is (U32_MAX / pwm_apb clock frequency).
+ * - The output is immediately set to low when the module is disabled.
+ */

drivers/pwm/pwm-ocores.c new file +44 -0
+
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/pwm.h>
+#include <linux/reset.h>
+
+#define OCPWM_HRC	0x4
+#define OCPWM_LRC	0x8
+#define OCPWM_CTRL	0xC
+
+#define OCPWM_CTRL_EN	BIT(0)
+#define OCPWM_CTRL_OE	BIT(3)
+#define OCPWM_CTRL_RST	BIT(7)
+
+#define OCPWM_NUM_SAVED_REGS	3
+
+struct ocores_pwm_device {
+	void __iomem *base;
+	struct clk *clk;
+	unsigned long clk_rate;
+	struct reset_control *rst;
+	u32 saved_regs[OCPWM_NUM_SAVED_REGS];
+};
+
+static int ocores_pwm_get_state(struct pwm_chip *chip,
+				struct pwm_device *pwm,
+				struct pwm_state *state)
+{
+	struct ocores_pwm_device *ddata = pwmchip_get_drvdata(chip);
+	u32 period_data, duty_data, ctrl_data;
+	int ret;
+
+	ret = pm_runtime_resume_and_get(pwmchip_parent(chip));
+	if (ret < 0)
+		return ret;
+
+	period_data = readl(ddata->base + OCPWM_LRC);
+	duty_data = readl(ddata->base + OCPWM_HRC);
+	ctrl_data = readl(ddata->base + OCPWM_CTRL);
+
+	state->period = DIV_ROUND_UP_ULL((u64)period_data * NSEC_PER_SEC,

ddata->clk_rate);

drivers/pwm/pwm-ocores.c new file +1 -0
+	state->duty_cycle = DIV_ROUND_UP_ULL((u64)duty_data *

NSEC_PER_SEC, ddata->clk_rate);

drivers/pwm/pwm-ocores.c new file +32 -0
+	if (state->duty_cycle > state->period)
+		state->duty_cycle = state->period;
+
+	state->polarity = PWM_POLARITY_INVERSED;
+	state->enabled = (ctrl_data & OCPWM_CTRL_EN) ? true : false;
+
+	pm_runtime_put(pwmchip_parent(chip));
+
+	return 0;
+}
+
+static int ocores_pwm_apply(struct pwm_chip *chip,
+			    struct pwm_device *pwm,
+			    const struct pwm_state *state)
+{
+	struct ocores_pwm_device *ddata = pwmchip_get_drvdata(chip);
+	bool was_enabled = pwm_is_enabled(pwm);
+	u64 period_data, duty_data;
+	int ret;
+
+	if (state->polarity != PWM_POLARITY_INVERSED)
+		return -EINVAL;
+
+	if (!state->enabled) {
+		if (was_enabled) {
+			writel(0, ddata->base + OCPWM_CTRL);
+			pm_runtime_put(pwmchip_parent(chip));
+		}
+		return 0;
+	}
+
+	period_data = mul_u64_u32_div(state->period, ddata->clk_rate,

NSEC_PER_SEC);

drivers/pwm/pwm-ocores.c new file +4 -0
+	if (period_data > U32_MAX)
+		period_data = U32_MAX;
+
+	duty_data = mul_u64_u32_div(state->duty_cycle, ddata->clk_rate,

NSEC_PER_SEC);

drivers/pwm/pwm-ocores.c new file +18 -0
+	if (duty_data > U32_MAX)
+		duty_data = U32_MAX;
+
+	if (!period_data)
+		return -EINVAL;
+
+	if (!was_enabled) {
+		ret = pm_runtime_resume_and_get(pwmchip_parent(chip));
+		if (ret < 0)
+			return ret;
+	}
+
+	writel(0, ddata->base + OCPWM_CTRL);
+	writel(OCPWM_CTRL_RST, ddata->base + OCPWM_CTRL);
+
+	writel(period_data, ddata->base + OCPWM_LRC);
+	writel(duty_data, ddata->base + OCPWM_HRC);
+	writel(OCPWM_CTRL_OE | OCPWM_CTRL_EN, ddata->base +

OCPWM_CTRL);

drivers/pwm/pwm-ocores.c new file +70 -0
+
+	return 0;
+}
+
+static const struct pwm_ops ocores_pwm_ops = {
+	.get_state = ocores_pwm_get_state,
+	.apply = ocores_pwm_apply,
+};
+
+static int ocores_pwm_runtime_suspend(struct device *dev) {
+	struct ocores_pwm_device *ddata = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(ddata->clk);
+
+	return 0;
+}
+
+static int ocores_pwm_runtime_resume(struct device *dev) {
+	struct ocores_pwm_device *ddata = dev_get_drvdata(dev);
+	int ret;
+
+	ret = clk_prepare_enable(ddata->clk);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable clock\n");
+
+	return 0;
+}
+
+static int __maybe_unused ocores_pwm_suspend(struct device *dev) {
+	struct ocores_pwm_device *ddata = dev_get_drvdata(dev);
+	int ret, i;
+
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret < 0)
+		return ret;
+
+	for (i = 0; i < OCPWM_NUM_SAVED_REGS; i++)
+		ddata->saved_regs[i] = readl(ddata->base + 4 + 4 * i);
+
+	pm_runtime_put_sync(dev);
+
+	return pm_runtime_force_suspend(dev);
+}
+
+static int __maybe_unused ocores_pwm_resume(struct device *dev) {
+	struct ocores_pwm_device *ddata = dev_get_drvdata(dev);
+	int ret, i;
+
+	ret = pm_runtime_force_resume(dev);
+	if (ret)
+		return ret;
+
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret < 0)
+		return ret;
+
+	writel(0, ddata->base + OCPWM_CTRL);
+	writel(OCPWM_CTRL_RST, ddata->base + OCPWM_CTRL);
+	for (i = 0; i < OCPWM_NUM_SAVED_REGS; i++)
+		writel(ddata->saved_regs[i], ddata->base + 4 + 4 * i);
+
+	pm_runtime_put_sync(dev);
+
+	return 0;
+}
+
+static const struct dev_pm_ops ocores_pwm_pm_ops = {
+	RUNTIME_PM_OPS(ocores_pwm_runtime_suspend,
+		       ocores_pwm_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(ocores_pwm_suspend,

ocores_pwm_resume) };

drivers/pwm/pwm-ocores.c new file +106 -0
+
+static void ocores_pwm_pm_disable(void *data) {
+	struct device *dev = data;
+	struct ocores_pwm_device *ddata = dev_get_drvdata(dev);
+
+	pm_runtime_disable(dev);
+
+	if (!pm_runtime_status_suspended(dev)) {
+		/* Balance the reference held while the PWM is enabled. */
+		if (readl(ddata->base + OCPWM_CTRL) & OCPWM_CTRL_EN)
+			pm_runtime_put_noidle(dev);
+
+		ocores_pwm_runtime_suspend(dev);
+	}
+
+	reset_control_assert(ddata->rst);
+}
+
+static int ocores_pwm_probe(struct platform_device *pdev) {
+	struct device *dev = &pdev->dev;
+	struct ocores_pwm_device *ddata;
+	struct pwm_chip *chip;
+	int ret;
+
+	chip = devm_pwmchip_alloc(dev, 1, sizeof(*ddata));
+	if (IS_ERR(chip))
+		return PTR_ERR(chip);
+
+	chip->ops = &ocores_pwm_ops;
+	ddata = pwmchip_get_drvdata(chip);
+
+	ddata->base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(ddata->base))
+		return dev_err_probe(dev, PTR_ERR(ddata->base),
+				     "Failed to map IO resources\n");
+
+	ddata->clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(ddata->clk))
+		return dev_err_probe(dev, PTR_ERR(ddata->clk),
+				     "Failed to get clock\n");
+
+	ddata->clk_rate = clk_get_rate(ddata->clk);
+	if (!ddata->clk_rate || ddata->clk_rate > NSEC_PER_SEC)
+		return dev_err_probe(dev, -EINVAL,
+				     "Invalid clock rate: %lu\n", ddata->clk_rate);
+
+	ddata->rst = devm_reset_control_get_optional_shared(dev, NULL);
+	if (IS_ERR(ddata->rst))
+		return dev_err_probe(dev, PTR_ERR(ddata->rst),
+				     "Failed to get reset\n");
+
+	platform_set_drvdata(pdev, ddata);
+
+	ret = ocores_pwm_runtime_resume(dev);
+	if (ret)
+		return ret;
+
+	ret = reset_control_deassert(ddata->rst);
+	if (ret)
+		goto err_clk_disable;
+
+	ret = pm_runtime_set_active(dev);
+	if (ret)
+		goto err_reset_assert;
+
+	pm_runtime_get_noresume(dev);
+	pm_runtime_enable(dev);
+
+	if (!(readl(ddata->base + OCPWM_CTRL) & OCPWM_CTRL_EN))
+		pm_runtime_put_sync(dev);
+
+	ret = devm_add_action_or_reset(dev, ocores_pwm_pm_disable, dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add pm disable action\n");
+
+	ret = devm_pwmchip_add(dev, chip);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Could not register PWM chip\n");
+
+	return 0;
+
+err_reset_assert:
+	reset_control_assert(ddata->rst);
+err_clk_disable:
+	ocores_pwm_runtime_suspend(dev);
+	return dev_err_probe(dev, ret, "Failed to init pwm power\n"); }
+
+static const struct of_device_id ocores_pwm_of_match[] = {
+	{ .compatible = "opencores,pwm-v1" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ocores_pwm_of_match);
+
+static struct platform_driver ocores_pwm_driver = {
+	.probe = ocores_pwm_probe,
+	.driver = {
+		.name = "ocores-pwm",
+		.of_match_table = ocores_pwm_of_match,
+		.pm = pm_ptr(&ocores_pwm_pm_ops),
+	},
+};
+module_platform_driver(ocores_pwm_driver);
+
+MODULE_AUTHOR("Jieqin Chen");
+MODULE_AUTHOR("Hal Feng <[email protected]>");
+MODULE_DESCRIPTION("OpenCores PTC PWM driver");
Quoted 3 lines

MODULE_LICENSE("GPL");
--
2.43.2

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Tested-by on the v22 series
#6 lore raw
In reply to Hal Feng

Hello Hal,

Thanks for picking up this series, I've tested it on my fml13v01 board in the framework 13 chassis. Seeing the pwms split out into seperate nodes is how I envisioned this driver too.

Now to figure out how to get the pwm backlight driver to work nicely with an inverted pwm.

kind regards,
Maud

Quoted 79 lines

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 v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

Changes since v20:
- Fix 0% duty cycle support.

Changes since v19:
- Drop the oneOf construct in dt-bindings.
- Address Sashiko AI review comments for the OpenCores PWM driver. In ocores_pwm_apply(), handling disable requests first, then calculating and validating period/duty for enable requests before taking a runtime PM reference or touching the hardware registers.

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:
v21: https://lore.kernel.org/all/[email protected]/
v20: https://lore.kernel.org/all/[email protected]/
v19: https://lore.kernel.org/all/[email protected]/
v18: https://lore.kernel.org/all/[email protected]/
v17: https://lore.kernel.org/all/[email protected]/

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           |   6 +-
 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                      | 298 ++++++++++++++++++
 14 files changed, 518 insertions(+), 24 deletions(-)
 create mode 100644 drivers/pwm/pwm-ocores.c

base-commit: db2ddb87143519e20a95aa36c60b36107b736a58

Signature · 1 line
2.43.2
author
#7 lore raw
Quoted 11 lines · Maud Spierings

Hello Hal,

Thanks for picking up this series, I've tested it on my fml13v01 board in the framework 13 chassis. Seeing the pwms split out into seperate nodes is how I envisioned this driver too.

Now to figure out how to get the pwm backlight driver to work nicely with an inverted pwm.

Thanks for your attention and testing.

To work with the pwm backlight driver, add the PWM_POLARITY_INVERTED flag to the device tree.

Best regards,
Hal

Quoted 92 lines
Quoted 23 lines

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 v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

Changes since v20:
- Fix 0% duty cycle support.

Changes since v19:
- Drop the oneOf construct in dt-bindings.
- Address Sashiko AI review comments for the OpenCores PWM driver. In ocores_pwm_apply(), handling disable requests first, then calculating and validating period/duty for enable requests before taking a runtime PM reference or touching the hardware registers.

Quoted 8 lines

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

Quoted 38 lines

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:
v21:
https://lore.kernel.org/all/20260701074442.7714-1-hal.feng@starfivetec
h.com/
v20:
https://lore.kernel.org/all/20260629063601.63917-1-hal.feng@starfivete
ch.com/
v19:
https://lore.kernel.org/all/20260615155759.129210-1-hal.feng@starfivet
ech.com/
v18:
https://lore.kernel.org/all/20260515054723.25024-1-hal.feng@starfivete
ch.com/
v17:
https://lore.kernel.org/all/20250106103540.10079-1-william.qiu@starfiv
etech.com/

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

Quoted 14 lines
 .../bindings/pwm/opencores,pwm.yaml           |   6 +-
 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                      | 298

++++++++++++++++++

Quoted 7 lines
 14 files changed, 518 insertions(+), 24 deletions(-)  create mode

100644 drivers/pwm/pwm-ocores.c

base-commit: db2ddb87143519e20a95aa36c60b36107b736a58 --
2.43.2

#8 lore raw

Hi Hal,

Quoted 10 lines · Hal Feng
Quoted 10 lines · Maud Spierings

Hello Hal,

Thanks for picking up this series, I've tested it on my fml13v01 board in the framework 13 chassis. Seeing the pwms split out into seperate nodes is how I envisioned this driver too.

Now to figure out how to get the pwm backlight driver to work nicely with an inverted pwm.

Quoted 6 lines
Quoted 1 line

Thanks for your attention and testing.

To work with the pwm backlight driver, add the PWM_POLARITY_INVERTED flag to the device tree.

Yeah I got that, the issue is the backlight functioning in the wrong way, it doesn't invert the value map. So max brightness is backlight off and min brightness is max brightness. Might need to add some extra property to the pwm-backlight driver to allow inverting the values so the brightness works as expected.

Unless I've somehow missed something in the pwm bindings.

My current changes:
https://github.com/SpieringsAE/linux/commit/bd1ce4bb1740d86c42206effec962d470cd5c5ef

kind regards,
Maud

Quoted 94 lines
Quoted 93 lines
Quoted 24 lines

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 v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

Changes since v20:
- Fix 0% duty cycle support.

Changes since v19:
- Drop the oneOf construct in dt-bindings.
- Address Sashiko AI review comments for the OpenCores PWM driver. In ocores_pwm_apply(), handling disable requests first, then calculating and validating period/duty for enable requests before taking a runtime PM reference or touching the hardware registers.

Quoted 8 lines

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

Quoted 38 lines

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:
v21:
https://lore.kernel.org/all/20260701074442.7714-1-hal.feng@starfivetec
h.com/
v20:
https://lore.kernel.org/all/20260629063601.63917-1-hal.feng@starfivete
ch.com/
v19:
https://lore.kernel.org/all/20260615155759.129210-1-hal.feng@starfivet
ech.com/
v18:
https://lore.kernel.org/all/20260515054723.25024-1-hal.feng@starfivete
ch.com/
v17:
https://lore.kernel.org/all/20250106103540.10079-1-william.qiu@starfiv
etech.com/

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

Quoted 14 lines
  .../bindings/pwm/opencores,pwm.yaml           |   6 +-
  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                      | 298

++++++++++++++++++

Quoted 7 lines
  14 files changed, 518 insertions(+), 24 deletions(-)  create mode

100644 drivers/pwm/pwm-ocores.c

base-commit: db2ddb87143519e20a95aa36c60b36107b736a58 --
2.43.2

maintainer Applied
#9 lore raw

Re: (subset) [RESEND v22 0/3] Add OpenCores PTC PWM support

In reply to Hal Feng

From: Conor Dooley <[email protected]>

Quoted 5 lines · Hal Feng

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

I will maintain this pwm module in place of William.

Quoted 8 lines

Changes since v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Applied to riscv-dt-for-next, because this is independent and has no actual urgency without a driver.

[2/3] riscv: dts: starfive: Correct pwm nodes

      https://git.kernel.org/conor/c/2186ec5f59c2

Thanks,
Conor.

#10 lore raw
In reply to Hal Feng
This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Hello:

This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Quoted 5 lines · On Mon, 10 Aug 2026 11:07:11 +0800 you wrote:

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

I will maintain this pwm module in place of William.

Quoted 8 lines

Changes since v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Here is the summary with links:
- [RESEND,v22,1/3] dt-bindings: pwm: opencores: Update compatibles, examples and maintainers (no matching commit)
- [RESEND,v22,2/3] riscv: dts: starfive: Correct pwm nodes

    https://git.kernel.org/riscv/c/2186ec5f59c2

- [RESEND,v22,3/3] pwm: Add OpenCores PTC PWM driver (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
author
#11 lore raw
Quoted 26 lines · patchwork-bot+linux-riscv

Hello:

This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Quoted 5 lines · On Mon, 10 Aug 2026 11:07:11 +0800 you wrote:

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

I will maintain this pwm module in place of William.

Quoted 8 lines

Changes since v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Here is the summary with links:
- [RESEND,v22,1/3] dt-bindings: pwm: opencores: Update compatibles,
examples and maintainers
(no matching commit)
- [RESEND,v22,2/3] riscv: dts: starfive: Correct pwm nodes

Quoted 8 lines
    https://git.kernel.org/riscv/c/2186ec5f59c2

- [RESEND,v22,3/3] pwm: Add OpenCores PTC PWM driver (no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Hi, Conor,

Has this patch series been applied? I've sent out the updated v23 patch series, but Krzysztof pointed out the Tested-by tag should not be added in the dt-bindings patch. Should I send a v24 to drop the Tested-by tag tag, or should I make the changes on top of v22 if it has already been applied?

v23: https://lore.kernel.org/all/[email protected]/

Best regards,
Hal

#12 lore raw

Hello,

Quoted 33 lines · Hal Feng
Quoted 24 lines · patchwork-bot+linux-riscv

This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Quoted 5 lines · On Mon, 10 Aug 2026 11:07:11 +0800 you wrote:

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

I will maintain this pwm module in place of William.

Quoted 8 lines

Changes since v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Here is the summary with links:
- [RESEND,v22,1/3] dt-bindings: pwm: opencores: Update compatibles,
examples and maintainers
(no matching commit)
- [RESEND,v22,2/3] riscv: dts: starfive: Correct pwm nodes

Quoted 8 lines
    https://git.kernel.org/riscv/c/2186ec5f59c2

- [RESEND,v22,3/3] pwm: Add OpenCores PTC PWM driver (no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Quoted 4 lines

Has this patch series been applied? I've sent out the updated v23 patch series, but Krzysztof pointed out the Tested-by tag should not be added in the dt-bindings patch. Should I send a v24 to drop the Tested-by tag tag, or should I make the changes on top of v22 if it has already been applied?

The way I read it, only patch 2/3 "riscv: dts: starfive: Correct pwm nodes" was applied.

Best regards
Uwe

maintainer
#13 lore raw
Quoted 36 lines · On Mon, Nov 02, 2026 at 10:57:10AM +0100, [email protected] wrote:

Hello,

Quoted 33 lines · Hal Feng
Quoted 32 lines · patchwork-bot+linux-riscv

This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Quoted 5 lines · On Mon, 10 Aug 2026 11:07:11 +0800 you wrote:

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

I will maintain this pwm module in place of William.

Quoted 8 lines

Changes since v21:
- Allow non-zero duty cycles shorter than one clock tick to round down to zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Here is the summary with links:
- [RESEND,v22,1/3] dt-bindings: pwm: opencores: Update compatibles,
examples and maintainers
(no matching commit)
- [RESEND,v22,2/3] riscv: dts: starfive: Correct pwm nodes

    https://git.kernel.org/riscv/c/2186ec5f59c2

- [RESEND,v22,3/3] pwm: Add OpenCores PTC PWM driver (no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Quoted 7 lines
Quoted 4 lines

Has this patch series been applied? I've sent out the updated v23 patch series, but Krzysztof pointed out the Tested-by tag should not be added in the dt-bindings patch. Should I send a v24 to drop the Tested-by tag tag, or should I make the changes on top of v22 if it has already been applied?

The way I read it, only patch 2/3 "riscv: dts: starfive: Correct pwm nodes" was applied.

Yeah. And the mail is a quirk of me not removing the thread from the linux-riscv patchwork and pw-bot autoresponding when the series was "applied" by me to that tree when Paul fast-forwarded it. There should have been a b4-ty email from me a while ago saying that I had applied the dts patch.

author
#14 lore raw
Quoted 45 lines · Conor Dooley
Quoted 15 lines · On Mon, Nov 02, 2026 at 10:57:10AM +0100, [email protected] wrote:

Hello,

Quoted 12 lines · Hal Feng
Quoted 12 lines · patchwork-bot+linux-riscv

This series was applied to riscv/linux.git (fixes) by Conor Dooley <[email protected]>:

Quoted 7 lines · On Mon, 10 Aug 2026 11:07:11 +0800 you wrote:

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 v21:
- Allow non-zero duty cycles shorter than one clock tick to round down

to

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines

zero.
- Drop the .free() callback to preserve the PWM hardware state after pwm_put().
- Update the comment.

[...]

Here is the summary with links:
- [RESEND,v22,1/3] dt-bindings: pwm: opencores: Update
compatibles, examples and maintainers
(no matching commit)
- [RESEND,v22,2/3] riscv: dts: starfive: Correct pwm nodes

    https://git.kernel.org/riscv/c/2186ec5f59c2

- [RESEND,v22,3/3] pwm: Add OpenCores PTC PWM driver (no matching commit)

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Has this patch series been applied? I've sent out the updated v23 patch series, but Krzysztof pointed out the Tested-by tag should not be

added in the dt-bindings patch.

Quoted 3 lines
Quoted 2 lines

Should I send a v24 to drop the Tested-by tag tag, or should I make the changes on top of v22 if it has already been applied?

Quoted 8 lines
Quoted 2 lines

The way I read it, only patch 2/3 "riscv: dts: starfive: Correct pwm nodes" was applied.

Yeah. And the mail is a quirk of me not removing the thread from the linux-riscv patchwork and pw-bot autoresponding when the series was "applied" by me to that tree when Paul fast-forwarded it. There should have been a b4-ty email from me a while ago saying that I had applied the dts patch.

I've sent out the v24, please check it.

https://lore.kernel.org/all/[email protected]/

Best regards,
Hal