linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800
@ 2025-05-09  9:45 Thomas Bonnefille
  2025-05-09  9:45 ` [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC Thomas Bonnefille
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thomas Bonnefille @ 2025-05-09  9:45 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen Wang, Inochi Amaoto
  Cc: Thomas Petazzoni, Miquèl Raynal, linux-pwm, devicetree,
	sophgo, linux-kernel, Jingbao Qiu, Thomas Bonnefille,
	Krzysztof Kozlowski

The Sophgo CV1800 chip provides a set of four independent
PWM channel outputs.
This series adds PWM controller support for Sophgo cv1800.

Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
[Thomas since v8]
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
Changes in v8:
- Rewrote supported frequency
- Hardcoded HLPERIOD_BASE and PERIDO_BASE
- Change usage of update_bits to set/clear bits when needed
- Rewrote construct of enablement of PWM
- Fixed OE activation
- Fixed hw state modification in case where pwm value cannot be reached
- Renamed variables
- Errors out for new cases
- Reworded some comments

v7: https://lore.kernel.org/linux-pwm/20240501083242.773305-1-qiujingbao.dlmu@gmail.com/

Changes in v7:
- add detailed Limitations
- using BIT(n) instead BIT(0) << n
- use 0 instead of disable macro
- modify OE judgment criteria
- add devm_regmap_init_mmio error message
- delete unused variable

v6: https://lore.kernel.org/all/20240406063413.3334639-1-qiujingbao.dlmu@gmail.com/

Changes in v6:
- delete the OE function because we plan to use the counter subsystem
  instead of capture, so there is no need to reuse this code.
- fix set polarity reverse error.

v5: https://lore.kernel.org/all/20240314100131.323540-1-qiujingbao.dlmu@gmail.com/

Changes in v5:
- drop filename
- fix macro
- optimize cv1800_pwm_set_polarity()
- optimize cv1800_pwm_set_oe()
- add comment for cv1800_pwm_set_oe()
- use ticks replace tem
- fix duty_cycle larger than period_val
- use devm_clk_rate_exclusive_get() replace
  clk_rate_exclusive_get()
- map linux polarity to register polarity 

v4: https://lore.kernel.org/all/20240304085933.1246964-1-qiujingbao.dlmu@gmail.com/

datasheet Link: https://github.com/milkv-duo/duo-files/blob/main/duo/datasheet/CV1800B-CV1801B-Preliminary-Datasheet-full-en.pdf
page 614

Changes in v4:
- use macro instead of npwm number
- add support for polarity feature
- add support for Output-Enable/OE feature

v3: https://lore.kernel.org/all/20240223082014.109385-1-qiujingbao.dlmu@gmail.com/

Changes in v3:
- use 0x08 instead of macro
- split if statements based on conditions
- in order to round up, first calculate the
  number of high-level cycles, then subtract
  it from the PERIOD to obtain the number of HLPERIOD
- use new pwmchip_alloc() API instead of old style

v2: https://lore.kernel.org/all/20240212121729.1086718-1-qiujingbao.dlmu@gmail.com/

Changes in v2:
- drop full stop from subject
- re-order maintainers and description
- pass checkpatch.pl --strict
- fix naming errors
- add "Limitations" section
- use a driver specific prefix for all defines
- using bool instead u32 in cv1800_pwm_enable
- check and set state->polarity
- use mul_u64_u64_div_u64
- use clk_rate_exclusive_get(), balance with clk_rate_exclusive_put()
- using macro definitions instead of shift operations
- remove shift operation on 0
- use priv replace cv_pwm
- hardcode npwm
- set atomic to true
- remove MODULE_ALIAS

v1: https://lore.kernel.org/all/20240207055856.672184-1-qiujingbao.dlmu@gmail.com/

---
Jingbao Qiu (2):
      dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC
      pwm: sophgo: add pwm support for Sophgo CV1800 SoC

 .../devicetree/bindings/pwm/sophgo,cv1800-pwm.yaml |  45 ++++
 drivers/pwm/Kconfig                                |  10 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-cv1800.c                           | 294 +++++++++++++++++++++
 4 files changed, 350 insertions(+)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250407-pwm_sophgo-5032b3858c27

Best regards,
-- 
Thomas Bonnefille <thomas.bonnefille@bootlin.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC
  2025-05-09  9:45 [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Thomas Bonnefille
@ 2025-05-09  9:45 ` Thomas Bonnefille
  2025-05-09 16:13   ` Rob Herring
  2025-05-09  9:45 ` [PATCH v8 2/2] pwm: sophgo: add pwm support for Sophgo CV1800 SoC Thomas Bonnefille
  2025-05-09 12:14 ` [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Inochi Amaoto
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Bonnefille @ 2025-05-09  9:45 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen Wang, Inochi Amaoto
  Cc: Thomas Petazzoni, Miquèl Raynal, linux-pwm, devicetree,
	sophgo, linux-kernel, Jingbao Qiu, Thomas Bonnefille,
	Krzysztof Kozlowski

From: Jingbao Qiu <qiujingbao.dlmu@gmail.com>

Add devicetree binding to describe the PWM for Sophgo CV1800 SoC.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
---
 .../devicetree/bindings/pwm/sophgo,cv1800-pwm.yaml | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/sophgo,cv1800-pwm.yaml b/Documentation/devicetree/bindings/pwm/sophgo,cv1800-pwm.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..b5b819d780f10163631ec14a20bfaa5ea46fe868
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/sophgo,cv1800-pwm.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/sophgo,cv1800-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo CV1800 PWM controller
+
+maintainers:
+  - Jingbao Qiu <qiujingbao.dlmu@gmail.com>
+
+description:
+  The chip provides a set of four independent PWM channel outputs.
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: sophgo,cv1800-pwm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  "#pwm-cells":
+    const: 3
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    pwm0: pwm@3060000 {
+        compatible = "sophgo,cv1800-pwm";
+        reg = <0x3060000 0x1000>;
+        clocks = <&clk 60>;
+        #pwm-cells = <3>;
+    };

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v8 2/2] pwm: sophgo: add pwm support for Sophgo CV1800 SoC
  2025-05-09  9:45 [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Thomas Bonnefille
  2025-05-09  9:45 ` [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC Thomas Bonnefille
@ 2025-05-09  9:45 ` Thomas Bonnefille
  2025-05-09 12:14 ` [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Inochi Amaoto
  2 siblings, 0 replies; 8+ messages in thread
From: Thomas Bonnefille @ 2025-05-09  9:45 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Chen Wang, Inochi Amaoto
  Cc: Thomas Petazzoni, Miquèl Raynal, linux-pwm, devicetree,
	sophgo, linux-kernel, Jingbao Qiu, Thomas Bonnefille

From: Jingbao Qiu <qiujingbao.dlmu@gmail.com>

Implement the PWM driver for CV1800.

Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
 drivers/pwm/Kconfig      |  10 ++
 drivers/pwm/Makefile     |   1 +
 drivers/pwm/pwm-cv1800.c | 294 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 305 insertions(+)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 4731d5b90d7edcc61138e4a5bf7e98906953ece4..d0a3d9c4f625820ac2e6cf81bae11527124c68a2 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -202,6 +202,16 @@ config PWM_CROS_EC
 	  PWM driver for exposing a PWM attached to the ChromeOS Embedded
 	  Controller.
 
+config PWM_CV1800
+	tristate "Sophgo CV1800 PWM driver"
+	depends on ARCH_SOPHGO || COMPILE_TEST
+	help
+	  Generic PWM framework driver for the Sophgo CV1800 series
+	  SoCs.
+
+	  To compile this driver as a module, build the dependencies
+	  as modules, this will be called pwm-cv1800.
+
 config PWM_DWC_CORE
 	tristate
 	depends on HAS_IOMEM
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 539e0def3f82fcb866ab83a0346a15f7efdd7127..20c49abde6082dc9b0dc0fa3eb68a0b57bceeeb1 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_PWM_CLK)		+= pwm-clk.o
 obj-$(CONFIG_PWM_CLPS711X)	+= pwm-clps711x.o
 obj-$(CONFIG_PWM_CRC)		+= pwm-crc.o
 obj-$(CONFIG_PWM_CROS_EC)	+= pwm-cros-ec.o
+obj-$(CONFIG_PWM_CV1800)	+= pwm-cv1800.o
 obj-$(CONFIG_PWM_DWC_CORE)	+= pwm-dwc-core.o
 obj-$(CONFIG_PWM_DWC)		+= pwm-dwc.o
 obj-$(CONFIG_PWM_EP93XX)	+= pwm-ep93xx.o
diff --git a/drivers/pwm/pwm-cv1800.c b/drivers/pwm/pwm-cv1800.c
new file mode 100644
index 0000000000000000000000000000000000000000..d5ba6f6e7e167789d1b3785ae3d262d954e2295d
--- /dev/null
+++ b/drivers/pwm/pwm-cv1800.c
@@ -0,0 +1,294 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Sophgo CV1800 PWM driver
+ * Author: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
+ *
+ * Limitations:
+ * - The hardware emits the inactive level when disabled.
+ * - This pwm device supports dynamic loading of PWM parameters. When PWMSTART
+ *   is written from 0 to 1, the register value (HLPERIODn, PERIODn) will be
+ *   temporarily stored inside the PWM. If you want to dynamically change the
+ *   waveform during PWM output, after writing the new value to HLPERIODn and
+ *   PERIODn, write 1 and then 0 to PWMUPDATE[n] to make the new value effective.
+ * - Supports output frequency ranging from input_clock_rate/(2^30-1) to input_clock_rate/2.
+ * - By setting HLPERIODn to 0, can produce 100% duty cycle.
+ * - This hardware could support inverted polarity. By default, the value of the
+ *   POLARITY register is 0x0. This means that HLPERIOD represents the number
+ *   of low level beats.
+ * - This hardware supports input mode and output mode, implemented through the
+ *   Output-Enable/OE register. However, this driver has not yet implemented
+ *   capture callback.
+ */
+
+#include <linux/clk.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/regmap.h>
+
+#define PWM_CV1800_POLARITY         0x40
+#define PWM_CV1800_START            0x44
+#define PWM_CV1800_DONE             0x48
+#define PWM_CV1800_UPDATE           0x4c
+#define PWM_CV1800_OE               0xd0
+
+#define PWM_CV1800_HLPERIOD(n)      (0x00 + ((n) * 0x08))
+#define PWM_CV1800_PERIOD(n)        (0x04 + ((n) * 0x08))
+
+#define PWM_CV1800_UPDATE_MASK(n)   BIT(n)
+#define PWM_CV1800_OE_MASK(n)       BIT(n)
+#define PWM_CV1800_START_MASK(n)    BIT(n)
+#define PWM_CV1800_POLARITY_MASK(n) BIT(n)
+
+#define PWM_CV1800_MAXPERIOD        0x3fffffff
+#define PWM_CV1800_MINPERIOD        2
+#define PWM_CV1800_CHANNELS         4
+#define PWM_CV1800_PERIOD_RESET     BIT(1)
+#define PWM_CV1800_HLPERIOD_RESET   BIT(0)
+#define PWM_CV1800_REG_ENABLE(n)    BIT(n)
+
+struct cv1800_pwm {
+	struct regmap *map;
+	struct clk *clk;
+	unsigned long clk_rate;
+};
+
+static inline struct cv1800_pwm *to_cv1800_pwm_dev(struct pwm_chip *chip)
+{
+	return pwmchip_get_drvdata(chip);
+}
+
+static const struct regmap_config cv1800_pwm_regmap_config = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.cache_type = REGCACHE_RBTREE,
+	.reg_stride = 4,
+};
+
+static int cv1800_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm,
+			     bool enable)
+{
+	struct cv1800_pwm *priv = to_cv1800_pwm_dev(chip);
+	u32 pwm_enabled;
+
+	regmap_read(priv->map, PWM_CV1800_START, &pwm_enabled);
+	pwm_enabled &= PWM_CV1800_START_MASK(pwm->hwpwm);
+
+	/*
+	 * If the parameters are changed during runtime, Register needs
+	 * to be updated to take effect.
+	 */
+
+	if (!enable) {
+		if (pwm_enabled)
+			regmap_clear_bits(priv->map, PWM_CV1800_START, BIT(pwm->hwpwm));
+		return 0;
+	} else if (pwm_enabled) {
+		/*
+		 * Updating the PWM parameters dynamically requires to send a pulse on the
+		 * PWMUPDATE register's nth bit, the value is updated only once a zero has been
+		 * written back to this nth bit
+		 */
+		regmap_set_bits(priv->map, PWM_CV1800_UPDATE, BIT(pwm->hwpwm));
+		regmap_clear_bits(priv->map, PWM_CV1800_UPDATE, BIT(pwm->hwpwm));
+	} else {
+		regmap_set_bits(priv->map, PWM_CV1800_START, BIT(pwm->hwpwm));
+	}
+
+	/* check and set OE/Output-Enable mode */
+	regmap_set_bits(priv->map, PWM_CV1800_OE, BIT(pwm->hwpwm));
+
+	return 0;
+}
+
+static void cv1800_pwm_set_polarity(struct pwm_chip *chip,
+				    struct pwm_device *pwm,
+				    enum pwm_polarity polarity)
+{
+	struct cv1800_pwm *priv = to_cv1800_pwm_dev(chip);
+	u32 config_polarity = 0;
+
+	if (pwm->state.enabled)
+		cv1800_pwm_enable(chip, pwm, false);
+
+	if (polarity == PWM_POLARITY_NORMAL)
+		config_polarity = PWM_CV1800_POLARITY_MASK(pwm->hwpwm);
+
+	regmap_update_bits(priv->map, PWM_CV1800_POLARITY,
+			   PWM_CV1800_POLARITY_MASK(pwm->hwpwm),
+			   config_polarity);
+}
+
+static int cv1800_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
+			    const struct pwm_state *state)
+{
+	struct cv1800_pwm *priv = to_cv1800_pwm_dev(chip);
+	u32 period_ticks, hlperiod_ticks;
+	u64 ticks;
+
+	/*
+	 * This hardware use PERIOD and HLPERIOD registers to represent PWM waves.
+	 *
+	 * The meaning of PERIOD is how many clock cycles (from the clock source)
+	 * are used to represent PWM waves.
+	 * PERIOD = rate(MHz) / target(MHz)
+	 * PERIOD = period(ns) * rate(Hz) / NSEC_PER_SEC
+	 */
+	ticks = mul_u64_u64_div_u64(state->period, priv->clk_rate,
+				    NSEC_PER_SEC);
+	if (ticks < PWM_CV1800_MINPERIOD)
+		return -EINVAL;
+
+	if (ticks > PWM_CV1800_MAXPERIOD)
+		ticks = PWM_CV1800_MAXPERIOD;
+	period_ticks = (u32)ticks;
+
+	/*
+	 * The HLPERIOD register value represents the duration of the active portion
+	 * of the PWM signal, which matches the polarity of the duty cycle.
+	 * HLPERIOD = rate(MHz) / duty(MHz)
+	 * HLPERIOD = duty(ns) * rate(Hz) / NSEC_PER_SEC
+	 */
+	ticks = mul_u64_u64_div_u64(state->duty_cycle, priv->clk_rate,
+				    NSEC_PER_SEC);
+	if (ticks > period_ticks)
+		ticks = period_ticks;
+	hlperiod_ticks = (u32)ticks;
+
+	if (state->polarity != pwm->state.polarity)
+		cv1800_pwm_set_polarity(chip, pwm, state->polarity);
+
+	regmap_write(priv->map, PWM_CV1800_PERIOD(pwm->hwpwm), period_ticks);
+	regmap_write(priv->map, PWM_CV1800_HLPERIOD(pwm->hwpwm), hlperiod_ticks);
+
+	cv1800_pwm_enable(chip, pwm, state->enabled);
+
+	return 0;
+}
+
+static int cv1800_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
+				struct pwm_state *state)
+{
+	struct cv1800_pwm *priv = to_cv1800_pwm_dev(chip);
+	u32 period_val, hlperiod_val;
+	u64 period_ns = 0, duty_ns = 0;
+	u32 enable = 0, polarity = 0;
+
+	regmap_read(priv->map, PWM_CV1800_PERIOD(pwm->hwpwm), &period_val);
+	regmap_read(priv->map, PWM_CV1800_HLPERIOD(pwm->hwpwm), &hlperiod_val);
+
+	if (period_val != PWM_CV1800_PERIOD_RESET ||
+	    hlperiod_val != PWM_CV1800_HLPERIOD_RESET) {
+		period_ns = DIV_ROUND_UP_ULL(period_val * NSEC_PER_SEC,
+					     priv->clk_rate);
+		duty_ns = DIV_ROUND_UP_ULL(hlperiod_val * NSEC_PER_SEC,
+					   priv->clk_rate);
+
+		regmap_read(priv->map, PWM_CV1800_START, &enable);
+		enable &= PWM_CV1800_START_MASK(pwm->hwpwm);
+
+		regmap_read(priv->map, PWM_CV1800_POLARITY, &polarity);
+		polarity &= PWM_CV1800_POLARITY_MASK(pwm->hwpwm);
+	}
+
+	state->period = period_ns;
+	state->duty_cycle = duty_ns;
+	state->enabled = enable;
+
+	/*
+	 * To ensure that duty and hlperiod represent the same polarity
+	 * the following mapping needs to be completed.
+	 *
+	 * |----------|------------|------------|-----------|
+	 * |  Linux   |  register  |    duty    | register  |
+	 * | polarity |  polarity  |            | hlperiod  |
+	 * |----------|------------|------------|-----------|
+	 * |    1     |      0     | low level  | low level |
+	 * |----------|------------|------------|-----------|
+	 * |    0     |      1     | high level | high level|
+	 * |----------|------------|------------|-----------|
+	 */
+	state->polarity = polarity ? PWM_POLARITY_NORMAL :
+					   PWM_POLARITY_INVERSED;
+
+	return 0;
+}
+
+static const struct pwm_ops cv1800_pwm_ops = {
+	.apply = cv1800_pwm_apply,
+	.get_state = cv1800_pwm_get_state,
+};
+
+static int cv1800_pwm_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cv1800_pwm *priv;
+	struct pwm_chip *chip;
+	void __iomem *base;
+	int ret;
+
+	chip = devm_pwmchip_alloc(dev, 4, sizeof(*priv));
+	if (!chip)
+		return PTR_ERR(chip);
+	priv = to_cv1800_pwm_dev(chip);
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	priv->map = devm_regmap_init_mmio(&pdev->dev, base,
+					  &cv1800_pwm_regmap_config);
+	if (IS_ERR(priv->map))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->map),
+				     "Couldn't create PWM regmap\n");
+
+	priv->clk = devm_clk_get_enabled(&pdev->dev, NULL);
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
+				     "clk not found\n");
+
+	ret = devm_clk_rate_exclusive_get(dev, priv->clk);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "failed to get exclusive rate\n");
+
+	priv->clk_rate = clk_get_rate(priv->clk);
+	if (!priv->clk_rate)
+		return dev_err_probe(&pdev->dev, -EINVAL,
+				     "Invalid clock rate: %lu\n",
+				     priv->clk_rate);
+	else if (priv->clk_rate > NSEC_PER_SEC)
+		return dev_err_probe(&pdev->dev, -EINVAL,
+				     "Clock rate too high: %lu\n",
+				     priv->clk_rate);
+	 ;
+
+	chip->ops = &cv1800_pwm_ops;
+
+	ret = devm_pwmchip_add(dev, chip);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add PWM chip\n");
+
+	return 0;
+}
+
+static const struct of_device_id cv1800_pwm_dt_ids[] = {
+	{ .compatible = "sophgo,cv1800-pwm" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cv1800_pwm_dt_ids);
+
+static struct platform_driver cv1800_pwm_driver = {
+	.probe = cv1800_pwm_probe,
+	.driver	= {
+		.name = "cv1800-pwm",
+		.of_match_table = cv1800_pwm_dt_ids,
+	},
+};
+module_platform_driver(cv1800_pwm_driver);
+
+MODULE_AUTHOR("Jingbao Qiu");
+MODULE_DESCRIPTION("Sophgo cv1800 PWM Driver");
+MODULE_LICENSE("GPL");

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800
  2025-05-09  9:45 [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Thomas Bonnefille
  2025-05-09  9:45 ` [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC Thomas Bonnefille
  2025-05-09  9:45 ` [PATCH v8 2/2] pwm: sophgo: add pwm support for Sophgo CV1800 SoC Thomas Bonnefille
@ 2025-05-09 12:14 ` Inochi Amaoto
  2025-05-26 16:31   ` Uwe Kleine-König
  2 siblings, 1 reply; 8+ messages in thread
From: Inochi Amaoto @ 2025-05-09 12:14 UTC (permalink / raw)
  To: Thomas Bonnefille, Uwe Kleine-König, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Chen Wang, Inochi Amaoto
  Cc: Thomas Petazzoni, Miquèl Raynal, linux-pwm, devicetree,
	sophgo, linux-kernel, Jingbao Qiu, Krzysztof Kozlowski

On Fri, May 09, 2025 at 11:45:42AM +0200, Thomas Bonnefille wrote:
> The Sophgo CV1800 chip provides a set of four independent
> PWM channel outputs.
> This series adds PWM controller support for Sophgo cv1800.
> 
> Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> [Thomas since v8]
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---

As now we have pwm support for SG2042, I suggest sharing driver code and
binding file with SG2042.

Regards,
Inochi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC
  2025-05-09  9:45 ` [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC Thomas Bonnefille
@ 2025-05-09 16:13   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2025-05-09 16:13 UTC (permalink / raw)
  To: Thomas Bonnefille
  Cc: Uwe Kleine-König, Krzysztof Kozlowski, Conor Dooley,
	Chen Wang, Inochi Amaoto, Thomas Petazzoni, Miquèl Raynal,
	linux-pwm, devicetree, sophgo, linux-kernel, Jingbao Qiu,
	Krzysztof Kozlowski

On Fri, May 09, 2025 at 11:45:43AM +0200, Thomas Bonnefille wrote:
> From: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> 
> Add devicetree binding to describe the PWM for Sophgo CV1800 SoC.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>

As the sender, you have to add your S-o-b as well.

Rob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800
  2025-05-09 12:14 ` [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Inochi Amaoto
@ 2025-05-26 16:31   ` Uwe Kleine-König
  2025-05-26 22:43     ` Inochi Amaoto
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2025-05-26 16:31 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Thomas Bonnefille, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chen Wang, Thomas Petazzoni, Miquèl Raynal, linux-pwm,
	devicetree, sophgo, linux-kernel, Jingbao Qiu,
	Krzysztof Kozlowski

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

On Fri, May 09, 2025 at 08:14:57PM +0800, Inochi Amaoto wrote:
> On Fri, May 09, 2025 at 11:45:42AM +0200, Thomas Bonnefille wrote:
> > The Sophgo CV1800 chip provides a set of four independent
> > PWM channel outputs.
> > This series adds PWM controller support for Sophgo cv1800.
> > 
> > Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> > [Thomas since v8]
> > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > ---
> 
> As now we have pwm support for SG2042, I suggest sharing driver code and
> binding file with SG2042.

How does the two relate? Is CV1800 the same as SG2042? I'd like to know
before I spend time reviewing a driver that is better spent elsewhere.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800
  2025-05-26 16:31   ` Uwe Kleine-König
@ 2025-05-26 22:43     ` Inochi Amaoto
  2025-06-16 13:05       ` Uwe Kleine-König
  0 siblings, 1 reply; 8+ messages in thread
From: Inochi Amaoto @ 2025-05-26 22:43 UTC (permalink / raw)
  To: Uwe Kleine-König, Inochi Amaoto
  Cc: Thomas Bonnefille, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chen Wang, Thomas Petazzoni, Miquèl Raynal, linux-pwm,
	devicetree, sophgo, linux-kernel, Jingbao Qiu,
	Krzysztof Kozlowski

On Mon, May 26, 2025 at 06:31:42PM +0200, Uwe Kleine-König wrote:
> On Fri, May 09, 2025 at 08:14:57PM +0800, Inochi Amaoto wrote:
> > On Fri, May 09, 2025 at 11:45:42AM +0200, Thomas Bonnefille wrote:
> > > The Sophgo CV1800 chip provides a set of four independent
> > > PWM channel outputs.
> > > This series adds PWM controller support for Sophgo cv1800.
> > > 
> > > Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> > > [Thomas since v8]
> > > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > > ---
> > 
> > As now we have pwm support for SG2042, I suggest sharing driver code and
> > binding file with SG2042.
> 
> How does the two relate? Is CV1800 the same as SG2042? I'd like to know
> before I spend time reviewing a driver that is better spent elsewhere.
> 

IIRC the pwm SG2044 is based on it on CV1800. And they both share some
common logic with SG2042, like setting PERIOD register. So I request a
merge for it.

Regards,
Inochi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800
  2025-05-26 22:43     ` Inochi Amaoto
@ 2025-06-16 13:05       ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2025-06-16 13:05 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Thomas Bonnefille, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chen Wang, Thomas Petazzoni, Miquèl Raynal, linux-pwm,
	devicetree, sophgo, linux-kernel, Jingbao Qiu,
	Krzysztof Kozlowski

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

Hello,

On Tue, May 27, 2025 at 06:43:06AM +0800, Inochi Amaoto wrote:
> On Mon, May 26, 2025 at 06:31:42PM +0200, Uwe Kleine-König wrote:
> > On Fri, May 09, 2025 at 08:14:57PM +0800, Inochi Amaoto wrote:
> > > On Fri, May 09, 2025 at 11:45:42AM +0200, Thomas Bonnefille wrote:
> > > > The Sophgo CV1800 chip provides a set of four independent
> > > > PWM channel outputs.
> > > > This series adds PWM controller support for Sophgo cv1800.
> > > > 
> > > > Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com>
> > > > [Thomas since v8]
> > > > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > > > ---
> > > 
> > > As now we have pwm support for SG2042, I suggest sharing driver code and
> > > binding file with SG2042.
> > 
> > How does the two relate? Is CV1800 the same as SG2042? I'd like to know
> > before I spend time reviewing a driver that is better spent elsewhere.
> > 
> 
> IIRC the pwm SG2044 is based on it on CV1800. And they both share some
> common logic with SG2042, like setting PERIOD register. So I request a
> merge for it.

To make this explict: Without having looked into the details, I agree
and so will discard this patch set from the set of waiting patches in
patchwork.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-16 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09  9:45 [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Thomas Bonnefille
2025-05-09  9:45 ` [PATCH v8 1/2] dt-bindings: pwm: sophgo: add pwm for Sophgo CV1800 series SoC Thomas Bonnefille
2025-05-09 16:13   ` Rob Herring
2025-05-09  9:45 ` [PATCH v8 2/2] pwm: sophgo: add pwm support for Sophgo CV1800 SoC Thomas Bonnefille
2025-05-09 12:14 ` [PATCH v8 0/2] riscv: pwm: sophgo: add pwm support for CV1800 Inochi Amaoto
2025-05-26 16:31   ` Uwe Kleine-König
2025-05-26 22:43     ` Inochi Amaoto
2025-06-16 13:05       ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).