Skip to contentSkip to conversation

gpio: mvebu: Add PWM fan support

PATCH Superseded Ralph Sennhauser 3 participants 10 messages Mar 27, 2017 – Mar 30, 2017

Subsystems (5)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover gpio: mvebu: Add PWM fan support

Hi everyone

This patch series was originally submitted by Andrew Lunn but got stalled. I picked up the series and addressed what was discussed for the earlier submission with some helpful input from Andrew. Hopefully this time support for the PWM fan as found on Linksys WRT1900AC (Mamba) will make it in.

Implementing as an MFD was discarded due to backward compatibility. The original discussion can be read at [1].

This series depends on two cleanup series. The first series [2] ("gpio:
mvebu: preparatory cleanup for pwm-fan support") is in linux next-20170320. The second one [3] ("gpio: mvebu: use BIT macro instead of bit shifting") is in linux-20170327.

Ralph

[1] https://patchwork.ozlabs.org/patch/427287/
[2] https://lkml.org/lkml/2017/3/16/62
[3] https://lkml.org/lkml/2017/3/17/493

---

Notes:

About npwm = 1:
The only way I can think of to achieve that requires reading the GPIO line from the device tree. This would prevent a user to dynamically choose a line. Which is fine for the fan found on Mamba but let's take some development board with freely accessible GPIOs and suddenly we limit the use of this driver. Given the above, npwm = ngpio with only one usable at a time is a more accurate description of the situation. The only downside is some "wasted" space.

About the new compatible string:
Orion was chosen for the SoC variant for the same reason as in commit 5f79c651e81e ("arm: mvebu: use global interrupts for GPIOs on Armada XP"). I decided having the first two chips be "marvell,armada-370-xp-gpio" and keep "marvell,orion-gpio" for the third one for some SoCs just to be able to require the PWM property for this compatible string. Therefore the properties remain optional and if defined for any other than the first two chips it's an error.

---

Pending:
* npwm = 1? I vote no if that counts. ;) (suggested by Thierry Reding)
* Tested-by: Andrew Lunn for v1 needs renewing
* Needs ACK from Thierry Reding to be merged via linux-gpio tree by Linus Walleij. (fine with the general approach, requested changes which should have been taken care of now)

---

Changes v3->v4:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* braces for both branches in if statement if one needs it. (suggested by Andrew Lunn)
* introduce compatible string marvell,armada-370-xp-gpio (suggest by Thierry Reding)
* fix mvebu_pwmreg_blink_on_duration -> mvebu_pwmreg_blink_off_duration for period callculation in mvebu_pwm_get_state()
Patch 4/4 mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan
* Drop flags from pwms for Mamba, as no longer used (suggested by Andrew Lunn)
* Use again #pwm-cell = 2, the second cell is actually the period.

Changes v2->v3:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* drop pin from mvebu_pwn, can be infered (suggested by Thierry Reding)
* rename pwm to mvpwm so pwm can be used for pwm_device as in the API, avoids some mental gymnastic.
* drop id from struct mvebu_gpio_chip, select blink counter in mvebu_pwm_probe for all lines instead. We do not care about the unused ones. I think a clear improvement in readability. Makes coming up with a good comment simple as well.
* Switch to new atomic PWM API (suggested by Thierry Reding)
* rename use mvebu_gpioreg_blink_select to mvebu_gpioreg_blink_counter_select.
* mark *_suspend() / *_resume() as __maybe_unused (suggested by Linus Walleij)
* document #pwm-cells = 1 (suggested by Thierry Reding)
Patch 2/4 mvebu: xp: Add PWM properties to .dtsi files
* add missing reg-names / #pwm-cell properties to armada-xp-mv78260.dtsi gpio1 node
* set pwm-cells = 1 (suggested by Thierry Reding)
All:
* always uppercase GPIO/PWM in prose (suggested by Thierry Reding)

