Skip to contentSkip to conversation

pwm: omap: Add PWM driver for OMAP using dual-mode timers

RFC PATCH New Joachim Eastwood 1 participant 1 message May 2, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 pwm: omap: Add PWM driver for OMAP using dual-mode timers

Adds support for using a OMAP dual-mode timer with PWM capability as a Linux PWM device. The driver controls the timer by using the dmtimer API.

Cc Grant Erickson <[email protected]>
Cc NeilBrown <[email protected]>

---

Hello,

First of all this is a RFC patch not to be merged in it's current state.

There are two problems with the driver now as I see.
* I don't think this hack will fly on mainline.
#include <../arch/arm/plat-omap/include/plat/dmtimer.h>
I use the above include path for testing now since the plat include doesn't work with DT multiplatform build.
Joel Fernandes is working on moving the dmtimer driver into drivers/clocksource so eventually this will be fixed.

* The drivers calls omap_dm_timer_set_source() to set the source. This should decided in DT on the timer node itself. There is also work in this area by Tero Kristo and Joel has said that this function will become a no-op when this work is done.

So for now it be nice if people could look at the dmtimer API usage, the DT bindings and the PWM part of the driver to see if that looks okay.

Joel: I have tested this driver on top of your last dmtimer cleanup patches and it works nicely. It would be nice if you could take a look at the dmtimer API usage. I think you might be the one who knows dmtimer best now.

A bit of history on this driver.
First version made by Grant Erickson for the old PWM API back in 2010. Later NeilBrown converted the driver to the new PWM API and submitted [1] it to the mail list back in 2012. The driver was then reviewed by Thierry Reding and Jon Hunter. NeilBrown also later added DT support to the driver. I have since made some fixes, removed platform data support and added DT documentation.

[1]: https://lkml.org/lkml/2012/12/12/51

regards
Joachim Eastwood

 Documentation/devicetree/bindings/pwm/pwm-omap.txt |  15 ++
 drivers/pwm/Kconfig                                |   9 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-omap.c                             | 273 +++++++++++++++++++++
 4 files changed, 298 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-omap.txt
 create mode 100644 drivers/pwm/pwm-omap.c
Documentation/devicetree/bindings/pwm/pwm-omap.txt new file +15 -0
new file mode 100644
index 000000000000..e254874e5eee
@@ -0,0 +1,15 @@
+* OMAP PWM for dual-mode timers
+
+Required properties:
+- compatible: Shall contain "ti,omap-pwm".
+- ti,timers: phandle to PWM capable OMAP timer. See arm/omap/timer.txt for info
+  about these timers.
+- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
+  the cells format.
+
+Example:
+	pwm: omap-pwm {
+		compatible = "ti,omap-pwm";
+		ti,timers = <&timer9>;
+		#pwm-cells = <3>;
+	};
drivers/pwm/Kconfig +9 -0
index 5b34ff29ea38..15b64aa14990 100644
@@ -168,6 +168,15 @@ config PWM_PCA9685
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-pca9685.
 
+config PWM_OMAP
+	tristate "OMAP PWM support"
+	depends on OF && ARCH_OMAP && OMAP_DM_TIMER
+	help
+	  Generic PWM framework driver for OMAP
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-omap
+
 config PWM_PUV3
 	tristate "PKUnity NetBook-0916 PWM support"
 	depends on ARCH_PUV3
drivers/pwm/Makefile +1 -0
index e57d2c38a794..db52650d65e9 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_PWM_LP3943)	+= pwm-lp3943.o
 obj-$(CONFIG_PWM_LPC32XX)	+= pwm-lpc32xx.o
 obj-$(CONFIG_PWM_LPSS)		+= pwm-lpss.o
 obj-$(CONFIG_PWM_MXS)		+= pwm-mxs.o
+obj-$(CONFIG_PWM_OMAP)		+= pwm-omap.o
 obj-$(CONFIG_PWM_PCA9685)	+= pwm-pca9685.o
 obj-$(CONFIG_PWM_PUV3)		+= pwm-puv3.o
 obj-$(CONFIG_PWM_PXA)		+= pwm-pxa.o
drivers/pwm/pwm-omap.c new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
1.8.0