2019-06-19 09:54:14

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 0/5] Add missing pwm-cells to STM32 timers PWM

This series adds missing generic 3-cells PWM to STM32 timers dt-bindings,
PWM driver, and the relevant dtsi files for STM32F4, STM32F7 and STM32MP1.

Fabrice Gasnier (5):
dt-bindings: pwm-stm32: add #pwm-cells
pwm: stm32: use 3 cells ->of_xlate()
ARM: dts: stm32: add pwm cells to stm32mp157c
ARM: dts: stm32: add pwm cells to stm32f429
ARM: dts: stm32: add pwm cells to stm32f746

Documentation/devicetree/bindings/pwm/pwm-stm32.txt | 3 +++
arch/arm/boot/dts/stm32f429.dtsi | 12 ++++++++++++
arch/arm/boot/dts/stm32f746.dtsi | 12 ++++++++++++
arch/arm/boot/dts/stm32mp157c.dtsi | 12 ++++++++++++
drivers/pwm/pwm-stm32.c | 2 ++
5 files changed, 41 insertions(+)

--
2.7.4


2019-06-19 09:54:21

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 2/5] pwm: stm32: use 3 cells ->of_xlate()

STM32 Timers support generic 3 cells PWM to encode PWM number, period and
polarity.

Fixes: 7edf7369205b ("pwm: Add driver for STM32 plaftorm")

Signed-off-by: Fabrice Gasnier <[email protected]>
---
drivers/pwm/pwm-stm32.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 4f84255..740e2de 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -608,6 +608,8 @@ static int stm32_pwm_probe(struct platform_device *pdev)
priv->regmap = ddata->regmap;
priv->clk = ddata->clk;
priv->max_arr = ddata->max_arr;
+ priv->chip.of_xlate = of_pwm_xlate_with_flags;
+ priv->chip.of_pwm_n_cells = 3;

if (!priv->regmap || !priv->clk)
return -EINVAL;
--
2.7.4

2019-06-19 09:54:32

by Fabrice Gasnier

[permalink] [raw]
Subject: [PATCH 4/5] ARM: dts: stm32: add pwm cells to stm32f429

STM32 Timers support generic 3 cells PWM to encode PWM number, period and
polarity.

Fixes: c0e14fc712d9 ("ARM: dts: stm32: add Timers driver for stm32f429
MCU")

Signed-off-by: Fabrice Gasnier <[email protected]>
---
arch/arm/boot/dts/stm32f429.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 4a49544..5c8a826 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -112,6 +112,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -141,6 +142,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -170,6 +172,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -198,6 +201,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -267,6 +271,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -288,6 +293,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};
};
@@ -303,6 +309,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};
};
@@ -448,6 +455,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -469,6 +477,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -602,6 +611,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};

@@ -623,6 +633,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};
};
@@ -638,6 +649,7 @@

pwm {
compatible = "st,stm32-pwm";
+ #pwm-cells = <3>;
status = "disabled";
};
};
--
2.7.4

2019-06-19 11:44:38

by Benjamin GAIGNARD

[permalink] [raw]
Subject: Re: [PATCH 2/5] pwm: stm32: use 3 cells ->of_xlate()


On 6/19/19 11:52 AM, Fabrice Gasnier wrote:
> STM32 Timers support generic 3 cells PWM to encode PWM number, period and
> polarity.
>
> Fixes: 7edf7369205b ("pwm: Add driver for STM32 plaftorm")
Reviewed-by: Benjamin Gaignard <[email protected]>
>
> Signed-off-by: Fabrice Gasnier <[email protected]>
> ---
> drivers/pwm/pwm-stm32.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
> index 4f84255..740e2de 100644
> --- a/drivers/pwm/pwm-stm32.c
> +++ b/drivers/pwm/pwm-stm32.c
> @@ -608,6 +608,8 @@ static int stm32_pwm_probe(struct platform_device *pdev)
> priv->regmap = ddata->regmap;
> priv->clk = ddata->clk;
> priv->max_arr = ddata->max_arr;
> + priv->chip.of_xlate = of_pwm_xlate_with_flags;
> + priv->chip.of_pwm_n_cells = 3;
>
> if (!priv->regmap || !priv->clk)
> return -EINVAL;

2019-07-29 07:24:08

by Alexandre Torgue

[permalink] [raw]
Subject: Re: [PATCH 0/5] Add missing pwm-cells to STM32 timers PWM

Hi Fabrice

On 6/19/19 11:52 AM, Fabrice Gasnier wrote:
> This series adds missing generic 3-cells PWM to STM32 timers dt-bindings,
> PWM driver, and the relevant dtsi files for STM32F4, STM32F7 and STM32MP1.
>
> Fabrice Gasnier (5):
> dt-bindings: pwm-stm32: add #pwm-cells
> pwm: stm32: use 3 cells ->of_xlate()
> ARM: dts: stm32: add pwm cells to stm32mp157c
> ARM: dts: stm32: add pwm cells to stm32f429
> ARM: dts: stm32: add pwm cells to stm32f746
>
> Documentation/devicetree/bindings/pwm/pwm-stm32.txt | 3 +++
> arch/arm/boot/dts/stm32f429.dtsi | 12 ++++++++++++
> arch/arm/boot/dts/stm32f746.dtsi | 12 ++++++++++++
> arch/arm/boot/dts/stm32mp157c.dtsi | 12 ++++++++++++
> drivers/pwm/pwm-stm32.c | 2 ++
> 5 files changed, 41 insertions(+)
>

DT patches applied on stm32-next.

regards
Alex