Changes v1 -> v2:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* use BIT macro (suggested by Linus Walleij)
* move id from struct mvebu_pwm to struct mvebu_gpio_chip, implement blink select as if else and comment on the chip id for code clarity (to accommodate Linus Walleijs request for a code clarification / comment. If you can word it better I'm all ears.)
* Move function comment mvebu_pwm_probe into the function itself.

---

Andrew Lunn (4):
gpio: mvebu: Add limited PWM support
mvebu: xp: Add PWM properties to .dtsi files
ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan

 .../devicetree/bindings/gpio/gpio-mvebu.txt        |  32 ++
 MAINTAINERS                                        |   2 +
 arch/arm/boot/dts/armada-370.dtsi                  |  16 +-
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts      |   8 +-
 arch/arm/boot/dts/armada-xp-mv78230.dtsi           |  14 +-
 arch/arm/boot/dts/armada-xp-mv78260.dtsi           |  16 +-
 arch/arm/boot/dts/armada-xp-mv78460.dtsi           |  16 +-
 arch/arm/configs/mvebu_v7_defconfig                |   2 +
 drivers/gpio/gpio-mvebu.c                          | 324 ++++++++++++++++++++-
 9 files changed, 394 insertions(+), 36 deletions(-)
Signature · 1 line
2.10.2
#1 lore raw

PATCH v4 1/4 gpio: mvebu: Add limited PWM support

From: Andrew Lunn <[email protected]>

Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.

However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.

Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.

URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion into gpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpio
* Update and merge documentation patch
* Update MAINTAINERS]

---
 .../devicetree/bindings/gpio/gpio-mvebu.txt        |  32 ++
 MAINTAINERS                                        |   2 +
 drivers/gpio/gpio-mvebu.c                          | 324 ++++++++++++++++++++-
 3 files changed, 346 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +32 -0
index a6f3bec..fe49e9d 100644
@@ -38,6 +38,24 @@ Required properties:
 - #gpio-cells: Should be two. The first cell is the pin number. The
   second cell is reserved for flags, unused at the moment.
 
+Optional properties:
+
+In order to use the gpio lines in PWM mode, some additional optional
+properties are required. Only Armada 370 and XP support these properties.
+
+- compatible: Must contain "marvell,armada-370-xp-gpio"
+
+- reg: an additional register set is needed, for the GPIO Blink
+  Counter on/off registers.
+
+- reg-names: Must contain an entry "pwm" corresponding to the
+  additional register range needed for pwm operation.
+
+- #pwm-cells: Should be two. The first cell is the GPIO line number. The
+  second cell is the period in nanoseconds.
+
+- clocks: Must be a phandle to the clock for the gpio controller.
+
 Example:
 
 		gpio0: gpio at d0018100 {
@@ -51,3 +69,17 @@ Example:
 			#interrupt-cells = <2>;
 			interrupts = <16>, <17>, <18>, <19>;
 		};
+
+		gpio1: gpio at 18140 {
+			compatible = "marvell,armada-370-xp-gpio";
+			reg = <0x18140 0x40>, <0x181c8 0x08>;
+			reg-names = "gpio", "pwm";
+			ngpios = <17>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			#pwm-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			interrupts = <87>, <88>, <89>;
+			clocks = <&coreclk 0>;
+		};
MAINTAINERS +2 -0
index 58b3a22..19382f5 100644
@@ -10295,6 +10295,8 @@ F:	include/linux/pwm.h
 F:	drivers/pwm/
 F:	drivers/video/backlight/pwm_bl.c
 F:	include/linux/pwm_backlight.h
+F:	drivers/gpio/gpio-mvebu.c
+F:	Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
 
 PXA2xx/PXA3xx SUPPORT
 M:	Daniel Mack <[email protected]>
drivers/gpio/gpio-mvebu.c +312 -12

405 lines not on this page · raw message

Signature · 1 line
2.10.2
#2 lore raw

PATCH v4 2/4 mvebu: xp: Add PWM properties to .dtsi files

In reply to Ralph Sennhauser

From: Andrew Lunn <[email protected]>

Add properties to the GPIO nodes to allow them to be also used as PWM lines.

URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser:
* Use new compatible string marvell,armada-370-xp-gpio
* Add missing reg-names / #pwm-cell properties to armada-xp-mv78260.dtsi

    'gpio1' node]
---
 arch/arm/boot/dts/armada-370.dtsi        | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78230.dtsi | 14 ++++++++++----
 arch/arm/boot/dts/armada-xp-mv78260.dtsi | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78460.dtsi | 16 +++++++++++-----
 4 files changed, 43 insertions(+), 19 deletions(-)
arch/arm/boot/dts/armada-370.dtsi +11 -5
index cc011c8..e30b076 100644
@@ -137,29 +137,35 @@
 			};
 
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18100 0x40>, <0x181c0 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <82>, <83>, <84>, <85>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio1: gpio at 18140 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18140 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18140 0x40>, <0x181c8 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <87>, <88>, <89>, <90>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio2: gpio at 18180 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armada-370-xp-gpio";
 				reg = <0x18180 0x40>;
 				ngpios = <2>;
 				gpio-controller;
arch/arm/boot/dts/armada-xp-mv78230.dtsi +10 -4
index 07c5090..429ac10 100644
@@ -202,25 +202,31 @@
 
 		internal-regs {
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18100 0x40>, <0x181c0 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <82>, <83>, <84>, <85>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio1: gpio at 18140 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18140 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18140 0x40>, <0x181c8 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <17>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <87>, <88>, <89>;
+				clocks = <&coreclk 0>;
 			};
 		};
 	};
arch/arm/boot/dts/armada-xp-mv78260.dtsi +11 -5
index 64e936a..333c470 100644
@@ -285,29 +285,35 @@
 
 		internal-regs {
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18100 0x40>, <0x181c0 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <82>, <83>, <84>, <85>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio1: gpio at 18140 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18140 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18140 0x40>, <0x181c8 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <87>, <88>, <89>, <90>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio2: gpio at 18180 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armada-370-xp-gpio";
 				reg = <0x18180 0x40>;
 				ngpios = <3>;
 				gpio-controller;
arch/arm/boot/dts/armada-xp-mv78460.dtsi +11 -5
index d1383dd..2ff825d 100644
@@ -323,29 +323,35 @@
 
 		internal-regs {
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18100 0x40>, <0x181c0 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <82>, <83>, <84>, <85>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio1: gpio at 18140 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18140 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";
+				reg = <0x18140 0x40>, <0x181c8 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <87>, <88>, <89>, <90>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio2: gpio at 18180 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armada-370-xp-gpio";
 				reg = <0x18180 0x40>;
 				ngpios = <3>;
 				gpio-controller;
Signature · 1 line
2.10.2
#3 lore raw

Re: [PATCH v4 2/4] mvebu: xp: Add PWM properties to .dtsi files

Hi Ralph,

On lun., mars 27 2017, Ralph Sennhauser <[email protected]> wrote:

The title should start by ARM: dts: mvebu:

If there is no need to have a v5 then I wil take care of modifying the title while applying it.

Quoted 24 lines

From: Andrew Lunn <[email protected]>

Add properties to the GPIO nodes to allow them to be also used as PWM lines.

URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser:
* Use new compatible string marvell,armada-370-xp-gpio
* Add missing reg-names / #pwm-cell properties to armada-xp-mv78260.dtsi

    'gpio1' node]
---
 arch/arm/boot/dts/armada-370.dtsi        | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78230.dtsi | 14 ++++++++++----
 arch/arm/boot/dts/armada-xp-mv78260.dtsi | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78460.dtsi | 16 +++++++++++-----
 4 files changed, 43 insertions(+), 19 deletions(-)
arch/arm/boot/dts/armada-370.dtsi +0 -0
index cc011c8..e30b076 100644

arch/arm/boot/dts/armada-370.dtsi line 140

Quoted 6 lines
arch/arm/boot/dts/armada-370.dtsi +1 -2
@@ -137,29 +137,35 @@
 			};
 
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";

I think we should keep the "marvell,orion-gpio" too because the hardware is still compatible with it. Morever it will allow to use a recent dtb with an old kernel.

Quoted 6 lines
arch/arm/boot/dts/armada-370.dtsi +3 -0
+				reg = <0x18100 0x40>, <0x181c0 0x08>;
+				reg-names = "gpio", "pwm";
 				ngpios = <32>;
 				gpio-controller;
 				#gpio-cells = <2>;
+				#pwm-cells = <2>;

arch/arm/boot/dts/armada-370.dtsi line 154

Quoted 10 lines
arch/arm/boot/dts/armada-370.dtsi +2 -2
 				interrupt-controller;
 				#interrupt-cells = <2>;
 				interrupts = <82>, <83>, <84>, <85>;
+				clocks = <&coreclk 0>;
 			};
 
 			gpio1: gpio at 18140 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18140 0x40>;
+				compatible = "marvell,armada-370-xp-gpio";

Same here and for all the others...

Thanks,

Gregory

Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

Re: [PATCH v4 2/4] mvebu: xp: Add PWM properties to .dtsi files

Quoted 9 lines · On Thu, 30 Mar 2017 17:45:08 +0200 Gregory CLEMENT…

Hi Ralph,

On lun., mars 27 2017, Ralph Sennhauser <[email protected]>
wrote:

The title should start by ARM: dts: mvebu:

If there is no need to have a v5 then I wil take care of modifying the title while applying it.

Noted.

Quoted 28 lines
Quoted 28 lines

From: Andrew Lunn <[email protected]>

Add properties to the GPIO nodes to allow them to be also used as PWM lines.

URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser:
* Use new compatible string marvell,armada-370-xp-gpio
* Add missing reg-names / #pwm-cell properties to
armada-xp-mv78260.dtsi 'gpio1' node]

---
 arch/arm/boot/dts/armada-370.dtsi        | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78230.dtsi | 14 ++++++++++----
 arch/arm/boot/dts/armada-xp-mv78260.dtsi | 16 +++++++++++-----
 arch/arm/boot/dts/armada-xp-mv78460.dtsi | 16 +++++++++++-----
 4 files changed, 43 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/armada-370.dtsi index cc011c8..e30b076 100644

arch/arm/boot/dts/armada-370.dtsi +0 -0
@@ -137,29 +137,35 @@
 			};
 
Quoted 9 lines

arch/arm/boot/dts/armada-370.dtsi

Quoted 5 lines
arch/arm/boot/dts/armada-370.dtsi +1 -2
 			gpio0: gpio at 18100 {
-				compatible = "marvell,orion-gpio";
-				reg = <0x18100 0x40>;
+				compatible =
 "marvell,armada-370-xp-gpio";  

I think we should keep the "marvell,orion-gpio" too because the hardware is still compatible with it. Morever it will allow to use a recent dtb with an old kernel.

And it will remain compatible. Apart from not collecting compatible strings there is no reason to drop them right now, so will add them back for a (possible) v5.

Thanks
Ralph

#5 lore raw

PATCH v4 3/4 ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig

In reply to Ralph Sennhauser

From: Andrew Lunn <[email protected]>

Now that the GPIO driver also supports PWM operation, enable the PWM framework and fan driver in mvebu_v7_defconfig.

URL: https://patchwork.ozlabs.org/patch/427297/

[Ralph Sennhauser: add fan driver to defconfig]
---
 arch/arm/configs/mvebu_v7_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/mvebu_v7_defconfig +2 -0
index f1a0e25..6955370 100644
@@ -135,6 +135,8 @@ CONFIG_DMADEVICES=y
 CONFIG_MV_XOR=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_MEMORY=y
+CONFIG_PWM=y
+CONFIG_SENSORS_PWM_FAN=y
 CONFIG_EXT4_FS=y
 CONFIG_ISO9660_FS=y
 CONFIG_JOLIET=y
Signature · 1 line
2.10.2
#6 lore raw

PATCH v4 4/4 mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan

In reply to Ralph Sennhauser

From: Andrew Lunn <[email protected]>

The mvebu GPIO driver can also perform PWM on some pins. Use the pwm-fan driver to control the fan of the WRT1900AC, giving us finer grained control over its speed and hence noise.

URL: https://patchwork.ozlabs.org/patch/427291/

[Ralph Sennhauser: drop flags paramter from pwms, no longer used]
---
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/boot/dts/armada-xp-linksys-mamba.dts +3 -5
index 9efcf59..6d705f5 100644
@@ -308,13 +308,11 @@
 		};
 	};
 
