Linux PWM subsystem development
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6
@ 2026-08-27  8:40 Xianwei Zhao via B4 Relay
  2026-08-27  8:40 ` [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-27  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Xianwei Zhao, Junyi Zhao, Krzysztof Kozlowski,
	Alexandre Mergnat

Add bindings and driver support Amlogic S7/S7D/S6 SoCs.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Changes in v4:
- It is divided into three submissions based on the function-driven part.
- Merge and modify functions for init clocks, According to Alexandre's suggestion.
- Link to v3: https://lore.kernel.org/r/20260521-s6-s7-pwm-v3-0-57b073fbafef@amlogic.com

Changes in v3:
- Use npwm instead of single_pwm in priv_data and format adjustments.
- Link to v2: https://lore.kernel.org/r/20260402-s6-s7-pwm-v2-0-657dce040956@amlogic.com

Changes in v2:
- Simpler s7 clock desc, and drop the example in bindings.
- Make minor changes to probe based on Martin's suggestion.
- Link to v1: https://lore.kernel.org/r/20260326-s6-s7-pwm-v1-0-67e2f72b98bc@amlogic.com

---
Junyi Zhao (1):
      dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D

Xianwei Zhao (3):
      pwm: meson: add the PWM count driver data
      pwm: meson: use bulk API for per-channel clocks
      pwm: meson: Add support for Amlogic S7

 .../devicetree/bindings/pwm/pwm-amlogic.yaml       | 19 ++++++
 drivers/pwm/pwm-meson.c                            | 73 +++++++++++++---------
 2 files changed, 63 insertions(+), 29 deletions(-)
---
base-commit: b1385d0c7b7c633e55adcf4a7c1ef46c43a84a4a
change-id: 20260325-s6-s7-pwm-281658b88736

Best regards,
-- 
Xianwei Zhao <xianwei.zhao@amlogic.com>



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

* [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D
  2026-08-27  8:40 [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay
@ 2026-08-27  8:40 ` Xianwei Zhao via B4 Relay
  2026-11-30  8:34   ` Uwe Kleine-König
  2026-08-27  8:40 ` [PATCH v4 2/4] pwm: meson: add the PWM count driver data Xianwei Zhao via B4 Relay
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 19+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-27  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Xianwei Zhao, Junyi Zhao, Krzysztof Kozlowski,
	Alexandre Mergnat

From: Junyi Zhao <junyi.zhao@amlogic.com>

Amlogic S7/S7D/S6 different from the previous SoCs, a controller
includes one pwm, at the same time, the controller has only one
input clock source.

Signed-off-by: Junyi Zhao <junyi.zhao@amlogic.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
 .../devicetree/bindings/pwm/pwm-amlogic.yaml          | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
index c337d85da40f..93fa97f4011b 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
+++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
@@ -37,6 +37,7 @@ properties:
       - enum:
           - amlogic,meson8-pwm-v2
           - amlogic,meson-s4-pwm
+          - amlogic,s7-pwm
       - items:
           - enum:
               - amlogic,a4-pwm
@@ -45,6 +46,11 @@ properties:
               - amlogic,t7-pwm
               - amlogic,meson-a1-pwm
           - const: amlogic,meson-s4-pwm
+      - items:
+          - enum:
+              - amlogic,s6-pwm
+              - amlogic,s7d-pwm
+          - const: amlogic,s7-pwm
       - items:
           - enum:
               - amlogic,meson8b-pwm-v2
@@ -146,6 +152,19 @@ allOf:
         clock-names: false
       required:
         - clocks
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,s7-pwm
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names: false
+      required:
+        - clocks
 
   - if:
       properties:

-- 
2.52.0



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

* [PATCH v4 2/4] pwm: meson: add the PWM count driver data
  2026-08-27  8:40 [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay
  2026-08-27  8:40 ` [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
@ 2026-08-27  8:40 ` Xianwei Zhao via B4 Relay
  2026-09-07 15:19   ` Alexandre Mergnat
  2026-11-30  8:39   ` Uwe Kleine-König
  2026-08-27  8:40 ` [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks Xianwei Zhao via B4 Relay
  2026-08-27  8:40 ` [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
  3 siblings, 2 replies; 19+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-27  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Xianwei Zhao

From: Xianwei Zhao <xianwei.zhao@amlogic.com>

Add .npwm fill the  existing entries, use it in probe, and switch the loop
in meson_pwm_init_clocks_meson8b() and meson_pwm_init_channels_s4() to
chip->npwm. No functional change.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
 drivers/pwm/pwm-meson.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 8c6bf3d49753..22cefc6d5dd0 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -113,6 +113,7 @@ struct meson_pwm_data {
 	int (*channels_init)(struct pwm_chip *chip);
 	bool has_constant;
 	bool has_polarity;
+	u8 npwm;
 };
 
 struct meson_pwm {
@@ -382,7 +383,7 @@ static int meson_pwm_init_clocks_meson8b(struct pwm_chip *chip,
 	char name[255];
 	int err;
 
-	for (i = 0; i < MESON_NUM_PWMS; i++) {
+	for (i = 0; i < chip->npwm; i++) {
 		struct meson_pwm_channel *channel = &meson->channels[i];
 		struct clk_parent_data div_parent = {}, gate_parent = {};
 		struct clk_init_data init = {};
@@ -510,7 +511,7 @@ static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
 	struct meson_pwm *meson = to_meson_pwm(chip);
 	int i, ret;
 
-	for (i = 0; i < MESON_NUM_PWMS; i++) {
+	for (i = 0; i < chip->npwm; i++) {
 		meson->channels[i].clk = of_clk_get(np, i);
 		if (IS_ERR(meson->channels[i].clk))
 			return dev_err_probe(dev,
@@ -530,6 +531,7 @@ static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
 static const struct meson_pwm_data pwm_meson8b_data = {
 	.parent_names = { "xtal", NULL, "fclk_div4", "fclk_div3" },
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
+	.npwm = 2,
 };
 
 /*
@@ -539,6 +541,7 @@ static const struct meson_pwm_data pwm_meson8b_data = {
 static const struct meson_pwm_data pwm_gxbb_ao_data = {
 	.parent_names = { "xtal", "clk81", NULL, NULL },
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_axg_ee_data = {
@@ -546,6 +549,7 @@ static const struct meson_pwm_data pwm_axg_ee_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_axg_ao_data = {
@@ -553,6 +557,7 @@ static const struct meson_pwm_data pwm_axg_ao_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_g12a_ee_data = {
@@ -560,6 +565,7 @@ static const struct meson_pwm_data pwm_g12a_ee_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_g12a_ao_ab_data = {
@@ -567,6 +573,7 @@ static const struct meson_pwm_data pwm_g12a_ao_ab_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_g12a_ao_cd_data = {
@@ -574,22 +581,26 @@ static const struct meson_pwm_data pwm_g12a_ao_cd_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_legacy,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_meson8_v2_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_v2,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_meson_axg_v2_data = {
 	.channels_init = meson_pwm_init_channels_meson8b_v2,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct meson_pwm_data pwm_s4_data = {
 	.channels_init = meson_pwm_init_channels_s4,
 	.has_constant = true,
 	.has_polarity = true,
+	.npwm = 2,
 };
 
 static const struct of_device_id meson_pwm_matches[] = {
@@ -650,9 +661,10 @@ static int meson_pwm_probe(struct platform_device *pdev)
 {
 	struct pwm_chip *chip;
 	struct meson_pwm *meson;
+	const struct meson_pwm_data *pdata = of_device_get_match_data(&pdev->dev);
 	int err;
 
-	chip = devm_pwmchip_alloc(&pdev->dev, MESON_NUM_PWMS, sizeof(*meson));
+	chip = devm_pwmchip_alloc(&pdev->dev, pdata->npwm, sizeof(*meson));
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
 	meson = to_meson_pwm(chip);
@@ -664,7 +676,7 @@ static int meson_pwm_probe(struct platform_device *pdev)
 	spin_lock_init(&meson->lock);
 	chip->ops = &meson_pwm_ops;
 
-	meson->data = of_device_get_match_data(&pdev->dev);
+	meson->data = pdata;
 
 	err = meson->data->channels_init(chip);
 	if (err < 0)

-- 
2.52.0



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

* [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks
  2026-08-27  8:40 [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay
  2026-08-27  8:40 ` [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
  2026-08-27  8:40 ` [PATCH v4 2/4] pwm: meson: add the PWM count driver data Xianwei Zhao via B4 Relay
@ 2026-08-27  8:40 ` Xianwei Zhao via B4 Relay
  2026-09-07 15:22   ` Alexandre Mergnat
  2026-11-30  8:53   ` Uwe Kleine-König
  2026-08-27  8:40 ` [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
  3 siblings, 2 replies; 19+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-27  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Xianwei Zhao

From: Xianwei Zhao <xianwei.zhao@amlogic.com>

The S4 PWM driver currently gets each channel clock individually with
of_clk_get() and uses a custom cleanup action to release the clocks.

Use devm_clk_bulk_get_all() instead to retrieve all per-channel clocks
at once. Verify that the number of clocks matches the number of PWM
channels and assign each clock to its corresponding channel.

This also allows the per-channel clock initialization code to be shared
by Meson PWM variants using one clock per channel.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
 drivers/pwm/pwm-meson.c | 40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 22cefc6d5dd0..6f151464d7cc 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -497,33 +497,25 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip)
 	return meson_pwm_init_clocks_meson8b(chip, mux_parent_data);
 }
 
-static void meson_pwm_s4_put_clk(void *data)
-{
-	struct clk *clk = data;
-
-	clk_put(clk);
-}
-
-static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
+static int meson_pwm_init_channels_per_channel_clk(struct pwm_chip *chip)
 {
 	struct device *dev = pwmchip_parent(chip);
-	struct device_node *np = dev->of_node;
 	struct meson_pwm *meson = to_meson_pwm(chip);
-	int i, ret;
+	struct clk_bulk_data *clks;
+	unsigned int i;
+	int num;
 
-	for (i = 0; i < chip->npwm; i++) {
-		meson->channels[i].clk = of_clk_get(np, i);
-		if (IS_ERR(meson->channels[i].clk))
-			return dev_err_probe(dev,
-					     PTR_ERR(meson->channels[i].clk),
-					     "Failed to get clk\n");
-
-		ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
-					       meson->channels[i].clk);
-		if (ret)
-			return dev_err_probe(dev, ret,
-					     "Failed to add clk_put action\n");
-	}
+	num = devm_clk_bulk_get_all(dev, &clks);
+	if (num < 0)
+		return dev_err_probe(dev, num, "Failed to get clocks\n");
+
+	if (num != chip->npwm)
+		return dev_err_probe(dev, -EINVAL,
+				"expected %u clocks, got %d\n",
+				chip->npwm, num);
+
+	for (i = 0; i < chip->npwm; i++)
+		meson->channels[i].clk = clks[i].clk;
 
 	return 0;
 }
@@ -597,7 +589,7 @@ static const struct meson_pwm_data pwm_meson_axg_v2_data = {
 };
 
 static const struct meson_pwm_data pwm_s4_data = {
-	.channels_init = meson_pwm_init_channels_s4,
+	.channels_init = meson_pwm_init_channels_per_channel_clk,
 	.has_constant = true,
 	.has_polarity = true,
 	.npwm = 2,

-- 
2.52.0



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

* [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7
  2026-08-27  8:40 [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay
                   ` (2 preceding siblings ...)
  2026-08-27  8:40 ` [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks Xianwei Zhao via B4 Relay
@ 2026-08-27  8:40 ` Xianwei Zhao via B4 Relay
  2026-09-07 15:26   ` Alexandre Mergnat
  2026-11-30  8:57   ` Uwe Kleine-König
  3 siblings, 2 replies; 19+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-08-27  8:40 UTC (permalink / raw)
  To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Xianwei Zhao

From: Xianwei Zhao <xianwei.zhao@amlogic.com>

Add support for Amlogic S7 PWM. Amlogic S7 different from the previous
SoCs, a controller includes one pwm, at the same time,the controller has
only one input clock source.

Also use the kernel coding style for the empty of_device_id terminator.

Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
 drivers/pwm/pwm-meson.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 6f151464d7cc..2da958231719 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -595,6 +595,13 @@ static const struct meson_pwm_data pwm_s4_data = {
 	.npwm = 2,
 };
 
+static const struct meson_pwm_data pwm_s7_data = {
+	.channels_init = meson_pwm_init_channels_per_channel_clk,
+	.has_constant = true,
+	.has_polarity = true,
+	.npwm = 1,
+};
+
 static const struct of_device_id meson_pwm_matches[] = {
 	{
 		.compatible = "amlogic,meson8-pwm-v2",
@@ -645,7 +652,11 @@ static const struct of_device_id meson_pwm_matches[] = {
 		.compatible = "amlogic,meson-s4-pwm",
 		.data = &pwm_s4_data
 	},
-	{},
+	{
+		.compatible = "amlogic,s7-pwm",
+		.data = &pwm_s7_data
+	},
+	{ }
 };
 MODULE_DEVICE_TABLE(of, meson_pwm_matches);
 

-- 
2.52.0



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

* Re: [PATCH v4 2/4] pwm: meson: add the PWM count driver data
  2026-08-27  8:40 ` [PATCH v4 2/4] pwm: meson: add the PWM count driver data Xianwei Zhao via B4 Relay
@ 2026-09-07 15:19   ` Alexandre Mergnat
  2026-11-30  8:39   ` Uwe Kleine-König
  1 sibling, 0 replies; 19+ messages in thread
From: Alexandre Mergnat @ 2026-09-07 15:19 UTC (permalink / raw)
  To: Xianwei Zhao
  Cc: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-pwm, devicetree,
	linux-kernel, linux-arm-kernel, linux-amlogic

> Add .npwm fill the  existing entries, use it in probe, and switch the loop
> in meson_pwm_init_clocks_meson8b() and meson_pwm_init_channels_s4() to
> chip->npwm. No functional change.
> 
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 8c6bf3d49753..22cefc6d5dd0 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -113,6 +113,7 @@ struct meson_pwm_data {
>  	int (*channels_init)(struct pwm_chip *chip);

The commit message has a small typo ("Add .npwm fill the  existing entries" has
a double space.

beside that:
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>

-- 
Alexandre Mergnat <amergnat@baylibre.com>

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

* Re: [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks
  2026-08-27  8:40 ` [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks Xianwei Zhao via B4 Relay
@ 2026-09-07 15:22   ` Alexandre Mergnat
  2026-09-07 18:44     ` Uwe Kleine-König
  2026-11-30  8:53   ` Uwe Kleine-König
  1 sibling, 1 reply; 19+ messages in thread
From: Alexandre Mergnat @ 2026-09-07 15:22 UTC (permalink / raw)
  To: Xianwei Zhao
  Cc: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-pwm, devicetree,
	linux-kernel, linux-arm-kernel, linux-amlogic

> The S4 PWM driver currently gets each channel clock individually with
> of_clk_get() and uses a custom cleanup action to release the clocks.
> 
> Use devm_clk_bulk_get_all() instead to retrieve all per-channel clocks
> at once. Verify that the number of clocks matches the number of PWM
> channels and assign each clock to its corresponding channel.
> 
> This also allows the per-channel clock initialization code to be shared
> by Meson PWM variants using one clock per channel.
> 
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 22cefc6d5dd0..6f151464d7cc 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -497,33 +497,25 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip)
>  	return meson_pwm_init_clocks_meson8b(chip, mux_parent_data);
>  }
>  
> -static void meson_pwm_s4_put_clk(void *data)
> -{
> -	struct clk *clk = data;
> -
> -	clk_put(clk);
> -}
> -
> -static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
> +static int meson_pwm_init_channels_per_channel_clk(struct pwm_chip *chip)
>  {
>  	struct device *dev = pwmchip_parent(chip);
> -	struct device_node *np = dev->of_node;
>  	struct meson_pwm *meson = to_meson_pwm(chip);
> -	int i, ret;
> +	struct clk_bulk_data *clks;
> +	unsigned int i;
> +	int num;
>  
> -	for (i = 0; i < chip->npwm; i++) {
> -		meson->channels[i].clk = of_clk_get(np, i);
> -		if (IS_ERR(meson->channels[i].clk))
> -			return dev_err_probe(dev,
> -					     PTR_ERR(meson->channels[i].clk),
> -					     "Failed to get clk\n");
> -
> -		ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
> -					       meson->channels[i].clk);
> -		if (ret)
> -			return dev_err_probe(dev, ret,
> -					     "Failed to add clk_put action\n");
> -	}
> +	num = devm_clk_bulk_get_all(dev, &clks);
> +	if (num < 0)
> +		return dev_err_probe(dev, num, "Failed to get clocks\n");
> +
> +	if (num != chip->npwm)
> +		return dev_err_probe(dev, -EINVAL,
> +				"expected %u clocks, got %d\n",

Small style nit: the continuation arguments are not aligned with the open
parenthesis, whereas the dev_err_probe() just above and the rest of the driver
do align them. Can you fix it please ?

After that,
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>

-- 
Alexandre Mergnat <amergnat@baylibre.com>

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

* Re: [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7
  2026-08-27  8:40 ` [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
@ 2026-09-07 15:26   ` Alexandre Mergnat
  2026-11-30  8:57   ` Uwe Kleine-König
  1 sibling, 0 replies; 19+ messages in thread
From: Alexandre Mergnat @ 2026-09-07 15:26 UTC (permalink / raw)
  To: Xianwei Zhao
  Cc: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiner Kallweit, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-pwm, devicetree,
	linux-kernel, linux-arm-kernel, linux-amlogic

> Add support for Amlogic S7 PWM. Amlogic S7 different from the previous
> SoCs, a controller includes one pwm, at the same time,the controller has
> only one input clock source.
> 
> Also use the kernel coding style for the empty of_device_id terminator.
> 
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>

-- 
Alexandre Mergnat <amergnat@baylibre.com>

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

* Re: [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks
  2026-09-07 15:22   ` Alexandre Mergnat
@ 2026-09-07 18:44     ` Uwe Kleine-König
  2026-11-11  2:44       ` Xianwei Zhao
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2026-09-07 18:44 UTC (permalink / raw)
  To: Alexandre Mergnat
  Cc: Xianwei Zhao, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiner Kallweit, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-pwm, devicetree, linux-kernel,
	linux-arm-kernel, linux-amlogic

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

Hello,

On Mon, Sep 07, 2026 at 05:22:44PM +0200, Alexandre Mergnat wrote:
> > The S4 PWM driver currently gets each channel clock individually with
> > of_clk_get() and uses a custom cleanup action to release the clocks.
> > 
> > Use devm_clk_bulk_get_all() instead to retrieve all per-channel clocks
> > at once. Verify that the number of clocks matches the number of PWM
> > channels and assign each clock to its corresponding channel.
> > 
> > This also allows the per-channel clock initialization code to be shared
> > by Meson PWM variants using one clock per channel.
> > 
> > Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> >
> > diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> > index 22cefc6d5dd0..6f151464d7cc 100644
> > --- a/drivers/pwm/pwm-meson.c
> > +++ b/drivers/pwm/pwm-meson.c
> > @@ -497,33 +497,25 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip)
> >  	return meson_pwm_init_clocks_meson8b(chip, mux_parent_data);
> >  }
> >  
> > -static void meson_pwm_s4_put_clk(void *data)
> > -{
> > -	struct clk *clk = data;
> > -
> > -	clk_put(clk);
> > -}
> > -
> > -static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
> > +static int meson_pwm_init_channels_per_channel_clk(struct pwm_chip *chip)
> >  {
> >  	struct device *dev = pwmchip_parent(chip);
> > -	struct device_node *np = dev->of_node;
> >  	struct meson_pwm *meson = to_meson_pwm(chip);
> > -	int i, ret;
> > +	struct clk_bulk_data *clks;
> > +	unsigned int i;
> > +	int num;
> >  
> > -	for (i = 0; i < chip->npwm; i++) {
> > -		meson->channels[i].clk = of_clk_get(np, i);
> > -		if (IS_ERR(meson->channels[i].clk))
> > -			return dev_err_probe(dev,
> > -					     PTR_ERR(meson->channels[i].clk),
> > -					     "Failed to get clk\n");
> > -
> > -		ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
> > -					       meson->channels[i].clk);
> > -		if (ret)
> > -			return dev_err_probe(dev, ret,
> > -					     "Failed to add clk_put action\n");
> > -	}
> > +	num = devm_clk_bulk_get_all(dev, &clks);
> > +	if (num < 0)
> > +		return dev_err_probe(dev, num, "Failed to get clocks\n");
> > +
> > +	if (num != chip->npwm)
> > +		return dev_err_probe(dev, -EINVAL,
> > +				"expected %u clocks, got %d\n",
> 
> Small style nit: the continuation arguments are not aligned with the open
> parenthesis, whereas the dev_err_probe() just above and the rest of the driver
> do align them. Can you fix it please ?

No need to resend for that, I can fix that up while applying (after
checking I don't have further concerns).

Thanks Alex for your review!

Best regards
Uwe

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

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

* Re: [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks
  2026-09-07 18:44     ` Uwe Kleine-König
@ 2026-11-11  2:44       ` Xianwei Zhao
  0 siblings, 0 replies; 19+ messages in thread
From: Xianwei Zhao @ 2026-11-11  2:44 UTC (permalink / raw)
  To: Uwe Kleine-König, Alexandre Mergnat
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic

Hi Uwe,
    Thanks for your review.

On 2026/9/8 02:44, Uwe Kleine-König wrote:
> 
> Hello,
> 
> On Mon, Sep 07, 2026 at 05:22:44PM +0200, Alexandre Mergnat wrote:
>>> The S4 PWM driver currently gets each channel clock individually with
>>> of_clk_get() and uses a custom cleanup action to release the clocks.
>>>
>>> Use devm_clk_bulk_get_all() instead to retrieve all per-channel clocks
>>> at once. Verify that the number of clocks matches the number of PWM
>>> channels and assign each clock to its corresponding channel.
>>>
>>> This also allows the per-channel clock initialization code to be shared
>>> by Meson PWM variants using one clock per channel.
>>>
>>> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com>
>>>
>>> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
>>> index 22cefc6d5dd0..6f151464d7cc 100644
>>> --- a/drivers/pwm/pwm-meson.c
>>> +++ b/drivers/pwm/pwm-meson.c
>>> @@ -497,33 +497,25 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip)
>>>   	return meson_pwm_init_clocks_meson8b(chip, mux_parent_data);
>>>   }
>>>   
>>> -static void meson_pwm_s4_put_clk(void *data)
>>> -{
>>> -	struct clk *clk = data;
>>> -
>>> -	clk_put(clk);
>>> -}
>>> -
>>> -static int meson_pwm_init_channels_s4(struct pwm_chip *chip)
>>> +static int meson_pwm_init_channels_per_channel_clk(struct pwm_chip *chip)
>>>   {
>>>   	struct device *dev = pwmchip_parent(chip);
>>> -	struct device_node *np = dev->of_node;
>>>   	struct meson_pwm *meson = to_meson_pwm(chip);
>>> -	int i, ret;
>>> +	struct clk_bulk_data *clks;
>>> +	unsigned int i;
>>> +	int num;
>>>   
>>> -	for (i = 0; i < chip->npwm; i++) {
>>> -		meson->channels[i].clk = of_clk_get(np, i);
>>> -		if (IS_ERR(meson->channels[i].clk))
>>> -			return dev_err_probe(dev,
>>> -					     PTR_ERR(meson->channels[i].clk),
>>> -					     "Failed to get clk\n");
>>> -
>>> -		ret = devm_add_action_or_reset(dev, meson_pwm_s4_put_clk,
>>> -					       meson->channels[i].clk);
>>> -		if (ret)
>>> -			return dev_err_probe(dev, ret,
>>> -					     "Failed to add clk_put action\n");
>>> -	}
>>> +	num = devm_clk_bulk_get_all(dev, &clks);
>>> +	if (num < 0)
>>> +		return dev_err_probe(dev, num, "Failed to get clocks\n");
>>> +
>>> +	if (num != chip->npwm)
>>> +		return dev_err_probe(dev, -EINVAL,
>>> +				"expected %u clocks, got %d\n",
>> Small style nit: the continuation arguments are not aligned with the open
>> parenthesis, whereas the dev_err_probe() just above and the rest of the driver
>> do align them. Can you fix it please ?
> No need to resend for that, I can fix that up while applying (after
> checking I don't have further concerns).
> 
> Thanks Alex for your review!
> 

Is there anything else I need to do before this patch can be merged?

> Best regards
> Uwe

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

* Re: [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D
  2026-08-27  8:40 ` [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
@ 2026-11-30  8:34   ` Uwe Kleine-König
  2026-11-30 10:10     ` Xianwei Zhao
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2026-11-30  8:34 UTC (permalink / raw)
  To: xianwei.zhao
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Junyi Zhao, Krzysztof Kozlowski, Alexandre Mergnat

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

On Thu, Aug 27, 2026 at 08:40:10AM +0000, Xianwei Zhao via B4 Relay wrote:
> From: Junyi Zhao <junyi.zhao@amlogic.com>
> 
> Amlogic S7/S7D/S6 different from the previous SoCs, a controller
> includes one pwm, at the same time, the controller has only one
> input clock source.
> 
> Signed-off-by: Junyi Zhao <junyi.zhao@amlogic.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> ---
>  .../devicetree/bindings/pwm/pwm-amlogic.yaml          | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> index c337d85da40f..93fa97f4011b 100644
> --- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> +++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> @@ -37,6 +37,7 @@ properties:
>        - enum:
>            - amlogic,meson8-pwm-v2
>            - amlogic,meson-s4-pwm
> +          - amlogic,s7-pwm
>        - items:
>            - enum:
>                - amlogic,a4-pwm
> @@ -45,6 +46,11 @@ properties:
>                - amlogic,t7-pwm
>                - amlogic,meson-a1-pwm
>            - const: amlogic,meson-s4-pwm
> +      - items:
> +          - enum:
> +              - amlogic,s6-pwm
> +              - amlogic,s7d-pwm
> +          - const: amlogic,s7-pwm
>        - items:
>            - enum:
>                - amlogic,meson8b-pwm-v2
> @@ -146,6 +152,19 @@ allOf:
>          clock-names: false
>        required:
>          - clocks
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - amlogic,s7-pwm
> +    then:
> +      properties:
> +        clocks:
> +          maxItems: 1
> +        clock-names: false

The clock doesn't have a name? It's fine for me to keep as suggested in
this patch, but maybe it would be cleaner to state a name just to make
it easier to match to the reference for a human?!

Best regards
Uwe

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

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

* Re: [PATCH v4 2/4] pwm: meson: add the PWM count driver data
  2026-08-27  8:40 ` [PATCH v4 2/4] pwm: meson: add the PWM count driver data Xianwei Zhao via B4 Relay
  2026-09-07 15:19   ` Alexandre Mergnat
@ 2026-11-30  8:39   ` Uwe Kleine-König
  2026-11-30 10:06     ` Xianwei Zhao
  1 sibling, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2026-11-30  8:39 UTC (permalink / raw)
  To: xianwei.zhao
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic

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

Hello,

On Thu, Aug 27, 2026 at 08:40:11AM +0000, Xianwei Zhao via B4 Relay wrote:
> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
> 
> Add .npwm fill the  existing entries, use it in probe, and switch the loop
> in meson_pwm_init_clocks_meson8b() and meson_pwm_init_channels_s4() to
> chip->npwm. No functional change.

I'd write:

	To prepare adding support for XYZ which doesn't have 2 but 17
	PWM outputs, make the various loops iterater using chip->npwm
	instead of the constant MESON_NUM_PWMS.

I would expect that MESON_NUM_PWMS can be dropped in this commit?

Otherwise looks fine.

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

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

* Re: [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks
  2026-08-27  8:40 ` [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks Xianwei Zhao via B4 Relay
  2026-09-07 15:22   ` Alexandre Mergnat
@ 2026-11-30  8:53   ` Uwe Kleine-König
  1 sibling, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2026-11-30  8:53 UTC (permalink / raw)
  To: xianwei.zhao
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Alexandre Mergnat

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

Hello,

On Thu, Aug 27, 2026 at 08:40:12AM +0000, Xianwei Zhao via B4 Relay wrote:
> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
> 
> The S4 PWM driver currently gets each channel clock individually with
> of_clk_get() and uses a custom cleanup action to release the clocks.
> 
> Use devm_clk_bulk_get_all() instead to retrieve all per-channel clocks
> at once. Verify that the number of clocks matches the number of PWM
> channels and assign each clock to its corresponding channel.
> 
> This also allows the per-channel clock initialization code to be shared
> by Meson PWM variants using one clock per channel.
> 
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>

I applied this patch (after some trivial conflict resulution due to not
having the 2nd patch yet) with the indention fix that Alex pointed out
and his Review-by: tag to

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next

When you respin the series, please make sure your base contains that
commit already.

Best regards
Uwe

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

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

* Re: [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7
  2026-08-27  8:40 ` [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
  2026-09-07 15:26   ` Alexandre Mergnat
@ 2026-11-30  8:57   ` Uwe Kleine-König
  2026-11-30 10:03     ` Xianwei Zhao
  1 sibling, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2026-11-30  8:57 UTC (permalink / raw)
  To: xianwei.zhao
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic

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

On Thu, Aug 27, 2026 at 08:40:13AM +0000, Xianwei Zhao via B4 Relay wrote:
> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
> 
> Add support for Amlogic S7 PWM. Amlogic S7 different from the previous
> SoCs, a controller includes one pwm, at the same time,the controller has
> only one input clock source.

nitpick: s/,/, /

> Also use the kernel coding style for the empty of_device_id terminator.
> 
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> ---
>  drivers/pwm/pwm-meson.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 6f151464d7cc..2da958231719 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -595,6 +595,13 @@ static const struct meson_pwm_data pwm_s4_data = {
>  	.npwm = 2,
>  };
>  
> +static const struct meson_pwm_data pwm_s7_data = {
> +	.channels_init = meson_pwm_init_channels_per_channel_clk,
> +	.has_constant = true,
> +	.has_polarity = true,
> +	.npwm = 1,
> +};
> +
>  static const struct of_device_id meson_pwm_matches[] = {
>  	{
>  		.compatible = "amlogic,meson8-pwm-v2",
> @@ -645,7 +652,11 @@ static const struct of_device_id meson_pwm_matches[] = {
>  		.compatible = "amlogic,meson-s4-pwm",
>  		.data = &pwm_s4_data
>  	},
> -	{},
> +	{
> +		.compatible = "amlogic,s7-pwm",
> +		.data = &pwm_s7_data

Missing , after the assignment to .data, but that is a pre-existing
inconsistency. If you want address it in a separate patch together with
consistently using `}, {` (or if you prefer `},\n\t{`) between the
entries.

> +	},
> +	{ }

Further above there is a note:

        /* The following compatibles are obsolete */

I guess that doesn't apply to this new compatible and thus it should
better be added above that comment.

Best regards
Uwe

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

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

* Re: [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7
  2026-11-30  8:57   ` Uwe Kleine-König
@ 2026-11-30 10:03     ` Xianwei Zhao
  0 siblings, 0 replies; 19+ messages in thread
From: Xianwei Zhao @ 2026-11-30 10:03 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic

Hi Uwe,
    Thanks for your review.

On 2026/11/30 16:57, Uwe Kleine-König wrote:
> On Thu, Aug 27, 2026 at 08:40:13AM +0000, Xianwei Zhao via B4 Relay wrote:
>> From: Xianwei Zhao<xianwei.zhao@amlogic.com>
>>
>> Add support for Amlogic S7 PWM. Amlogic S7 different from the previous
>> SoCs, a controller includes one pwm, at the same time,the controller has
>> only one input clock source.
> nitpick: s/,/, /
>

Will do.

>> Also use the kernel coding style for the empty of_device_id terminator.
>>
>> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com>
>> ---
>>   drivers/pwm/pwm-meson.c | 13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
>> index 6f151464d7cc..2da958231719 100644
>> --- a/drivers/pwm/pwm-meson.c
>> +++ b/drivers/pwm/pwm-meson.c
>> @@ -595,6 +595,13 @@ static const struct meson_pwm_data pwm_s4_data = {
>>   	.npwm = 2,
>>   };
>>   
>> +static const struct meson_pwm_data pwm_s7_data = {
>> +	.channels_init = meson_pwm_init_channels_per_channel_clk,
>> +	.has_constant = true,
>> +	.has_polarity = true,
>> +	.npwm = 1,
>> +};
>> +
>>   static const struct of_device_id meson_pwm_matches[] = {
>>   	{
>>   		.compatible = "amlogic,meson8-pwm-v2",
>> @@ -645,7 +652,11 @@ static const struct of_device_id meson_pwm_matches[] = {
>>   		.compatible = "amlogic,meson-s4-pwm",
>>   		.data = &pwm_s4_data
>>   	},
>> -	{},
>> +	{
>> +		.compatible = "amlogic,s7-pwm",
>> +		.data = &pwm_s7_data
> Missing , after the assignment to .data, but that is a pre-existing
> inconsistency. If you want address it in a separate patch together with
> consistently using `}, {` (or if you prefer `},\n\t{`) between the
> entries.
> 
I will send a separate patch to address this later. For now, I'd prefer 
to keep it consistent with the existing code.

>> +	},
>> +	{ }
> Further above there is a note:
> 
>          /* The following compatibles are obsolete */
> 
> I guess that doesn't apply to this new compatible and thus it should
> better be added above that comment.
> 

Will do.

> Best regards
> Uwe

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

* Re: [PATCH v4 2/4] pwm: meson: add the PWM count driver data
  2026-11-30  8:39   ` Uwe Kleine-König
@ 2026-11-30 10:06     ` Xianwei Zhao
  0 siblings, 0 replies; 19+ messages in thread
From: Xianwei Zhao @ 2026-11-30 10:06 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic

Hi Uwe,
    Thanks for your review.

On 2026/11/30 16:39, Uwe Kleine-König wrote:
> 
> Hello,
> 
> On Thu, Aug 27, 2026 at 08:40:11AM +0000, Xianwei Zhao via B4 Relay wrote:
>> From: Xianwei Zhao<xianwei.zhao@amlogic.com>
>>
>> Add .npwm fill the  existing entries, use it in probe, and switch the loop
>> in meson_pwm_init_clocks_meson8b() and meson_pwm_init_channels_s4() to
>> chip->npwm. No functional change.
> I'd write:
> 
> 	To prepare adding support for XYZ which doesn't have 2 but 17
> 	PWM outputs, make the various loops iterater using chip->npwm
> 	instead of the constant MESON_NUM_PWMS.
> 
> I would expect that MESON_NUM_PWMS can be dropped in this commit?
> 

I will follow your log when writing the commit message.

> Otherwise looks fine.

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

* Re: [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D
  2026-11-30  8:34   ` Uwe Kleine-König
@ 2026-11-30 10:10     ` Xianwei Zhao
  2026-11-30 11:16       ` Uwe Kleine-König
  0 siblings, 1 reply; 19+ messages in thread
From: Xianwei Zhao @ 2026-11-30 10:10 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Junyi Zhao, Krzysztof Kozlowski, Alexandre Mergnat

Hi Uwe,
    Thanks for your reveiw.

On 2026/11/30 16:34, Uwe Kleine-König wrote:
> On Thu, Aug 27, 2026 at 08:40:10AM +0000, Xianwei Zhao via B4 Relay wrote:
>> From: Junyi Zhao<junyi.zhao@amlogic.com>
>>
>> Amlogic S7/S7D/S6 different from the previous SoCs, a controller
>> includes one pwm, at the same time, the controller has only one
>> input clock source.
>>
>> Signed-off-by: Junyi Zhao<junyi.zhao@amlogic.com>
>> Reviewed-by: Krzysztof Kozlowski<krzysztof.kozlowski@oss.qualcomm.com>
>> Reviewed-by: Martin Blumenstingl<martin.blumenstingl@googlemail.com>
>> Reviewed-by: Alexandre Mergnat<amergnat@baylibre.com>
>> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com>
>> ---
>>   .../devicetree/bindings/pwm/pwm-amlogic.yaml          | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
>> index c337d85da40f..93fa97f4011b 100644
>> --- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
>> +++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
>> @@ -37,6 +37,7 @@ properties:
>>         - enum:
>>             - amlogic,meson8-pwm-v2
>>             - amlogic,meson-s4-pwm
>> +          - amlogic,s7-pwm
>>         - items:
>>             - enum:
>>                 - amlogic,a4-pwm
>> @@ -45,6 +46,11 @@ properties:
>>                 - amlogic,t7-pwm
>>                 - amlogic,meson-a1-pwm
>>             - const: amlogic,meson-s4-pwm
>> +      - items:
>> +          - enum:
>> +              - amlogic,s6-pwm
>> +              - amlogic,s7d-pwm
>> +          - const: amlogic,s7-pwm
>>         - items:
>>             - enum:
>>                 - amlogic,meson8b-pwm-v2
>> @@ -146,6 +152,19 @@ allOf:
>>           clock-names: false
>>         required:
>>           - clocks
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - amlogic,s7-pwm
>> +    then:
>> +      properties:
>> +        clocks:
>> +          maxItems: 1
>> +        clock-names: false
> The clock doesn't have a name? It's fine for me to keep as suggested in
> this patch, but maybe it would be cleaner to state a name just to make
> it easier to match to the reference for a human?!
> 
I get the impression that the maintainer prefers not to specify a clock 
name when there is only one clock input.

https://lore.kernel.org/all/20230612092611.12385-1-krzysztof.kozlowski@linaro.org/

> Best regards
> Uwe

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

* Re: [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D
  2026-11-30 10:10     ` Xianwei Zhao
@ 2026-11-30 11:16       ` Uwe Kleine-König
  2026-11-30 11:29         ` Xianwei Zhao
  0 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2026-11-30 11:16 UTC (permalink / raw)
  To: Xianwei Zhao
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Junyi Zhao, Krzysztof Kozlowski, Alexandre Mergnat

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

Hello,

On Mon, Nov 30, 2026 at 06:10:28PM +0800, Xianwei Zhao wrote:
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            enum:
> > > +              - amlogic,s7-pwm
> > > +    then:
> > > +      properties:
> > > +        clocks:
> > > +          maxItems: 1
> > > +        clock-names: false
> > The clock doesn't have a name? It's fine for me to keep as suggested in
> > this patch, but maybe it would be cleaner to state a name just to make
> > it easier to match to the reference for a human?!
> > 
> I get the impression that the maintainer prefers not to specify a clock name
> when there is only one clock input.
> 
> https://lore.kernel.org/all/20230612092611.12385-1-krzysztof.kozlowski@linaro.org/

Agreed it's not helpful if the clock name is just "pwm17" for the 17th
PWM line. If it's "ipg" or "ahb" or something like that, I'd consider it
useful, which seem to match Krzysztof's statement.

Best regards
Uwe

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

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

* Re: [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D
  2026-11-30 11:16       ` Uwe Kleine-König
@ 2026-11-30 11:29         ` Xianwei Zhao
  0 siblings, 0 replies; 19+ messages in thread
From: Xianwei Zhao @ 2026-11-30 11:29 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-pwm, devicetree, linux-kernel, linux-arm-kernel,
	linux-amlogic, Junyi Zhao, Krzysztof Kozlowski, Alexandre Mergnat

Hi Uwe,

On 2026/11/30 19:16, Uwe Kleine-König wrote:
> Hello,
> 
> On Mon, Nov 30, 2026 at 06:10:28PM +0800, Xianwei Zhao wrote:
>>>> +  - if:
>>>> +      properties:
>>>> +        compatible:
>>>> +          contains:
>>>> +            enum:
>>>> +              - amlogic,s7-pwm
>>>> +    then:
>>>> +      properties:
>>>> +        clocks:
>>>> +          maxItems: 1
>>>> +        clock-names: false
>>> The clock doesn't have a name? It's fine for me to keep as suggested in
>>> this patch, but maybe it would be cleaner to state a name just to make
>>> it easier to match to the reference for a human?!
>>>
>> I get the impression that the maintainer prefers not to specify a clock name
>> when there is only one clock input.
>>
>> https://lore.kernel.org/all/20230612092611.12385-1-krzysztof.kozlowski@linaro.org/
> Agreed it's not helpful if the clock name is just "pwm17" for the 17th
> PWM line. If it's "ipg" or "ahb" or something like that, I'd consider it
> useful, which seem to match Krzysztof's statement.
>

This clock is generic and has no special meaning, so I'll just keep it 
as is here.

> Best regards
> Uwe

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

end of thread, other threads:[~2026-11-30 11:29 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  8:40 [PATCH v4 0/4] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay
2026-08-27  8:40 ` [PATCH v4 1/4] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
2026-11-30  8:34   ` Uwe Kleine-König
2026-11-30 10:10     ` Xianwei Zhao
2026-11-30 11:16       ` Uwe Kleine-König
2026-11-30 11:29         ` Xianwei Zhao
2026-08-27  8:40 ` [PATCH v4 2/4] pwm: meson: add the PWM count driver data Xianwei Zhao via B4 Relay
2026-09-07 15:19   ` Alexandre Mergnat
2026-11-30  8:39   ` Uwe Kleine-König
2026-11-30 10:06     ` Xianwei Zhao
2026-08-27  8:40 ` [PATCH v4 3/4] pwm: meson: use bulk API for per-channel clocks Xianwei Zhao via B4 Relay
2026-09-07 15:22   ` Alexandre Mergnat
2026-09-07 18:44     ` Uwe Kleine-König
2026-11-11  2:44       ` Xianwei Zhao
2026-11-30  8:53   ` Uwe Kleine-König
2026-08-27  8:40 ` [PATCH v4 4/4] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
2026-09-07 15:26   ` Alexandre Mergnat
2026-11-30  8:57   ` Uwe Kleine-König
2026-11-30 10:03     ` Xianwei Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox