pwm: pxa: Use #pwm-cells = <3>
Subsystems (3)
cover pwm: pxa: Use #pwm-cells = <3>
Hello,
this series' goal is to soften the special device-tree binding of marvel,pxa-pwm devices. This is the only binding that doesn't pass the line index as first parameter.
Here the #pwm-cells value is bumped from 1 to 3, keeping compatibility with the old binding.
The motivation for this was that Hervé sent a patch introducing pwm nexus nodes which don't work nicely with the marvel,pxa-pwm particularities.
For merging this series (assuming device-tree and pxa maintainers agree) I guess keeping the patches together makes sense because with the 2nd patch applied but without the 3rd there are a few dt-checker warnings.
So I suggest to take it via my pwm tree as I guess drivers/pwm/core.c has more potential for a conflict than arch/arm/boot/dts/intel/pxa. So please send Acks and tell me if you would need an immutable branch for pulling into the PXA tree.
Best regards
Uwe
Uwe Kleine-König (3):
pwm: Add upgrade path to #pwm-cells = <3> for users of
of_pwm_single_xlate()
dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
ARM: dts: pxa: Use #pwm-cells = <3> for marvell,pxa-pwm devices
.../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 3 +-- arch/arm/boot/dts/intel/pxa/pxa25x.dtsi | 4 ++-- arch/arm/boot/dts/intel/pxa/pxa27x.dtsi | 8 ++++---- .../dts/intel/pxa/pxa300-raumfeld-controller.dts | 2 +- arch/arm/boot/dts/intel/pxa/pxa3xx.dtsi | 8 ++++---- drivers/pwm/core.c | 16 ++++++++++++++++ 6 files changed, 28 insertions(+), 13 deletions(-)
base-commit: c98e66144b7d07ee9a3ca8241123b628a8ac0288
Signature · 1 line
2.47.1
PATCH 1/3 pwm: Add upgrade path to #pwm-cells = <3> for users of of_pwm_single_xlate()
The PWM chip on PXA only has a single output. Back when the device tree binding was defined it was considered a good idea to not pass the PWM line index as is done for all other PWM types as it would be always zero anyhow and so doesn't add any value.
However for consistency reasons it is nice when all PWMs use the same binding. For that reason let of_pwm_single_xlate() (i.e. the function that implements the PXA behaviour) behave in the same way as of_pwm_xlate_with_flags() for 3 (or more) parameters. With that in place, the pxa-pwm binding can be updated to #pwm-cells = <3> without breaking old device trees that stick to #pwm-cells = <1>.
--- drivers/pwm/core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/pwm/core.c +16 -0
@@ -1000,11 +1000,27 @@ of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_args *arg }EXPORT_SYMBOL_GPL (of_pwm_xlate_with_flags); +/* +* This callback is used for PXA PWM chips that only have a single PWM line. +* For such chips you could argue that passing the line number (i.e. the first +* parameter in the common case) is useless as it's always zero. So compared to +* the default xlate function of_pwm_xlate_with_flags() the first parameter is +* the default period and the second are flags. +* +* Note that if #pwm-cells = <3>, the semantic is the same as for +* of_pwm_xlate_with_flags() to allow converting the affected driver to +* #pwm-cells = <3> without breaking the legacy binding. +* +* Don't use for new drivers. +*/ struct pwm_device *of_pwm_single_xlate (struct pwm_chip *chip,const struct of_phandle_args *args) {struct pwm_device *pwm; +if (args->args_count >=3 ) +return of_pwm_xlate_with_flags (chip, args); + pwm =pwm_request_from_chip (chip,0 ,NULL );if (IS_ERR (pwm))return pwm;
Signature · 1 line
2.47.1
Re: [PATCH 1/3] pwm: Add upgrade path to #pwm-cells = <3> for users of of_pwm_single_xlate()
Quoted 12 lines · On Wed, 5 Feb 2025 18:54:00 +0100 Uwe Kleine-König…
The PWM chip on PXA only has a single output. Back when the device tree binding was defined it was considered a good idea to not pass the PWM line index as is done for all other PWM types as it would be always zero anyhow and so doesn't add any value.
However for consistency reasons it is nice when all PWMs use the same binding. For that reason let
of_pwm_single_xlate()(i.e. the function that implements the PXA behaviour) behave in the same way asof_pwm_xlate_with_flags()for 3 (or more) parameters. With that in place, the pxa-pwm binding can be updated to #pwm-cells = <3> without breaking old device trees that stick to #pwm-cells = <1>.
Quoted 4 lines
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/pwm/core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Best regards,
Hervé
PATCH 2/3 dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
In reply to Uwe Kleine-KönigThe PXA PWM binding is the only one that doesn't pass the PWM line index as first parameter of the parameter cells. However this can be upgraded to the mandatory binding for all new PWM drivers without breaking compatibility for old device trees using #pwm-cells = <1>.
So bump #pwm-cells to 3 with the (undocumented) promise to keep the old behaviour for #pwm-cells = <1>.
--- Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml +1 -2
@@ -25,8 +25,7 @@ properties: maxItems: 1 "#pwm-cells": - # Used for specifying the period length in nanoseconds - const: 1 + const: 3 clocks: maxItems: 1
Signature · 1 line
2.47.1
Re: [PATCH 2/3] dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
Quoted 9 lines · Uwe Kleine-König
The PXA PWM binding is the only one that doesn't pass the PWM line index as first parameter of the parameter cells. However this can be upgraded to the mandatory binding for all new PWM drivers without breaking compatibility for old device trees using #pwm-cells = <1>.
So bump #pwm-cells to 3 with the (undocumented) promise to keep the old behaviour for #pwm-cells = <1>.
Signed-off-by Uwe Kleine-König <[email protected]>
Rob Herring (Arm)
maintainerRe: [PATCH 2/3] dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
In reply to Uwe Kleine-KönigQuoted 5 lines · Uwe Kleine-König
The PXA PWM binding is the only one that doesn't pass the PWM line index as first parameter of the parameter cells. However this can be upgraded to the mandatory binding for all new PWM drivers without breaking compatibility for old device trees using #pwm-cells = <1>.
Quoted 8 lines
So bump #pwm-cells to 3 with the (undocumented) promise to keep the old behaviour for #pwm-cells = <1>.
Signed-off-by Uwe Kleine-König <[email protected]>--- Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.example.dtb: pwm@40b00000: #pwm-cells: 3 was expected
from schema $id: http://devicetree.org/schemas/pwm/marvell,pxa-pwm.yaml#
doc reference errors (make refcheckdocs):
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
PATCH 3/3 ARM: dts: pxa: Use #pwm-cells = <3> for marvell,pxa-pwm devices
In reply to Uwe Kleine-KönigFor consistency with most other pwm bindings, also use 3 cells for phandles to PWM devices.
--- arch/arm/boot/dts/intel/pxa/pxa25x.dtsi | 4 ++-- arch/arm/boot/dts/intel/pxa/pxa27x.dtsi | 8 ++++---- .../arm/boot/dts/intel/pxa/pxa300-raumfeld-controller.dts | 2 +- arch/arm/boot/dts/intel/pxa/pxa3xx.dtsi | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-)
arch/arm/boot/dts/intel/pxa/pxa25x.dtsi +2 -2
@@ -67,14 +67,14 @@ gpio: gpio@40e00000 { pwm0: pwm@40b00000 { compatible = "marvell,pxa250-pwm"; reg = <0x40b00000 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM0>; }; pwm1: pwm@40b00010 { compatible = "marvell,pxa250-pwm"; reg = <0x40b00010 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM1>; };
arch/arm/boot/dts/intel/pxa/pxa27x.dtsi +4 -4
@@ -49,28 +49,28 @@ usb0: usb@4c000000 { pwm0: pwm@40b00000 { compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm"; reg = <0x40b00000 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM0>; }; pwm1: pwm@40b00010 { compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm"; reg = <0x40b00010 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM1>; }; pwm2: pwm@40c00000 { compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm"; reg = <0x40c00000 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM0>; }; pwm3: pwm@40c00010 { compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm"; reg = <0x40c00010 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM1>; };
arch/arm/boot/dts/intel/pxa/pxa300-raumfeld-controller.dts +1 -1
@@ -56,7 +56,7 @@ backlight-controller-pwm { compatible = "pwm-backlight"; pinctrl-names = "default"; pinctrl-0 = <&pwm0_pins>; - pwms = <&pwm0 10000>; + pwms = <&pwm0 0 10000 0>; power-supply = <®_vbatt>; status = "disabled";
arch/arm/boot/dts/intel/pxa/pxa3xx.dtsi +4 -4
@@ -224,7 +224,7 @@ usb0: usb@4c000000 { pwm0: pwm@40b00000 { compatible = "marvell,pxa270-pwm"; reg = <0x40b00000 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM0>; status = "disabled"; };
@@ -232,7 +232,7 @@ pwm0: pwm@40b00000 { pwm1: pwm@40b00010 { compatible = "marvell,pxa270-pwm"; reg = <0x40b00010 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM1>; status = "disabled"; };
@@ -240,7 +240,7 @@ pwm1: pwm@40b00010 { pwm2: pwm@40c00000 { compatible = "marvell,pxa270-pwm"; reg = <0x40c00000 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM0>; status = "disabled"; };
@@ -248,7 +248,7 @@ pwm2: pwm@40c00000 { pwm3: pwm@40c00010 { compatible = "marvell,pxa270-pwm"; reg = <0x40c00010 0x10>; - #pwm-cells = <1>; + #pwm-cells = <3>; clocks = <&clks CLK_PWM1>; status = "disabled"; };
Signature · 1 line
2.47.1
Quoted 40 lines · On Wednesday 5 February 2025 18:53:59 Central European Standard Time Uwe…
Hello,
this series' goal is to soften the special device-tree binding of marvel,pxa-pwm devices. This is the only binding that doesn't pass the line index as first parameter.
Here the #pwm-cells value is bumped from 1 to 3, keeping compatibility with the old binding.
The motivation for this was that Hervé sent a patch introducing pwm nexus nodes which don't work nicely with the marvel,pxa-pwm particularities.
For merging this series (assuming device-tree and pxa maintainers agree) I guess keeping the patches together makes sense because with the 2nd patch applied but without the 3rd there are a few dt-checker warnings.
So I suggest to take it via my pwm tree as I guess
drivers/pwm/core.chas more potential for a conflict thanarch/arm/boot/dts/intel/pxa. So please send Acks and tell me if you would need an immutable branch for pulling into the PXA tree.Best regards
UweUwe Kleine-König (3):
pwm: Add upgrade path to #pwm-cells = <3> for users of
of_pwm_single_xlate()
dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
ARM: dts: pxa: Use #pwm-cells = <3> for marvell,pxa-pwm devices.../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 3 +-- arch/arm/boot/dts/intel/pxa/pxa25x.dtsi | 4 ++-- arch/arm/boot/dts/intel/pxa/pxa27x.dtsi | 8 ++++---- .../dts/intel/pxa/pxa300-raumfeld-controller.dts | 2 +- arch/arm/boot/dts/intel/pxa/pxa3xx.dtsi | 8 ++++---- drivers/pwm/core.c | 16 ++++++++++++++++ 6 files changed, 28 insertions(+), 13 deletions(-)
Quoted 1 line
base-commit:
c98e66144b7d07ee9a3ca8241123b628a8ac0288
For the whole series:
Regards,
Signature · 1 line
Duje
Quoted 22 lines · Uwe Kleine-König
Hello,
this series' goal is to soften the special device-tree binding of marvel,pxa-pwm devices. This is the only binding that doesn't pass the line index as first parameter.
Here the #pwm-cells value is bumped from 1 to 3, keeping compatibility with the old binding.
The motivation for this was that Hervé sent a patch introducing pwm nexus nodes which don't work nicely with the marvel,pxa-pwm particularities.
For merging this series (assuming device-tree and pxa maintainers agree) I guess keeping the patches together makes sense because with the 2nd patch applied but without the 3rd there are a few dt-checker warnings.
So I suggest to take it via my pwm tree as I guess
drivers/pwm/core.chas more potential for a conflict thanarch/arm/boot/dts/intel/pxa. So please send Acks and tell me if you would need an immutable branch for pulling into the PXA tree.
Quoted 8 lines
Best regards
UweUwe Kleine-König (3):
pwm: Add upgrade path to #pwm-cells = <3> for users of
of_pwm_single_xlate()
dt-bindings: pwm: marvell,pxa-pwm: Update to use #pwm-cells = <3>
ARM: dts: pxa: Use #pwm-cells = <3> for marvell,pxa-pwm devices
For all patches in the series:
Quoted 11 lines
.../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 3 +-- arch/arm/boot/dts/intel/pxa/pxa25x.dtsi | 4 ++-- arch/arm/boot/dts/intel/pxa/pxa27x.dtsi | 8 ++++---- .../dts/intel/pxa/pxa300-raumfeld-controller.dts | 2 +- arch/arm/boot/dts/intel/pxa/pxa3xx.dtsi | 8 ++++---- drivers/pwm/core.c | 16 ++++++++++++++++ 6 files changed, 28 insertions(+), 13 deletions(-)base-commit:
c98e66144b7d07ee9a3ca8241123b628a8ac0288