-	gpio_fan {
+	pwm_fan {
 		/* SUNON HA4010V4-0000-C99 */
-		compatible = "gpio-fan";
-		gpios = <&gpio0 24 0>;
 
-		gpio-fan,speed-map = <0    0
-				      4500 1>;
+		compatible = "pwm-fan";
+		pwms = <&gpio0 24 4000>;
 	};
 
 	dsa {
Signature · 1 line
2.10.2
#7 lore raw

Re: [PATCH v4 4/4] mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan

Hi Ralph,

On lun., mars 27 2017, Ralph Sennhauser <[email protected]> wrote:

Here again the title should start with ARM: dts: armada-xp.

As for the other patch if there is no need for a v5 I will fix it while appliig it.

Thanks,

Gregory

Quoted 38 lines

From: Andrew Lunn <[email protected]>

The mvebu GPIO driver can also perform PWM on some pins. Use the pwm-fan driver to control the fan of the WRT1900AC, giving us finer grained control over its speed and hence noise.

URL: https://patchwork.ozlabs.org/patch/427291/

[Ralph Sennhauser: drop flags paramter from pwms, no longer used]
---
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/boot/dts/armada-xp-linksys-mamba.dts +3 -5
index 9efcf59..6d705f5 100644
@@ -308,13 +308,11 @@
 		};
 	};
 
-	gpio_fan {
+	pwm_fan {
 		/* SUNON HA4010V4-0000-C99 */
-		compatible = "gpio-fan";
-		gpios = <&gpio0 24 0>;
 
-		gpio-fan,speed-map = <0    0
-				      4500 1>;
+		compatible = "pwm-fan";
+		pwms = <&gpio0 24 4000>;
 	};
 
 	dsa {
Signature · 1 line
2.10.2
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw
In reply to Ralph Sennhauser

Hi Ralph,

On lun., mars 27 2017, Ralph Sennhauser <[email protected]> wrote:

[...]

Quoted 6 lines

Andrew Lunn (4):
gpio: mvebu: Add limited PWM support

mvebu: xp: Add PWM properties to .dtsi files
ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan

I didn't see any big problem with this 3 patches, I will applied them once the first one will be applied on the gpio tree or at least acked.

Thanks,

Gregory

Quoted 15 lines
 .../devicetree/bindings/gpio/gpio-mvebu.txt        |  32 ++
 MAINTAINERS                                        |   2 +
 arch/arm/boot/dts/armada-370.dtsi                  |  16 +-
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts      |   8 +-
 arch/arm/boot/dts/armada-xp-mv78230.dtsi           |  14 +-
 arch/arm/boot/dts/armada-xp-mv78260.dtsi           |  16 +-
 arch/arm/boot/dts/armada-xp-mv78460.dtsi           |  16 +-
 arch/arm/configs/mvebu_v7_defconfig                |   2 +
 drivers/gpio/gpio-mvebu.c                          | 324 ++++++++++++++++++++-
 9 files changed, 394 insertions(+), 36 deletions(-)
Signature · 1 line
2.10.2
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com