* [PATCH v2 0/2] Add PWM support Amlogic S7 S7D S6
@ 2026-04-02 2:40 Xianwei Zhao via B4 Relay
2026-04-02 2:40 ` [PATCH v2 1/2] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay
2026-04-02 2:40 ` [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay
0 siblings, 2 replies; 6+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-04-02 2: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
Add bindings and driver support Amlogic S7/S7D/S6 SoCs.
Signed-off-by: Xianwei Zhao <xianwei.zhao@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 (1):
pwm: meson: Add support for Amlogic S7
.../devicetree/bindings/pwm/pwm-amlogic.yaml | 19 +++++++++++++
drivers/pwm/pwm-meson.c | 32 ++++++++++++++++++++--
2 files changed, 48 insertions(+), 3 deletions(-)
---
base-commit: 8ab1fc9104158045f68fde2d0ae16f5fbcf8bfbd
change-id: 20260325-s6-s7-pwm-281658b88736
Best regards,
--
Xianwei Zhao <xianwei.zhao@amlogic.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/2] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D 2026-04-02 2:40 [PATCH v2 0/2] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay @ 2026-04-02 2:40 ` Xianwei Zhao via B4 Relay 2026-04-02 2:40 ` [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay 1 sibling, 0 replies; 6+ messages in thread From: Xianwei Zhao via B4 Relay @ 2026-04-02 2: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 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> 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] 6+ messages in thread
* [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 2026-04-02 2:40 [PATCH v2 0/2] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay 2026-04-02 2:40 ` [PATCH v2 1/2] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay @ 2026-04-02 2:40 ` Xianwei Zhao via B4 Relay 2026-05-17 17:12 ` Uwe Kleine-König 1 sibling, 1 reply; 6+ messages in thread From: Xianwei Zhao via B4 Relay @ 2026-04-02 2: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. Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> --- drivers/pwm/pwm-meson.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 8c6bf3d49753..7a43c42ef3d6 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; + bool single_pwm; }; struct meson_pwm { @@ -503,6 +504,18 @@ static void meson_pwm_s4_put_clk(void *data) clk_put(clk); } +static int meson_pwm_init_channels_s7(struct pwm_chip *chip) +{ + struct device *dev = pwmchip_parent(chip); + struct meson_pwm *meson = to_meson_pwm(chip); + + meson->channels[0].clk = devm_clk_get(dev, NULL); + if (IS_ERR(meson->channels[0].clk)) + return dev_err_probe(dev, PTR_ERR(meson->channels[0].clk), + "Failed to get clk\n"); + return 0; +} + static int meson_pwm_init_channels_s4(struct pwm_chip *chip) { struct device *dev = pwmchip_parent(chip); @@ -592,6 +605,13 @@ static const struct meson_pwm_data pwm_s4_data = { .has_polarity = true, }; +static const struct meson_pwm_data pwm_s7_data = { + .channels_init = meson_pwm_init_channels_s7, + .has_constant = true, + .has_polarity = true, + .single_pwm = true, +}; + static const struct of_device_id meson_pwm_matches[] = { { .compatible = "amlogic,meson8-pwm-v2", @@ -642,6 +662,10 @@ 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); @@ -650,9 +674,11 @@ static int meson_pwm_probe(struct platform_device *pdev) { struct pwm_chip *chip; struct meson_pwm *meson; - int err; + const struct meson_pwm_data *pdata = of_device_get_match_data(&pdev->dev); + int err, npwm; - chip = devm_pwmchip_alloc(&pdev->dev, MESON_NUM_PWMS, sizeof(*meson)); + npwm = pdata->single_pwm ? 1 : MESON_NUM_PWMS; + chip = devm_pwmchip_alloc(&pdev->dev, npwm, sizeof(*meson)); if (IS_ERR(chip)) return PTR_ERR(chip); meson = to_meson_pwm(chip); @@ -664,7 +690,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] 6+ messages in thread
* Re: [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 2026-04-02 2:40 ` [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay @ 2026-05-17 17:12 ` Uwe Kleine-König 2026-05-18 2:54 ` Xianwei Zhao 2026-05-18 3:05 ` Xianwei Zhao 0 siblings, 2 replies; 6+ messages in thread From: Uwe Kleine-König @ 2026-05-17 17:12 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: 2555 bytes --] Hello, On Thu, Apr 02, 2026 at 02:40:16AM +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. > > Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> > --- > drivers/pwm/pwm-meson.c | 32 +++++++++++++++++++++++++++++--- > 1 file changed, 29 insertions(+), 3 deletions(-) > > diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c > index 8c6bf3d49753..7a43c42ef3d6 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; > + bool single_pwm; Conceptually I'd prefer a `npwm` field here. That doesn't take more space in memory and simplifies the logic a bit. (At the cost of having to adapt all already existing meson_pwm_data instances, but that's fine in my book.) > }; > > struct meson_pwm { > @@ -503,6 +504,18 @@ static void meson_pwm_s4_put_clk(void *data) > clk_put(clk); > } > > +static int meson_pwm_init_channels_s7(struct pwm_chip *chip) > +{ > + struct device *dev = pwmchip_parent(chip); > + struct meson_pwm *meson = to_meson_pwm(chip); > + > + meson->channels[0].clk = devm_clk_get(dev, NULL); > + if (IS_ERR(meson->channels[0].clk)) > + return dev_err_probe(dev, PTR_ERR(meson->channels[0].clk), > + "Failed to get clk\n"); > + return 0; > +} > + > static int meson_pwm_init_channels_s4(struct pwm_chip *chip) > { > struct device *dev = pwmchip_parent(chip); > @@ -592,6 +605,13 @@ static const struct meson_pwm_data pwm_s4_data = { > .has_polarity = true, > }; > > +static const struct meson_pwm_data pwm_s7_data = { > + .channels_init = meson_pwm_init_channels_s7, > + .has_constant = true, > + .has_polarity = true, > + .single_pwm = true, > +}; > + > static const struct of_device_id meson_pwm_matches[] = { > { > .compatible = "amlogic,meson8-pwm-v2", > @@ -642,6 +662,10 @@ 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 > + }, > {}, If you touch that array in the next revision, please make this line: { } (I.e. add a space and drop the comma.) Best regards Uwe [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 2026-05-17 17:12 ` Uwe Kleine-König @ 2026-05-18 2:54 ` Xianwei Zhao 2026-05-18 3:05 ` Xianwei Zhao 1 sibling, 0 replies; 6+ messages in thread From: Xianwei Zhao @ 2026-05-18 2:54 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/5/18 01:12, Uwe Kleine-König wrote: > Hello, > > On Thu, Apr 02, 2026 at 02:40:16AM +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. >> >> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com> >> --- >> drivers/pwm/pwm-meson.c | 32 +++++++++++++++++++++++++++++--- >> 1 file changed, 29 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c >> index 8c6bf3d49753..7a43c42ef3d6 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; >> + bool single_pwm; > Conceptually I'd prefer a `npwm` field here. That doesn't take more > space in memory and simplifies the logic a bit. (At the cost of having > to adapt all already existing meson_pwm_data instances, but that's fine > in my book.) > I will use npwm(u8) instead of single_pwm. >> }; >> >> struct meson_pwm { >> @@ -503,6 +504,18 @@ static void meson_pwm_s4_put_clk(void *data) >> clk_put(clk); >> } >> >> +static int meson_pwm_init_channels_s7(struct pwm_chip *chip) >> +{ >> + struct device *dev = pwmchip_parent(chip); >> + struct meson_pwm *meson = to_meson_pwm(chip); >> + >> + meson->channels[0].clk = devm_clk_get(dev, NULL); >> + if (IS_ERR(meson->channels[0].clk)) >> + return dev_err_probe(dev, PTR_ERR(meson->channels[0].clk), >> + "Failed to get clk\n"); >> + return 0; >> +} >> + >> static int meson_pwm_init_channels_s4(struct pwm_chip *chip) >> { >> struct device *dev = pwmchip_parent(chip); >> @@ -592,6 +605,13 @@ static const struct meson_pwm_data pwm_s4_data = { >> .has_polarity = true, >> }; >> >> +static const struct meson_pwm_data pwm_s7_data = { >> + .channels_init = meson_pwm_init_channels_s7, >> + .has_constant = true, >> + .has_polarity = true, >> + .single_pwm = true, >> +}; >> + >> static const struct of_device_id meson_pwm_matches[] = { >> { >> .compatible = "amlogic,meson8-pwm-v2", >> @@ -642,6 +662,10 @@ 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 >> + }, >> {}, > If you touch that array in the next revision, please make this line: > > { } > > (I.e. add a space and drop the comma.) > Will do. > Best regards > Uwe ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 2026-05-17 17:12 ` Uwe Kleine-König 2026-05-18 2:54 ` Xianwei Zhao @ 2026-05-18 3:05 ` Xianwei Zhao 1 sibling, 0 replies; 6+ messages in thread From: Xianwei Zhao @ 2026-05-18 3:05 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/5/18 01:12, Uwe Kleine-König wrote: > Subject: > Re: [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 > From: > Uwe Kleine-König <ukleinek@kernel.org> > Date: > 2026/5/18 01:12 > > To: > xianwei.zhao@amlogic.com > CC: > Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, > Conor Dooley <conor+dt@kernel.org>, Heiner Kallweit > <hkallweit1@gmail.com>, Neil Armstrong <neil.armstrong@linaro.org>, > Kevin Hilman <khilman@baylibre.com>, Jerome Brunet > <jbrunet@baylibre.com>, Martin Blumenstingl > <martin.blumenstingl@googlemail.com>, linux-pwm@vger.kernel.org, > devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org > > > > Hello, > > On Thu, Apr 02, 2026 at 02:40:16AM +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. >> >> Signed-off-by: Xianwei Zhao<xianwei.zhao@amlogic.com> >> --- >> drivers/pwm/pwm-meson.c | 32 +++++++++++++++++++++++++++++--- >> 1 file changed, 29 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c >> index 8c6bf3d49753..7a43c42ef3d6 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; >> + bool single_pwm; > Conceptually I'd prefer a `npwm` field here. That doesn't take more > space in memory and simplifies the logic a bit. (At the cost of having > to adapt all already existing meson_pwm_data instances, but that's fine > in my book.) > I will use npwm(u8 type) instead of single_pwm. >> }; >> >> struct meson_pwm { >> @@ -503,6 +504,18 @@ static void meson_pwm_s4_put_clk(void *data) >> clk_put(clk); >> } >> >> +static int meson_pwm_init_channels_s7(struct pwm_chip *chip) >> +{ >> + struct device *dev = pwmchip_parent(chip); >> + struct meson_pwm *meson = to_meson_pwm(chip); >> + >> + meson->channels[0].clk = devm_clk_get(dev, NULL); >> + if (IS_ERR(meson->channels[0].clk)) >> + return dev_err_probe(dev, PTR_ERR(meson->channels[0].clk), >> + "Failed to get clk\n"); >> + return 0; >> +} >> + >> static int meson_pwm_init_channels_s4(struct pwm_chip *chip) >> { >> struct device *dev = pwmchip_parent(chip); >> @@ -592,6 +605,13 @@ static const struct meson_pwm_data pwm_s4_data = { >> .has_polarity = true, >> }; >> >> +static const struct meson_pwm_data pwm_s7_data = { >> + .channels_init = meson_pwm_init_channels_s7, >> + .has_constant = true, >> + .has_polarity = true, >> + .single_pwm = true, >> +}; >> + >> static const struct of_device_id meson_pwm_matches[] = { >> { >> .compatible = "amlogic,meson8-pwm-v2", >> @@ -642,6 +662,10 @@ 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 >> + }, >> {}, > If you touch that array in the next revision, please make this line: > > { } > > (I.e. add a space and drop the comma.) > Will do. > Best regards > Uwe ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-05-18 3:05 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-02 2:40 [PATCH v2 0/2] Add PWM support Amlogic S7 S7D S6 Xianwei Zhao via B4 Relay 2026-04-02 2:40 ` [PATCH v2 1/2] dt-bindings: pwm: amlogic: Add new bindings for S6 S7 S7D Xianwei Zhao via B4 Relay 2026-04-02 2:40 ` [PATCH v2 2/2] pwm: meson: Add support for Amlogic S7 Xianwei Zhao via B4 Relay 2026-05-17 17:12 ` Uwe Kleine-König 2026-05-18 2:54 ` Xianwei Zhao 2026-05-18 3:05 ` Xianwei Zhao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox